From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3240CE68973 for ; Thu, 31 Oct 2024 10:46:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7EF346B0083; Thu, 31 Oct 2024 06:46:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 750976B0088; Thu, 31 Oct 2024 06:46:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4B7216B0089; Thu, 31 Oct 2024 06:46:30 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 2D3916B0083 for ; Thu, 31 Oct 2024 06:46:30 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id CCEC7120E44 for ; Thu, 31 Oct 2024 10:46:29 +0000 (UTC) X-FDA: 82733568204.02.9B5F263 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf19.hostedemail.com (Postfix) with ESMTP id DB4C71A000F for ; Thu, 31 Oct 2024 10:45:53 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=GLAnCyVj; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf19.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1730371506; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=/12baxoYTr2A/fkL+wrCyqw4E5vERnXsiTEdH8JVRp0=; b=Demh8B/Z9Hl+1o5PhzNW694cnDDJm1D2x0R27HzKhBEORH+jHzelHlDrFmxDzh/oH3O86K 402TF9zwGXpuvC9pwtGdMUX/mifITvZWF3FdTpX2bsESn+em4nnshanrFnpLzczuaTX+rF bAh37pCSGzS+bNi+/HW5oE68y1iS2Wc= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=GLAnCyVj; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf19.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1730371506; a=rsa-sha256; cv=none; b=lsqs+AA7xESQJlRsqcGyehvK86dWu2zGJ3NEohsqRUPN9SkLCkp+XWqHFG4dsjXmXsuXXD HxTIz0R1cCuz87b0R+SunK30jsbcPTiytgBOap0c/z9z91tiyBiIrgVISVB71epwSWcf/V 4cCDrwmVapU0/o9KtbTYh+rCXL0oFls= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1730371586; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=/12baxoYTr2A/fkL+wrCyqw4E5vERnXsiTEdH8JVRp0=; b=GLAnCyVjs1T5MSzUav+c5o9TAAVyz1d75sxos8npkzOWBIREKzwQgBebHgjYZwBaTc3bqH JQISFqAHo+i6+t9dF4atieOB9kgvtafslPwNadwXxbqL9ieU1P7bSijZFHTDh6v3EwlNTv /FoD4hbLMZzDeCcWGapJmUE0ZKwG/Dg= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-68-B66IkRPXO0y1hiLIBziydQ-1; Thu, 31 Oct 2024 06:46:23 -0400 X-MC-Unique: B66IkRPXO0y1hiLIBziydQ-1 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-37d43e7acd9so393574f8f.2 for ; Thu, 31 Oct 2024 03:46:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730371582; x=1730976382; h=content-transfer-encoding:in-reply-to:organization:autocrypt :content-language:from:references:cc:to:subject:user-agent :mime-version:date:message-id:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=/12baxoYTr2A/fkL+wrCyqw4E5vERnXsiTEdH8JVRp0=; b=Rx9mnMQOD/AYJbMFRWe1s7zzlLy0CSm1tjDHfKQsB54oHi6QzLjqaR4A2681eTm7lQ sngqyVtkSI0DUiuA7YikmoRqUGuZMrehGXWOqLpn5innCer+bCLH/zvELj8yUedslAs+ 15oj54Vmpf3bl4fqSshHkvOKG/yVEwfJGtJmN6s45Mad5srYJYYmKugNpmW9rKvrUr07 VisXke2Rh7ksxmaAJNx5GS0cMEPM+GFYOzkVw8B/nRpwZdPGGtMX9G0rOZHzhixroHe4 arwienDs21E4S2iaJEAIGYB10ane1Klme00CnzUqBAYDhCbdbHAVrJYcjadK7DWV90wh CkEA== X-Forwarded-Encrypted: i=1; AJvYcCWqgX8rK4LrFMPfClF8LbL7hN/9TcNd8NgNnJ9sZaGS1xbhGscB4mEowIaK2u97GHYazXMZBy6K6w==@kvack.org X-Gm-Message-State: AOJu0YyIsrQzpDLYMDncWvtIl4rVdAocfFtKsCZ8UuR1znQNp0WEv5XC H6gv1kIOkZ6li4o97S+8PeCMcTEcaaPgj/kty5j7vSPPrGmpCBkgYUrwq1hPEl88ztEZml4zrGD LVnXmekuEE2wSfnHwew0acxw1yfWAowi1CfIX5Zwv4qA/HBYw X-Received: by 2002:adf:e386:0:b0:37d:3e00:9a9b with SMTP id ffacd0b85a97d-38061127fd9mr14668283f8f.20.1730371582150; Thu, 31 Oct 2024 03:46:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHAyQpu8X7UbUqfI0b3AF/lGbqyz73d+pMty1nXcUTT7bV1dwtYVYEIkk9OchRfMJ2JlgaRpA== X-Received: by 2002:adf:e386:0:b0:37d:3e00:9a9b with SMTP id ffacd0b85a97d-38061127fd9mr14668255f8f.20.1730371581683; Thu, 31 Oct 2024 03:46:21 -0700 (PDT) Received: from ?IPV6:2003:cb:c70a:ed00:7ddf:1ea9:4f7a:91fe? (p200300cbc70aed007ddf1ea94f7a91fe.dip0.t-ipconnect.de. [2003:cb:c70a:ed00:7ddf:1ea9:4f7a:91fe]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-381c10b7b80sm1787899f8f.10.2024.10.31.03.46.20 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 31 Oct 2024 03:46:21 -0700 (PDT) Message-ID: <8247162b-a9dc-496e-83ee-504f74378e8e@redhat.com> Date: Thu, 31 Oct 2024 11:46:20 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC PATCH v3 0/4] Support large folios for tmpfs To: Baolin Wang , Daniel Gomez , Daniel Gomez , "Kirill A. Shutemov" Cc: Matthew Wilcox , akpm@linux-foundation.org, hughd@google.com, wangkefeng.wang@huawei.com, 21cnbao@gmail.com, ryan.roberts@arm.com, ioworker0@gmail.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Kirill A . Shutemov" References: <6dohx7zna7x6hxzo4cwnwarep3a7rohx4qxubds3uujfb7gp3c@2xaubczl2n6d> <8e48cf24-83e1-486e-b89c-41edb7eeff3e@linux.alibaba.com> <486a72c6-5877-4a95-a587-2a32faa8785d@redhat.com> <7eb412d1-f90e-4363-8c7b-072f1124f8a6@linux.alibaba.com> <1b0f9f94-06a6-48ac-a68e-848bce1008e9@redhat.com> <7ca333ba-f9bc-4f78-8f5b-1035ca91c2d5@redhat.com> <0b7671fd-3fea-4086-8a85-fe063a62fa80@linux.alibaba.com> <2782890e-09dc-46bd-ab86-1f8974c7eb7a@linux.alibaba.com> From: David Hildenbrand Autocrypt: addr=david@redhat.com; keydata= xsFNBFXLn5EBEAC+zYvAFJxCBY9Tr1xZgcESmxVNI/0ffzE/ZQOiHJl6mGkmA1R7/uUpiCjJ dBrn+lhhOYjjNefFQou6478faXE6o2AhmebqT4KiQoUQFV4R7y1KMEKoSyy8hQaK1umALTdL QZLQMzNE74ap+GDK0wnacPQFpcG1AE9RMq3aeErY5tujekBS32jfC/7AnH7I0v1v1TbbK3Gp XNeiN4QroO+5qaSr0ID2sz5jtBLRb15RMre27E1ImpaIv2Jw8NJgW0k/D1RyKCwaTsgRdwuK Kx/Y91XuSBdz0uOyU/S8kM1+ag0wvsGlpBVxRR/xw/E8M7TEwuCZQArqqTCmkG6HGcXFT0V9 PXFNNgV5jXMQRwU0O/ztJIQqsE5LsUomE//bLwzj9IVsaQpKDqW6TAPjcdBDPLHvriq7kGjt WhVhdl0qEYB8lkBEU7V2Yb+SYhmhpDrti9Fq1EsmhiHSkxJcGREoMK/63r9WLZYI3+4W2rAc UucZa4OT27U5ZISjNg3Ev0rxU5UH2/pT4wJCfxwocmqaRr6UYmrtZmND89X0KigoFD/XSeVv jwBRNjPAubK9/k5NoRrYqztM9W6sJqrH8+UWZ1Idd/DdmogJh0gNC0+N42Za9yBRURfIdKSb B3JfpUqcWwE7vUaYrHG1nw54pLUoPG6sAA7Mehl3nd4pZUALHwARAQABzSREYXZpZCBIaWxk ZW5icmFuZCA8ZGF2aWRAcmVkaGF0LmNvbT7CwZgEEwEIAEICGwMGCwkIBwMCBhUIAgkKCwQW AgMBAh4BAheAAhkBFiEEG9nKrXNcTDpGDfzKTd4Q9wD/g1oFAl8Ox4kFCRKpKXgACgkQT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NPPZ/NNMjaZ5b8Tovi8C0tmxiCHaQYqj7G2rgnT0kt WNyWQQ== Organization: Red Hat In-Reply-To: <2782890e-09dc-46bd-ab86-1f8974c7eb7a@linux.alibaba.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: DB4C71A000F X-Stat-Signature: 5ofphfezjp9dux75uzmyhintrazo7so3 X-HE-Tag: 1730371553-927619 X-HE-Meta: U2FsdGVkX18Fj6R1f1ceaX2Z2x4ARXqeKqTXGsQItZNhxKw3xNvniF/9wRRVnJXV///rkX3iXkTr6EJJ1Th3oyM04/z3aJPtPvbBHgZ5LcSsK3MzgQ5TVclGt5VQk6pJ5VYkewl+iELzrUTxTRDOhpPFRfqudKDyK4IQjkucQkOrmgXew4kYZbulh77tLX/pDByBdO9MQnUROaWyejXvxRngC6l/EV7SaxbFDZqgEd8Y45NVVkaXPq5y+Ldai2vCzYHROgMsHhoZ1BNGhLChL7wJ4Dt24NHfbOPlE5Gi1/5EpoA8W+dLP9i3sGW6dfTbJdW0PIMsrx+40z518lDZwmZqd2QoWBctvL3FW0XgK/CklnhiNIr3oZ74cV4S3Bpp3Xb8s07bzLxhf6rHAn+tm+Qz3cIK27xvmmHl63c4g5kHJbHzQJSmiR8TvycMHuPGRGLk+mJ1+F5+a/ls6MwmZs+601p3mZxcd3qQWUaIhYd9lhza/YAFt+AFO2kkkqqtUGG0eLSzuXDvk7YGeskCFXdhGxzxBs1CpIBtdm/e8HIEwyTIlKUbzW5YhtPk4S5YDLTA2qBGeD9i9QxZ8pxJ2zMEyBpPA2RpAFdQUUHRUSl1lFW1YE5yXCTNfMk6pxRerR0KIZaJnF7sDrOzCPUbOrQpnEPn+f05WtzBF5nPxw8eEoYzScn+2jFNyhoxMyTTbTWJBKJ2UUB5LFREE6jILgBOrNaiMqDd5P5MJxtoLTRghNgZw+AbIYlTNMnvAdCZ6R58+2rSIeyIzidKADcNFRZmvVO5Vh39lJtOc/wSkdyRs3zCvJIb77l0rtLupUKZMQ3kGIAYA+s13XNhmdlcKUdCqrtPxZ4xy3IGwG1zBH2xDyk45nkMt3nCvPddUqMXpQGTJGQBlFy2C67guDY0CNKVN0c1/Jm0wWzPETq8cl7w+TQmZ1JTJ+pEwPthHDkz1hR/0p1+XiarmoqlwUu zEwxT0Ln X87vVd1USCWl5Q8o89Xett+RjrxgAYOYQ58ytHV7PvdAogDZdnQQ2rQFDEWNoomK+OjPq5qWRz+wvKMTw5IBobQA07r8R7HUwle2yKAXwbdy4QUIEvaKOkzhU27snWbPHBOAOB+FL1lkwl4QOu7Pqa8/bJS3n8hI1HssToNbZw4e3m20WxknDKZ8BXpX1hRCtsvaBHmCeFE+se2YgPsyxE7o/yl9Fju6bIUJThX2jGrjablfGSHYeMy4E7RVE1lYTtw6Mx3A10bAf2M+z4oraQbjxvkQ7L46ZTabdl8/F7f4oBSdfCjQp2ZpaG0hvMxzbCzn4fsO8cDRfJOforfTdqw1lj5WsgcJ+O3hAPp3UF0yZwM2mBXmLUYPk4q0bSDiKjYfBzAk+HRBHoZjA7On2l9O14TXsV9OB/nvEQIqbqpmKOX8= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: >>> I am still worried about adding a new kconfig option, which might >>> complicate the tmpfs controls further. >> >> Why exactly? > > There will be more options to control huge pages allocation for tmpfs, > which may confuse users and make life harder? Yes, we can add some > documentation, but I'm still a bit cautious about this. If it's just "changing the default from "huge=never" to "huge=X" I don't see a big problem here. Again, we already do that for anon THPs. If we make more behavior depend on than (which I don't think we should be doing), I agree that it would be more controversial. [..] >>> >>>> That should probably do as a first shot; I assume people will want more >>>> control over which size to use, especially during page faults, but that >>>> can likely be added later. >> >> I know, it puts you in a bad position because there are different >> opinions floating around. But let's try to find something that is >> reasonable and still acceptable. And let's hope that Hugh will voice an >> opinion :D > > Yes, I am also waiting to see if Hugh has any inputs :) We keep saying that ... I have to find a way to summon him :) > >>> After some discussions, I think the first step is to achieve two goals: >>> 1) Try to make tmpfs use large folios like other file systems, that >>> means we should avoid adding more complex control options (per Matthew). >>> 2) Still need maintain compatibility with the 'huge=' mount option (per >>> Kirill), as I also remembered we have customers who use >>> 'huge=within_size' to allocate THPs for better performance. >> >>> >>> Based on these considerations, my first step is to neither add a new >>> 'huge=' option parameter nor introduce the mTHP interfaces control for >>> tmpfs, but rather to change the default huge allocation behavior for >>> tmpfs. That is to say, when 'huge=' option is not configured, we will >>> allow the huge folios allocation based on the write size. As a result, >>> the behavior of huge pages for tmpfs will change as follows: >> > > no 'huge=' set: can allocate any size huge folios based on write size >> > huge=never: no any size huge folios> huge=always: only PMD sized THP >> allocation as before >> > huge=fadvise: like "always" but only with fadvise/madvise> >> huge=within_size: like "fadvise" but respect i_size >> >> I don't like that: >> >> (a) there is no way to explicitly enable/name that new behavior. > > But this is similar to other file systems that enable large folios > (setting mapping_set_large_folios()), and I haven't seen any other file > systems supporting large folios requiring a new Kconfig. Maybe tmpfs is > a bit special? I'm afraid I don't have the energy to explain once more why I think tmpfs is not just like any other file system in some cases. And distributions are rather careful when it comes to something like this ... > > If we all agree that tmpfs is a bit special when using huge pages, then > fine, a Kconfig option might be needed. > >> (b) "always" etc. are only concerned about PMDs. > > Yes, currently maintain the same semantics as before, in case users > still expect THPs. Again, I don't think that is a reasonable approach to make PMD-sized ones special here. It will all get seriously confusing and inconsistent. THPs are opportunistic after all, and page fault behavior will remain unchanged (PMD-sized) for now. And even if we support other sizes during page faults, we'd like start with the largest size (PMD-size) first, and it likely might just all work better than before. Happy to learn where this really makes a difference. Of course, if you change the default behavior (which you are planning), it's ... a changed default. If there are reasons to have more tunables regarding the sizes to use, then it should not be limited to PMD-size. > >> So again, I suggest: >> >> huge=never: No THPs of any size >> huge=always: THPs of any size >> huge=fadvise: like "always" but only with fadvise/madvise >> huge=within_size: like "fadvise" but respect i_size >> >> "huge=" default depends on a Kconfig option. >> >> With that we: >> >> (1) Maximize the cases where we will use large folios of any sizes >>     (which Willy cares about). >> (2) Have a way to disable them completely (which I care about). >> (3) Allow distros to keep the default unchanged. >> >> Likely, for now we will only try allocating PMD-sized THPs during page >> faults, and allocate different sizes only during write(). So the effect >> for many use cases (VMs, DBs) that primarily mmap() tmpfs files will be >> completely unchanged even with "huge=always". >> >> It will get more tricky once we change that behavior as well, but that's >> something to likely figure out if it is a real problem at at different >> day :) >> >> >> I really preferred using the sysfs toggles (as discussed with Hugh in >> the meeting back then), but I can also understand why we at least want >> to try making tmpfs behave more like other file systems. But I'm a bit >> more careful to not ignore the cases where it really isn't like any >> other file system. > > That's also my previous thought, but Matthew is strongly against that. > Let's step by step. Yes, I understand his view as well. But I won't blindly agree to the "tmpfs is just like any other file system" opinion :) > >> If we start making PMD-sized THPs special in any non-configurable way, >> then we are effectively off *worse* than allowing to configure them >> properly. So if someone voices "but we want only PMD-sized" ones, the >> next one will say "but we only want cont-pte sized-ones" and then we >> should provide an option to control the actual sizes to use differently, >> in some way. But let's see if that is even required. > > Yes, I agree. So what I am thinking is, the 'huge=' option should be > gradually deprecated in the future and eventually tmpfs can allocate any > size large folios as default. Let's be realistic, it won't get removed any time soon. ;) So changing "huge=always" etc. semantics to reflect our new size options, and then try changing the default (with the option for people/distros to have the old default) is a reasonable approach, at least to me. I'm trying to stay open-minded here, but the proposal I heard so far is not particularly appealing. -- Cheers, David / dhildenb