linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Wei Yang <richard.weiyang@gmail.com>
To: "David Hildenbrand (Arm)" <david@kernel.org>
Cc: Zi Yan <ziy@nvidia.com>, Wei Yang <richard.weiyang@gmail.com>,
	Linux MM <linux-mm@kvack.org>
Subject: Re: A potential refcount issue during __folio_split
Date: Mon, 23 Feb 2026 11:59:48 +0000	[thread overview]
Message-ID: <20260223115948.sbylmtqhznmabcth@master> (raw)
In-Reply-To: <3e22afe6-ecf7-4180-9287-c48fea7b8be1@kernel.org>

On Mon, Feb 23, 2026 at 10:23:11AM +0100, David Hildenbrand (Arm) wrote:
>> 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);
>

Missed this. Agree.

>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);
>

I am afraid it would be complicated?

Well, we don't have this usecase now, could decide it when we do need it.

>-- 
>Cheers,
>
>David

-- 
Wei Yang
Help you, Help me


      reply	other threads:[~2026-02-23 11:59 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)
2026-02-23 11:59       ` Wei Yang [this message]

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=20260223115948.sbylmtqhznmabcth@master \
    --to=richard.weiyang@gmail.com \
    --cc=david@kernel.org \
    --cc=linux-mm@kvack.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