Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Kiryl Shutsemau <kirill@shutemov.name>
To: Zi Yan <ziy@nvidia.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	 David Hildenbrand <david@kernel.org>,
	Lorenzo Stoakes <ljs@kernel.org>,
	 Nico Pache <nico.pache@linux.dev>,
	Baolin Wang <baolin.wang@linux.alibaba.com>,
	 Barry Song <baohua@kernel.org>, Dev Jain <dev.jain@arm.com>,
	Hugh Dickins <hughd@google.com>,
	 Lance Yang <lance.yang@linux.dev>,
	"Liam R. Howlett" <liam@infradead.org>,
	 Michal Hocko <mhocko@suse.com>, Mike Rapoport <rppt@kernel.org>,
	 Ryan Roberts <ryan.roberts@arm.com>,
	Shuah Khan <shuah@kernel.org>,
	 Suren Baghdasaryan <surenb@google.com>,
	Usama Arif <usama.arif@linux.dev>,
	 Vlastimil Babka <vbabka@kernel.org>,
	linux-mm@kvack.org, linux-kselftest@vger.kernel.org,
	 linux-kernel@vger.kernel.org
Subject: Re: [PATCH 16/16] selftests/mm: skip khugepaged shmem cases without a PMD page cache folio
Date: Thu, 6 Aug 2026 13:54:05 +0100	[thread overview]
Message-ID: <anSClqrkH2y3pxpm@thinkstation> (raw)
In-Reply-To: <DKETQDCO9OYH.2FDBR4ZXGHLM@nvidia.com>

On Sun, Aug 02, 2026 at 06:50:36PM -0400, Zi Yan wrote:
> On Sun Aug 2, 2026 at 3:52 PM EDT, Kiryl Shutsemau wrote:
> > From: "Kiryl Shutsemau (Meta)" <kas@kernel.org>
> >
> > The page cache caps folio order at MAX_PAGECACHE_ORDER, and
> > xas_split_alloc() puts that cap below the PMD order where a PMD is 512M --
> > arm64 with 64K base pages, as include/linux/pagemap.h says outright.
> > shmem_huge_global_enabled() then offers no PMD order at all, so
> > MADV_COLLAPSE of a shmem range answers -EINVAL and khugepaged passes over
> > it.
> 
> IIRC, after READ_ONLY_THP_FOR_FS is removed, all pagecache folios are
> split using non uniform split, xas_try_split(), so does shmem (except
> shmem in swapcache not splittable). In theory, we can get rid of the
> cap, since xas_try_split() does not split more than one level like
> one can try to make xas_split_alloc() split more than two level (e.g.,
> 512MB to 64KB on arm64 with 64KB base page).

Not really: xas_try_split() is the non-uniform path only.  A uniform split
of a pagecache folio still goes through xas_split_alloc(), in
__folio_split():

	if (split_type == SPLIT_TYPE_UNIFORM) {
		xas_set_order(&xas, folio->index, new_order);
		xas_split_alloc(&xas, folio, old_order, gfp);

and __split_unmapped_folio() keeps the two apart for a reason it states
itself:

	 * uniform split has xas_split_alloc() called before
	 * irq is disabled to allocate enough memory, whereas
	 * non-uniform split can handle ENOMEM.

So MAX_PAGECACHE_ORDER is still the limit.

I do not think non-uniform split can simply take over everywhere either.
There are going to be cases when a folio has to be fully dissolved to
order-0.

-- 
  Kiryl Shutsemau / Kirill A. Shutemov


  reply	other threads:[~2026-08-06 12:54 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-02 19:52 [PATCH 00/16] selftests/mm: improve khugepaged coverage Kiryl Shutsemau
2026-08-02 19:52 ` [PATCH 01/16] selftests/mm: move is_backed_by_folio() into vm_util Kiryl Shutsemau
2026-08-03 11:04   ` Mike Rapoport
2026-08-02 19:52 ` [PATCH 02/16] selftests/mm: add folio-order check for VA ranges Kiryl Shutsemau
2026-08-03 11:04   ` Mike Rapoport
2026-08-02 19:52 ` [PATCH 03/16] selftests/mm: add folio-order detection self-check Kiryl Shutsemau
2026-08-03 11:04   ` Mike Rapoport
2026-08-02 19:52 ` [PATCH 04/16] selftests/mm: add order-parameterized khugepaged collapse cases Kiryl Shutsemau
2026-08-03 11:04   ` Mike Rapoport
2026-08-02 19:52 ` [PATCH 05/16] selftests/mm: add khugepaged completion barrier helper Kiryl Shutsemau
2026-08-03 11:04   ` Mike Rapoport
2026-08-02 19:52 ` [PATCH 06/16] selftests/mm: add khugepaged race harness Kiryl Shutsemau
2026-08-03 11:04   ` Mike Rapoport
2026-08-02 19:52 ` [PATCH 07/16] selftests/mm: cover a shared-source collapse write race Kiryl Shutsemau
2026-08-02 19:52 ` [PATCH 08/16] selftests/mm: skip collapse_compound_extreme where the PMD is too large Kiryl Shutsemau
2026-08-02 19:52 ` [PATCH 09/16] selftests/mm: skip khugepaged swap tests when no swap is configured Kiryl Shutsemau
2026-08-03 11:04   ` Mike Rapoport
2026-08-02 19:52 ` [PATCH 10/16] selftests/mm: verify synchronous khugepaged driving is attributable Kiryl Shutsemau
2026-08-02 19:52 ` [PATCH 11/16] selftests/mm: race-harness variant for permissive hole occupancy Kiryl Shutsemau
2026-08-02 19:52 ` [PATCH 12/16] selftests/mm: add memory-pressure threads to the khugepaged race harness Kiryl Shutsemau
2026-08-02 19:52 ` [PATCH 13/16] selftests/mm: parameterize the mixed-source collapse case by source order Kiryl Shutsemau
2026-08-02 19:52 ` [PATCH 14/16] selftests/mm: zap whole PTE tables in the khugepaged race harness Kiryl Shutsemau
2026-08-02 19:52 ` [PATCH 15/16] selftests/mm: scale khugepaged's collapse wait with the PMD size Kiryl Shutsemau
2026-08-02 19:52 ` [PATCH 16/16] selftests/mm: skip khugepaged shmem cases without a PMD page cache folio Kiryl Shutsemau
2026-08-02 22:50   ` Zi Yan
2026-08-06 12:54     ` Kiryl Shutsemau [this message]
2026-08-03  1:21 ` [PATCH 00/16] selftests/mm: improve khugepaged coverage Baolin Wang
2026-08-05 15:15   ` Kiryl Shutsemau
2026-08-03 11:04 ` Mike Rapoport

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=anSClqrkH2y3pxpm@thinkstation \
    --to=kirill@shutemov.name \
    --cc=akpm@linux-foundation.org \
    --cc=baohua@kernel.org \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=david@kernel.org \
    --cc=dev.jain@arm.com \
    --cc=hughd@google.com \
    --cc=lance.yang@linux.dev \
    --cc=liam@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=mhocko@suse.com \
    --cc=nico.pache@linux.dev \
    --cc=rppt@kernel.org \
    --cc=ryan.roberts@arm.com \
    --cc=shuah@kernel.org \
    --cc=surenb@google.com \
    --cc=usama.arif@linux.dev \
    --cc=vbabka@kernel.org \
    --cc=ziy@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox