linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Zi Yan <ziy@nvidia.com>
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, 7 Feb 2025 14:25:33 +0000	[thread overview]
Message-ID: <Z6YX3RznGLUD07Ao@casper.infradead.org> (raw)
In-Reply-To: <019EB6CA-0F4B-496A-B2AE-A3A553585281@nvidia.com>

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?


  reply	other threads:[~2025-02-07 14:25 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 [this message]
2025-02-07 14:35       ` Zi Yan
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=Z6YX3RznGLUD07Ao@casper.infradead.org \
    --to=willy@infradead.org \
    --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=yang@os.amperecomputing.com \
    --cc=yuzhao@google.com \
    --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