All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Zi Yan" <ziy@nvidia.com>
To: "David Hildenbrand (Arm)" <david@kernel.org>,
	"Barry Song" <baohua@kernel.org>, "Ye Liu" <ye.liu@linux.dev>
Cc: "Andrew Morton" <akpm@linux-foundation.org>,
	"Baolin Wang" <baolin.wang@linux.alibaba.com>,
	"Liam R. Howlett" <liam@infradead.org>,
	"Nico Pache" <nico.pache@linux.dev>,
	"Ryan Roberts" <ryan.roberts@arm.com>,
	"Dev Jain" <dev.jain@arm.com>,
	"Lance Yang" <lance.yang@linux.dev>,
	"Usama Arif" <usama.arif@linux.dev>,
	"Kiryl Shutsemau" <kas@kernel.org>, <linux-mm@kvack.org>,
	<linux-kernel@vger.kernel.org>, "Ye Liu" <liuye@kylinos.cn>
Subject: Re: [PATCH] mm/huge_memory: use READ_ONCE() when cloning folio flags during split
Date: Thu, 29 Oct 2026 15:19:09 -0400	[thread overview]
Message-ID: <DMHKCEKNMA64.3B6O5X5918GWI@nvidia.com> (raw)
In-Reply-To: <d44e0aef-ac50-4048-952b-50a0307a41cb@kernel.org>

On Thu Oct 29, 2026 at 10:54 AM EDT, David Hildenbrand (Arm) wrote:
> On 10/29/26 15:31, Zi Yan wrote:
>> On Thu Oct 29, 2026 at 6:47 AM EDT, David Hildenbrand (Arm) wrote:
>>> On 10/29/26 10:08, Barry Song wrote:
>>>>
>>>> I assume the race is harmless, but silencing KCSAN is still worthwhile.
>> 
>> data_race() would work too.
>> 
>>>
>>> Isn't there a way we could lose the PG_waiters flag?
>> 
>> The PG_waiters on the original folio/the original head page is not lost,
>
> Ah, so it's not on arbitrary tail pages, just the old head.
>
>> but there is a chance PG_waiters is lost in the new head, because
>> prep_compound_page() uses __SetPageHead() and can ignore the atomic set
>> of PG_waiters.
>
> Fun.
> ...>
>> Solutions can be:
>> 
>> 1. Use atomic SetPageHead() in prep_compound_page().
>
> That sounds like the right thing to do?

Yes, simpler, but the atomic op can be costly at compound page init
time. My plan is to add prep_compound_page_atomic() for
__split_folio_to_order() and the atomic version SetPageHead().

Fixes: c010d47f107f6 ("mm: thp: split huge page to any lower order pages").

Will send a patch soon.

-- 
Best Regards,
Yan, Zi



  reply	other threads:[~2026-10-29 19:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-29  7:41 [PATCH] mm/huge_memory: use READ_ONCE() when cloning folio flags during split Ye Liu
2026-10-29  9:08 ` Barry Song
2026-10-29 10:47   ` David Hildenbrand (Arm)
2026-10-29 14:31     ` Zi Yan
2026-10-29 14:54       ` David Hildenbrand (Arm)
2026-10-29 19:19         ` Zi Yan [this message]
2026-10-29 19:24           ` David Hildenbrand (Arm)

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=DMHKCEKNMA64.3B6O5X5918GWI@nvidia.com \
    --to=ziy@nvidia.com \
    --cc=akpm@linux-foundation.org \
    --cc=baohua@kernel.org \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=david@kernel.org \
    --cc=dev.jain@arm.com \
    --cc=kas@kernel.org \
    --cc=lance.yang@linux.dev \
    --cc=liam@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=liuye@kylinos.cn \
    --cc=nico.pache@linux.dev \
    --cc=ryan.roberts@arm.com \
    --cc=usama.arif@linux.dev \
    --cc=ye.liu@linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.