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 21755E68974 for ; Thu, 31 Oct 2024 10:46:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AF9BD6B0082; Thu, 31 Oct 2024 06:46:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A83156B0083; Thu, 31 Oct 2024 06:46:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8D58D6B0088; Thu, 31 Oct 2024 06:46:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 6C4E86B0082 for ; Thu, 31 Oct 2024 06:46:29 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id E6003AD0A1 for ; Thu, 31 Oct 2024 10:46:28 +0000 (UTC) X-FDA: 82733567490.25.CE7EE6B Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf12.hostedemail.com (Postfix) with ESMTP id 3A7F940027 for ; Thu, 31 Oct 2024 10:46:14 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=FkdTIYeC; spf=pass (imf12.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1730371542; 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=QYHeg6p6rz9oGpqpYFKKrT8NDWjGHmBOoy89Td/tEdn738tHjz+GyONU6YWz7joRarnpZP pZQuMMIOWVw+az+uvyzG/u6Qyzsfrv0Lg9XZMrOE0vsuG+3qgRHUBBL0mbUXENgzHrY0f5 7J42DyHJW5oy9O9R0e3rCBbE1Zn2PiU= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1730371542; a=rsa-sha256; cv=none; b=rXevrEPlz5OcrtJgDsCucGnq+hSxoZ9IK6vY5Sx+FqvPcwJToMk5pTsYmgT6qt24KaVITc OrCUPkzfkCwMHau3WXVApf3eRAa9h/joCAEfhZyE+B7aBLWNH6oevhMTGCYvp3n7AWeTNG H3ddGSxQA5JpkUjYP4SB+kOFDmbSaKM= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=FkdTIYeC; spf=pass (imf12.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1730371585; 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=FkdTIYeCGXXGa4zmy+AH7bs33DjiZHPwBc38JYvJspejVYsIxFJq8BxKKbWFXyHjp84NZg SRH/Lsrm30utJ0/rceQRRjHGtCiL23Z/XVp1ui2572BTMch06jKYIyXYnt+Ld1wvvoZafL YKZrBgU7Z0En4F+CtdRvqCeYhFfUaes= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-131-8wKyMHj6Nq6EKmZNKDZSSg-1; Thu, 31 Oct 2024 06:46:24 -0400 X-MC-Unique: 8wKyMHj6Nq6EKmZNKDZSSg-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-4315c1b5befso5006475e9.1 for ; Thu, 31 Oct 2024 03:46:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730371584; x=1730976384; 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=o4O2q/8EdL5TNEz8EIASz6ukMKhQOf9IvenqOtishywU69VwKs4B4q7owGxfg2jSE5 Jd7MLZQrYGFkC2RgUAUXVvfLtdx4TPrETf7v847FsnmgT488zGRpBAAStDvzcFpUyOaI E9DXHqiN3CsbHBYQMMNx09U4jUGSOIujvR+05PSGdycH25jG5dA7yQqFlruX5/JKjCUv wWCSCwdawTHgcLbt/m9WN1F1B5aom33LOaoDdlvOg3j43nRuwhxITOe3ph/U6WS/vzfN /pLj/i9PvV5ThO8sf2ynZSNvJ4DMwelboYU69xwgXDsGptYNw85vOfhp0yIzyLV2xoIv d27A== X-Forwarded-Encrypted: i=1; AJvYcCX+RjBSgoMyx04HtXSkQtRF4idmpunygVhab/vmxz/HAS7k+FKOXzcXxEBJp1fIyWGsIqSDq1lyVA==@kvack.org X-Gm-Message-State: AOJu0YyFFWJfPYGsnB7h2DzfFR7dZYiI5SREg2TwNvSacjzsBmgqpOTO FSDk9FhqIxlpxwWOBGIyuq5xuFUHKKAHBMNGTRrxz11mPhK/4ERnnw1mIvUr2UGqv+WYQ2f1Dyf PCaZPqAjNXtFGFIzEmbtdfUSrarljb3IS1AoXO59ulrmYPnZK X-Received: by 2002:adf:e04d:0:b0:37d:523c:5ce2 with SMTP id ffacd0b85a97d-380610f7e4fmr13921199f8f.1.1730371583589; Thu, 31 Oct 2024 03:46:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFe8FxFQDzKmgOJKJGfyFQ8Pk8lgquDCLSFp61Sa4Yxu7ZUtnhfTat9A6nO3u9gxsLkvcKk2A== X-Received: by 2002:adf:e04d:0:b0:37d:523c:5ce2 with SMTP id ffacd0b85a97d-380610f7e4fmr13921179f8f.1.1730371583203; Thu, 31 Oct 2024 03:46:23 -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.21 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 31 Oct 2024 03:46:22 -0700 (PDT) Message-ID: <99a3cc07-bdc3-48e2-ab5c-6f4de1bd2e7b@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 AgMBAh4BAheAAhkBFiEEG9nKrX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90RMe2tRL06BGiRZr jPrnvUsUUsjRoRNJjKKA/REq+sAnhkNPPZ/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-Stat-Signature: 5ofphfezjp9dux75uzmyhintrazo7so3 X-Rspam-User: X-Rspamd-Queue-Id: 3A7F940027 X-Rspamd-Server: rspam02 X-HE-Tag: 1730371574-368677 X-HE-Meta: U2FsdGVkX1++aZEQZZ1i41qSw+lrPn3sjFVfcLsQWRQHg42kLyAxZawaFSClYbOTLZpSJbKly2DXkAfm06OUkRN9N7zplNcgtZstH3lUg1rLnlLP3+yQSGTcloHadOzt2Rf3nlRMR34BervHarg8RJhm96q/NhK2o0HhTdSprN7TkBElPx9V7Es2iF8C1GXuLf955HkC+Tny/TEQywuHgG5T8a2ILZYt+QDVhDIU2mhw9b32uffw9PQIaVQS7u78IC+mV9bFKWpM4+pW/HBPita9+wsrHParD9kU6+BSRBASSE0QTRopNh2/1AJbGhNE01ebF0hdluYtV+8WwijoOVhrSp0n5Fu+K2N8mctUb60ppMoCgRE/CTFNpiSsvDtu68VrKhgcpnFbUQ1HUDX2IYRRflsg92Y9LWyBob+lBNLuVgAYSrjfuFaiRiAJmh7ySLjLSV6KgDa2hz5LbtpljqGaqgvla4NDkV9AQTazDQLwcPZrZB2w8uod3mzglgb+JzoGO6i1G7YsQVCUJiUtst4n6jJ37kV1HwqoQYjGJ93XkJf4tGuo0uS9f0SJbwJoQtbPO4MRh/lgY1nUB8ETISZXgiw61ohUs3iTFUuJs9FbIGHFsrpvzrAfqGXc/o10p+oZ/kxAbxVyJQWsrhZW19IOZGzNGQ2NabN50eH63fNRDmDJ2ijZ+U6Uo7Dp38dq8Gm+zBT5Wl7VTw5tZ4mXM8LwYH6pbDjx9TKISSr65Ug4fGpU63Ek8RReH6j6Annqe7FnQq61nMekmELrdN7B7Msvit+Havly/tIUZHm549Hlkfi5ZZA2BbTvzFX1xfS6Cj5if0OE26tKoSnzuD9+aVtJSdZEEnOrtcva4h26fIJiqUbFnTlydKehyyYMTdjf9Crp9r4xp48L+x5ZfDARA8WRIdBQnQLM+zefcZ7LOkI3HVrm4O5BxEDfqK+mF+Q/AvXuUGVEE2/ok9J9jl+ tdDaoqZh KU3XmOCrvoqS9aY+DtXAq2/t76Sx1M1Crl2blWPYoQFh7oI3W+oDBRQvpfXiOmNDODoNZPBAGg65hLAbCt9c6d1faEFPk5IjcFd/uKtnr3aeIeVj4WMJDZ743k0CoZcJN7oW9eshjJ+2UbbQS4qqG2hN7Zkg1jfnVU/PLu/WGUenppylAiIXQNzVwdUxjALwaMBJOzQNxXRGVPioV6Wl0XOMsVGqNy3dESxxTf0wGyCGeGYRKQoOhWdkd/LnzKcKcDIjMVN08hQd3+CYc+Gsa3q86GRc4fxMShDhJB1gQxyDHD3v2R15QTrnvYpAIh+AhGX1arc0FzaBAm5WZNASetKZtKVO18kI+A9JkIBTBwMT4Xdz4o3pWi3aocCrbbZsTAgxNGv8kmq9vVpd9zpcqmw4dXZlcOJwH6eV4ofa3f67w+m4= 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