linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Zi Yan <ziy@nvidia.com>
Cc: linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>,
	"Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>,
	"Matthew Wilcox (Oracle)" <willy@infradead.org>,
	Ryan Roberts <ryan.roberts@arm.com>,
	Hugh Dickins <hughd@google.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 v7 1/8] xarray: add xas_try_split() to split a multi-index entry.
Date: Tue, 18 Feb 2025 17:12:27 +0100	[thread overview]
Message-ID: <a99f132c-4e92-4755-9ba6-d28d9d168971@redhat.com> (raw)
In-Reply-To: <DA7491B4-7794-4F86-AFBC-BB8BFBD1D9B3@nvidia.com>

>>
>> Now, can it happen that xas_try_split() would ever perform a partial split in any way, when invoked from __split_unmapped_folio(), such that we run into the do { } while(); loop and fail with -ENOMEM after already having performed changes -- xas_update().
>>
>> Or is that simply impossible?
> 
> Right. It is impossible. xas_try_split() either splits by copying @entry
> to all the replacement entries, or is trying to allocate a new xa_node,
> which can result in -ENOMEM. These two will not be mixed.
> 
>>
>> Maybe it's just the do { } while(); loop in there that is confusing me. (again, no expert)
> 
> Yeah, that the do while loop is confusing. Let me restructure the code
> so that the do while loop only runs in the @entry copy case not the
> xa_node allocation case.

Great!

> 
>>
>>> xas_try_split() imposes what kind of split it does and is usually used to
>>> split from order N to order N-1:
>>
>> You mean that old_order -> split_order will in the case of __split_unmapped_folio() always be a difference of 1?
> 
> Yes for !uniform_split case. For uniform_split case (split_huge_page*() uses),
> xas_split() is used and all required new xa_node are preallocated by
> xas_split_alloc() in __folio_split().

Got it, thanks!

-- 
Cheers,

David / dhildenb



  reply	other threads:[~2025-02-18 16:12 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-11 15:50 [PATCH v7 0/8] Buddy allocator like (or non-uniform) folio split Zi Yan
2025-02-11 15:50 ` [PATCH v7 1/8] xarray: add xas_try_split() to split a multi-index entry Zi Yan
2025-02-12  0:57   ` Zi Yan
2025-02-12  1:51     ` Zi Yan
2025-02-17 21:44   ` David Hildenbrand
2025-02-17 22:05     ` Zi Yan
2025-02-18 15:44       ` David Hildenbrand
2025-02-18 16:04         ` Zi Yan
2025-02-18 16:12           ` David Hildenbrand [this message]
2025-02-11 15:50 ` [PATCH v7 2/8] mm/huge_memory: add two new (not yet used) functions for folio_split() Zi Yan
2025-02-14 21:59   ` David Hildenbrand
2025-02-14 22:03     ` Zi Yan
2025-02-14 22:06       ` David Hildenbrand
2025-02-14 22:18         ` Zi Yan
2025-02-15  1:52   ` Zi Yan
2025-02-11 15:50 ` [PATCH v7 3/8] mm/huge_memory: move folio split common code to __folio_split() Zi Yan
2025-02-11 15:50 ` [PATCH v7 4/8] mm/huge_memory: add buddy allocator like (non-uniform) folio_split() Zi Yan
2025-02-16 10:32   ` David Hildenbrand
2025-02-16 14:17     ` Zi Yan
2025-02-17 15:22       ` Zi Yan
2025-02-18  4:12         ` Andrew Morton
2025-02-18 15:23           ` Zi Yan
2025-02-11 15:50 ` [PATCH v7 5/8] mm/huge_memory: remove the old, unused __split_huge_page() Zi Yan
2025-02-11 15:50 ` [PATCH v7 6/8] mm/huge_memory: add folio_split() to debugfs testing interface Zi Yan
2025-02-11 15:50 ` [PATCH v7 7/8] mm/truncate: use buddy allocator like folio split for truncate operation Zi Yan
2025-02-11 15:50 ` [PATCH v7 8/8] selftests/mm: add tests for folio_split(), buddy allocator like split Zi Yan

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=a99f132c-4e92-4755-9ba6-d28d9d168971@redhat.com \
    --to=david@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=baolin.wang@linux.alibaba.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 \
    --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