Received: by 2002:a05:7208:13c3:b0:82:bbfa:f723 with SMTP id r3csp88881rbe; Thu, 9 May 2024 10:49:07 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX5m+BZQMGej5SbiaW9hQgrtMtdzbpgJOfaACT1O92FIhgsG6y33UYhDlFZ8T0v0EPBWuks9WYCUR79+p6mZk1sfGuxHDqAub8rTHSFSg== X-Google-Smtp-Source: AGHT+IGGEL8E+1jJOn1lVAl/c+3UTUUQwHd+oWucrbx7zQt9wRHr/jP8325lmCLzwidhNhDY1J0z X-Received: by 2002:a17:903:40c8:b0:1eb:3d24:3f7a with SMTP id d9443c01a7336-1ef43d181dcmr4084625ad.26.1715276946916; Thu, 09 May 2024 10:49:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715276946; cv=pass; d=google.com; s=arc-20160816; b=UmlQUR8mmcI2HlYpBmJE31yckciq+bhxlZ6mdOCbjFvZ+mmk6+NtYZhXUH05FxYzaW paB91dvYF19gAK9RzkDbC7nQRnqpSttvNSysQdb0kMyf1VUR188/dy6f/uGTVyu9egVJ jdzke2GkROrFditIPzuhxvWnWRb1vbtD6Qa3svj7L4GdsW0YIWUe6zcSjZCWgXgurHCw mJKilK7PgdQBNYi6PpYaZsTYA8IbgTbz6bVd9Xbsvi3vYtds0LH+6QptxP7Ua2NymsHS V7a1fzxPlOl3uEKrfjmPkuVFkm5njQ6/icS1/qu4suLZ6Ur4lvY5XXs0fxbeu3m03nMJ d0Gw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:organization:autocrypt :content-language:from:references:cc:to:subject:user-agent :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :date:message-id:dkim-signature; bh=CcvU8eoRJ3v3bJAMRLSLp1zquftLdgbiPZewW3s0bAc=; fh=YGPTWIlATuKmtzNWJgtw3uO5AUDEBi9LSsajRZnQgdQ=; b=LjcenHLgj3QTh3W5Y2ReN/7Cuqn8AS80LxZ+wJz+5+ml1+3loF26EWAyLmhitJgNWO 3HhfZjw5IdSoVy4Mw1nkHqKiS8MmAYxc8qQ/9SuD8FbQTixl8vV9UFMUO8x8c22yJTHs dCzaNikw8kj5XIUfz1vwu+UdNVTnRFfLIkoCrCFwU3Wbm0k8jdlsI0BxE0pkck3IINxt Iof8NtuFtKxyiokS1i8aSnhy5gXRpr3gMzca/19LzzyICmBxMwXMLXr+0DjzoiV5vGZz eJ8goKibRxznCg3OuGQaL9tWFjsVE1fAAE9czy0KioxQDRq5VbtMlEzP42Tv9lepqqKY CshQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="AKc/J3k0"; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-174745-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-174745-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d9443c01a7336-1ef0c03b6f6si19023125ad.428.2024.05.09.10.49.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 May 2024 10:49:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-174745-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="AKc/J3k0"; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-174745-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-174745-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 90540282DAA for ; Thu, 9 May 2024 17:49:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2C546770EA; Thu, 9 May 2024 17:48:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="AKc/J3k0" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4B28B10979 for ; Thu, 9 May 2024 17:48:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715276933; cv=none; b=LGO+ShWyKNV9dv0/pVzR6Fh/+CnXfMb0+FMYNUaa+TdMm9OxCmUcFqRwG6njNi5KxvrCJ6+vZGXcIThK13qvWuwL9Tw6PdHlTCuCuI08QHWqfu05NRs2yYFITM/hnjc2iXTHugLYXMASfZ7lnAMp+DeTSQYMEt0A2609YHDXA9Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715276933; c=relaxed/simple; bh=fjrIqfLCcacQIwwbkR6Q2FTSjkEoTu7mJkxVdALUiT4=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=a8fHQXi07QbvCDdTtsjZXLo3wgpopROta17lVj48YbuJOcm4OSks7M83y7fOtL17W5biU6BfFHr0ReL5SdvWcT94jL6IFDYbCoBexhGTBb3SRAiSAfL7Tltlla6FGpoWAry6W01SEBtnwm477ojeNQmDehxwhpfUq1OWE+72Las= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=AKc/J3k0; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1715276931; 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=CcvU8eoRJ3v3bJAMRLSLp1zquftLdgbiPZewW3s0bAc=; b=AKc/J3k0UfkQEyRkU7Pa26Ac9DYPGCgXkBdExmK6zZhSSwx7TadJwDC3S8c6Tsvwp0Nd/k tatPp0FdBonU3LcG30rk2sa/4j8NYTCanwJ4UDt9gymkrEISKiSvcfyOzobxZAZY5W9VFZ 701vSZRMLL7Fy5+4DVbMKh9E74x0Y4g= 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-536-QbFQeajtOEulP2NBNasV1w-1; Thu, 09 May 2024 13:48:49 -0400 X-MC-Unique: QbFQeajtOEulP2NBNasV1w-1 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-34da8f1bf7cso778651f8f.2 for ; Thu, 09 May 2024 10:48:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715276929; x=1715881729; 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=CcvU8eoRJ3v3bJAMRLSLp1zquftLdgbiPZewW3s0bAc=; b=dv+/4ofY78hjfKg2d5YHg96O2MbXbfB8WssJJrfuHj+p2X8DN7tlaIwT2Tbu6PheAr 1uccejjl4rgmENPHrJgaaHwNFpY2J3mv8hf0l7QmWP+CXhbak6yo6DAvawmYVNUE1T6C V+Uyz6lEipeyhCVmYX7CyX9pjqhBPkm+zK5fXP6C1yBw6tjHS6lRBoTkl6TMUqc6kMBX 7jdhaiRUvbezyRC1gAx56yeWQLN6ZL148+qoGkPbQR/bvpISzUgDRY1c6CeEsIxVjHI9 fjoy2pSb/CKkxQk5Gt+iFKBj8Aijxtl53yIbxShyaf3LIs/SA3JFiv8w+AoY9ZigIIs8 GCPA== X-Forwarded-Encrypted: i=1; AJvYcCWqsVVISJLP4EAgVf9e7AxT7AWMTnuwn6+u2pxaw8Z4cWL+kmbhHJm9EZLcy7Un58HgS8J+G5uBcBKl+13x5J+DOyZ/6EYVL1CD+IMN X-Gm-Message-State: AOJu0YzvDTGE8xpqRCJ/zLU9ui0npLaMRwlN4C6SHcBZpamt+RgYnkwn L36FmYTQbXhXvljcDBAlB+oUANoorG+ifhm6WmplEkaeQqQRl/0PLkoM2gG58gFfm/K0aj5T3wa 6YjxZYh4Dqz45RzntF0TcfnYZ04vZAtAaHBN3O3eqmQM438Sg9jha4Vp1Cae3VA== X-Received: by 2002:a5d:4fd0:0:b0:34b:dc21:68f2 with SMTP id ffacd0b85a97d-3504a738229mr299178f8f.28.1715276928727; Thu, 09 May 2024 10:48:48 -0700 (PDT) X-Received: by 2002:a5d:4fd0:0:b0:34b:dc21:68f2 with SMTP id ffacd0b85a97d-3504a738229mr299154f8f.28.1715276928297; Thu, 09 May 2024 10:48:48 -0700 (PDT) Received: from ?IPV6:2003:cb:c716:7600:ac6:a414:3c04:6f5a? (p200300cbc71676000ac6a4143c046f5a.dip0.t-ipconnect.de. [2003:cb:c716:7600:ac6:a414:3c04:6f5a]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3502bbbbde1sm2279992f8f.97.2024.05.09.10.48.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 09 May 2024 10:48:47 -0700 (PDT) Message-ID: <23ea6dbd-1d4e-4aeb-900b-646db880cfb6@redhat.com> Date: Thu, 9 May 2024 19:48:46 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 0/8] add mTHP support for anonymous shmem To: Luis Chamberlain , Matthew Wilcox , Christoph Lameter , Christoph Hellwig , Dave Chinner Cc: Daniel Gomez , Baolin Wang , "akpm@linux-foundation.org" , "hughd@google.com" , "ioworker0@gmail.com" , "wangkefeng.wang@huawei.com" , "ying.huang@intel.com" , "21cnbao@gmail.com" <21cnbao@gmail.com>, "ryan.roberts@arm.com" , "shy828301@gmail.com" , "ziy@nvidia.com" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , Linux FS Devel References: From: David Hildenbrand Content-Language: en-US Autocrypt: addr=david@redhat.com; keydata= xsFNBFXLn5EBEAC+zYvAFJxCBY9Tr1xZgcESmxVNI/0ffzE/ZQOiHJl6mGkmA1R7/uUpiCjJ dBrn+lhhOYjjNefFQou6478faXE6o2AhmebqT4KiQoUQFV4R7y1KMEKoSyy8hQaK1umALTdL QZLQMzNE74ap+GDK0wnacPQFpcG1AE9RMq3aeErY5tujekBS32jfC/7AnH7I0v1v1TbbK3Gp XNeiN4QroO+5qaSr0ID2sz5jtBLRb15RMre27E1ImpaIv2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y/Nksu0eY7x6HfQJ3xajVH32Ms6t1trDQmPx2iP5+7iDsb7OKAb5eOS8h+BEBDeq 3ecsQDv0fFJOA9ag5O3LLNk+3x3q7e0uo06XMaY7UHS341ozXUUI7wC7iKfoUTv03iO9El5f XpNMx/YrIMduZ2+nd9Di7o5+KIwlb2mAB9sTNHdMrXesX8eBL6T9b+MZJk+mZuPxKNVfEQMQ a5SxUEADIPQTPNvBewdeI80yeOCrN+Zzwy/Mrx9EPeu59Y5vSJOx/z6OUImD/GhX7Xvkt3kq Er5KTrJz3++B6SH9pum9PuoE/k+nntJkNMmQpR4MCBaV/J9gIOPGodDKnjdng+mXliF3Ptu6 3oxc2RCyGzTlxyMwuc2U5Q7KtUNTdDe8T0uE+9b8BLMVQDDfJjqY0VVqSUwImzTDLX9S4g/8 kC4HRcclk8hpyhY2jKGluZO0awwTIMgVEzmTyBphDg/Gx7dZU1Xf8HFuE+UZ5UDHDTnwgv7E th6RC9+WrhDNspZ9fJjKWRbveQgUFCpe1sa77LAw+XFrKmBHXp9ZVIe90RMe2tRL06BGiRZr jPrnvUsUUsjRoRNJjKKA/REq+sAnhkNPPZ/NNMjaZ5b8Tovi8C0tmxiCHaQYqj7G2rgnT0kt WNyWQQ== Organization: Red Hat In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 08.05.24 21:23, Luis Chamberlain wrote: > On Wed, May 08, 2024 at 01:58:19PM +0200, David Hildenbrand wrote: >> On 08.05.24 13:39, Daniel Gomez wrote: >>> On Mon, May 06, 2024 at 04:46:24PM +0800, Baolin Wang wrote: >>>> The primary strategy is similar to supporting anonymous mTHP. Introduce >>>> a new interface '/mm/transparent_hugepage/hugepage-XXkb/shmem_enabled', >>>> which can have all the same values as the top-level >>>> '/sys/kernel/mm/transparent_hugepage/shmem_enabled', with adding a new >>>> additional "inherit" option. By default all sizes will be set to "never" >>>> except PMD size, which is set to "inherit". This ensures backward compatibility >>>> with the shmem enabled of the top level, meanwhile also allows independent >>>> control of shmem enabled for each mTHP. >>> >>> I'm trying to understand the adoption of mTHP and how it fits into the adoption >>> of (large) folios that the kernel is moving towards. Can you, or anyone involved >>> here, explain this? How much do they overlap, and can we benefit from having >>> both? Is there any argument against the adoption of large folios here that I >>> might have missed? >> >> mTHP are implemented using large folios, just like traditional PMD-sized THP >> are. >> >> The biggest challenge with memory that cannot be evicted on memory pressure >> to be reclaimed (in contrast to your ordinary files in the pagecache) is >> memory waste, well, and placement of large chunks of memory in general, >> during page faults. >> >> In the worst case (no swap), you allocate a large chunk of memory once and >> it will stick around until freed: no reclaim of that memory. >> >> That's the reason why THP for anonymous memory and SHMEM have toggles to >> manually enable and configure them, in contrast to the pagecache. The same >> was done for mTHP for anonymous memory, and now (anon) shmem follows. >> >> There are plans to have, at some point, have it all working automatically, >> but a lot for that for anonymous memory (and shmem similarly) is still >> missing and unclear. > > Whereas the use for large folios for filesystems is already automatic, > so long as the filesystem supports it. We do this in readahead and write > path already for iomap, we opportunistically use large folios if we can, > otherwise we use smaller folios. > > So a recommended approach by Matthew was to use the readahead and write > path, just as in iomap to determine the size of the folio to use [0]. > The use of large folios would also be automatic and not require any > knobs at all. Yes, I remember discussing that with Willy at some point, including why shmem is unfortunately a bit more "special", because you might not even have a disk backend ("swap") at all where you could easily reclaim memory. In the extreme form, you can consider SHMEM as memory that might be always mlocked, even without the user requiring special mlock limits ... > > The mTHP approach would be growing the "THP" use in filesystems by the > only single filesystem to use THP. Meanwhile use of large folios is already > automatic with the approach taken by iomap. Yes, it's the extension of existing shmem_enabled (that -- I'm afraid -- was added for good reasons). > > We're at a crux where it does beg the question if we should continue to > chug on with tmpfs being special and doing things differently extending > the old THP interface with mTHP, or if it should just use large folios > using the same approach as iomap did. I'm afraid shmem will remain to some degree special. Fortunately it's not alone, hugetlbfs is even more special ;) > > From my perspective the more shared code the better, and the more shared > paths the better. There is a chance to help test swap with large folios > instead of splitting the folios for swap, and that would could be done > first with tmpfs. I have not evaluated the difference in testing or how > we could get the most of shared code if we take a mTHP approach or the > iomap approach for tmpfs, that should be considered. I don't have a clear picture yet of what might be best for ordinary shmem (IOW, not MAP_SHARED|MAP_PRIVATE), and I'm afraid there is no easy answer. As long as we don't end up wasting memory, it's not obviously bad. But some things might be tricky (see my example about large folios stranding in shmem and never being able to be really reclaimed+reused for better purposes) I'll note that mTHP really is just (supposed to be) a user interface to enable the various folio sizes (well, and to expose better per-size stats), not more. From that point of view, it's just a filter. Enable all, and you get the same behavior as you likely would in the pagecache mode. From a shared-code and testing point of view, there really wouldn't be a lot of differences. Again, essentially just a filter. > > Are there other things to consider? Does this require some dialog at > LSFMM? As raised in my reply to Daniel, I'll be at LSF/MM and happy to discuss. I'm also not a SHMEM expert, so I'm hoping at some point we'd get feedback from Hugh. -- Cheers, David / dhildenb