From: "David Hildenbrand (Arm)" <david@kernel.org>
To: Zi Yan <ziy@nvidia.com>, Wei Yang <richard.weiyang@gmail.com>
Cc: Linux MM <linux-mm@kvack.org>
Subject: Re: A potential refcount issue during __folio_split
Date: Mon, 23 Feb 2026 10:23:11 +0100 [thread overview]
Message-ID: <3e22afe6-ecf7-4180-9287-c48fea7b8be1@kernel.org> (raw)
In-Reply-To: <6346656B-7518-4A55-8DEF-C2E975714C8B@nvidia.com>
> BTW, in the folio world, I do not think it is possible to perform the aforementioned
> split_huge_page_to_list_to_order() pattern any more, since you always work on folio,
> the head. Unless there is a need of getting hold of a tail after-split folio after
> a folio split, the pattern would be:
>
> tail_page = folio_page(folio, N);
>
> folio_get(folio);
> folio_lock(folio);
> folio_split(folio, ..., /* new parameter: lock_at = */ tail_page, ...);
> tail_folio = page_folio(tail_page);
> folio_unlock(tail_folio);
> folio_put(tail_folio);
Agreed. Maybe it would be even nicer if the split function could return
the new folio directly.
folio_get(folio);
folio_lock(folio);
split_folio = folio_split_XXX(folio, ..., tail_page, ...);
if (IS_ERR_VALUE(split_folio)) {
...
}
folio_unlock(split_folio);
folio_put(split__folio);
--
Cheers,
David
next prev parent reply other threads:[~2026-02-23 9:23 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20260222010425.gbsjzhrew3pg4qrw@master>
[not found] ` <20260222010708.uohpmddmzaa4i4ic@master>
2026-02-22 3:00 ` Zi Yan
2026-02-22 10:28 ` Wei Yang
2026-02-23 9:23 ` David Hildenbrand (Arm) [this message]
2026-02-23 11:59 ` Wei Yang
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=3e22afe6-ecf7-4180-9287-c48fea7b8be1@kernel.org \
--to=david@kernel.org \
--cc=linux-mm@kvack.org \
--cc=richard.weiyang@gmail.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