linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Zi Yan <ziy@nvidia.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org,
	"Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>,
	Ryan Roberts <ryan.roberts@arm.com>,
	Hugh Dickins <hughd@google.com>,
	David Hildenbrand <david@redhat.com>,
	Yang Shi <yang@os.amperecomputing.com>,
	Miaohe Lin <linmiaohe@huawei.com>,
	Kefeng Wang <wangkefeng.wang@huawei.com>,
	Yu Zhao <yuzhao@google.com>, John Hubbard <jhubbard@nvidia.com>,
	Baolin Wang <baolin.wang@linux.alibaba.com>,
	linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v6 0/7] Buddy allocator like (or non-uniform) folio split
Date: Fri, 07 Feb 2025 09:35:27 -0500	[thread overview]
Message-ID: <E4287DB5-7D0D-41D7-BC0E-F5F404853931@nvidia.com> (raw)
In-Reply-To: <Z6YX3RznGLUD07Ao@casper.infradead.org>

On 7 Feb 2025, at 9:25, Matthew Wilcox wrote:

> On Fri, Feb 07, 2025 at 09:11:39AM -0500, Zi Yan wrote:
>> Existing uniform split requires 2^(order % XA_CHUNK_SHIFT) xa_node allocations
>> during split, when the folio needs to be split to order-0. But non-uniform split
>> only requires at most 1 xa_node allocation. For example, to split an order-9
>> folio, 8 xa_nodes are needed for uniform split, since the folio takes 8
>> multi-index slots in the xarray. But for non-uniform split, only the slot
>> containing the given struct page needs a xa_node after the split. There will be
>> a 7 xa_node saving.
>>
>> Hi Matthew,
>>
>> Do you mind checking my statement above on xarray memory saving? And correct me
>> if I miss anything. Thanks.
>
> We currently have a bug where we can't split order-12 (or above) to order-0 (or anything in the range 0-5) as we'd need to allocate two layers of nodes, and
> the preallocation can't do that.
>
> As part of your series, I'd like to remove that limitation, so we'd need
> to allocate log_64(n - m) [ok, more complex than that, but ykwim].  So
> it's not quite "only allocate one node", but it's allocate O(log(current
> number of nodes needed to be allocated)).
>
> Makes sense?

Yes.

To remove that order-12 limitation, do shmem_split_large_entry() and
__filemap_add_folio() need some change as well? Both call xas_split_alloc().
But I do not know if they will see splitting order-12 to order-(0 to 5).


Best Regards,
Yan, Zi


  reply	other threads:[~2025-02-07 14:35 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-05  3:14 Zi Yan
2025-02-05  3:14 ` [PATCH v6 1/7] mm/huge_memory: add two new (not yet used) functions for folio_split() Zi Yan
2025-02-05  3:14 ` [PATCH v6 2/7] mm/huge_memory: move folio split common code to __folio_split() Zi Yan
2025-02-05  3:14 ` [PATCH v6 3/7] mm/huge_memory: add buddy allocator like folio_split() Zi Yan
2025-02-05  3:14 ` [PATCH v6 4/7] mm/huge_memory: remove the old, unused __split_huge_page() Zi Yan
2025-02-05  3:14 ` [PATCH v6 5/7] mm/huge_memory: add folio_split() to debugfs testing interface Zi Yan
2025-02-05  3:14 ` [PATCH v6 6/7] mm/truncate: use buddy allocator like folio split for truncate operation Zi Yan
2025-02-05  3:14 ` [PATCH v6 7/7] selftests/mm: add tests for folio_split(), buddy allocator like split Zi Yan
2025-02-06  8:01 ` [PATCH v6 0/7] Buddy allocator like (or non-uniform) folio split Andrew Morton
2025-02-07 14:11   ` Zi Yan
2025-02-07 14:25     ` Matthew Wilcox
2025-02-07 14:35       ` Zi Yan [this message]
2025-02-07 15:00         ` Matthew Wilcox

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=E4287DB5-7D0D-41D7-BC0E-F5F404853931@nvidia.com \
    --to=ziy@nvidia.com \
    --cc=akpm@linux-foundation.org \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=david@redhat.com \
    --cc=hughd@google.com \
    --cc=jhubbard@nvidia.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linmiaohe@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ryan.roberts@arm.com \
    --cc=wangkefeng.wang@huawei.com \
    --cc=willy@infradead.org \
    --cc=yang@os.amperecomputing.com \
    --cc=yuzhao@google.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