From: "Michael S. Tsirkin" <mst@redhat.com>
To: "David Hildenbrand (Arm)" <david@kernel.org>
Cc: linux-kernel@vger.kernel.org, Miaohe Lin <linmiaohe@huawei.com>,
Naoya Horiguchi <nao.horiguchi@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>,
Oscar Salvador <osalvador@suse.de>,
Andi Kleen <andi@firstfloor.org>,
Hidehiro Kawai <hidehiro.kawai.ez@hitachi.com>,
Rik van Riel <riel@redhat.com>,
Vlastimil Babka <vbabka@kernel.org>,
Lorenzo Stoakes <ljs@kernel.org>,
"Liam R. Howlett" <liam@infradead.org>,
Mike Rapoport <rppt@kernel.org>,
Suren Baghdasaryan <surenb@google.com>,
Michal Hocko <mhocko@suse.com>,
Brendan Jackman <jackmanb@google.com>,
Johannes Weiner <hannes@cmpxchg.org>, Zi Yan <ziy@nvidia.com>,
Baolin Wang <baolin.wang@linux.alibaba.com>,
Nico Pache <npache@redhat.com>,
Ryan Roberts <ryan.roberts@arm.com>, Dev Jain <dev.jain@arm.com>,
Barry Song <baohua@kernel.org>, Lance Yang <lance.yang@linux.dev>,
Christoph Lameter <cl@gentwo.org>,
David Rientjes <rientjes@google.com>,
Roman Gushchin <roman.gushchin@linux.dev>,
Harry Yoo <harry@kernel.org>, Hao Li <hao.li@linux.dev>,
Kiryl Shutsemau <kas@kernel.org>,
Byungchul Park <byungchul@sk.com>,
linux-mm@kvack.org, linux-cxl@vger.kernel.org
Subject: Re: [PATCH 0/2] mm: memory-failure: fix HWPoison flag race with non-atomic page flag ops
Date: Mon, 29 Jun 2026 17:50:35 -0400 [thread overview]
Message-ID: <20260629174225-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <54c8cbee-9b26-458c-93ba-5aa594f5d1e8@kernel.org>
On Mon, Jun 29, 2026 at 11:22:11PM +0200, David Hildenbrand (Arm) wrote:
> [...]
>
> >
> > And again, I'm really not sure fixing a theoretical race when memory
> > is failing is worth slowing the world by 0.1-1% for.
> >
>
> Fully agreed. I was hoping RCU was cheaper (I mean, we were once told that RCU
> read side locking is essentially for free ... well in some configs :) )
>
> The question if we could optimize it reasonably enough ...
>
> >
> > From what I saw in my testing, if we allocate 4k pages
> > it's hidden by the overhead. With hp and thp it's measureably
> > worse than rcu on !preempt config.
>
> ... for example, by doing the rcu read lock + unlock around the
>
> for (i = 1; i < (1 << order); i++) {
>
> loop on the alloc path.
Is this different from what this patch is doing?
if (unlikely(order)) {
int i;
hwpoison_rcu_lock();
if (compound) {
page[1].flags.f &= ~PAGE_FLAGS_SECOND;
#ifdef NR_PAGES_IN_LARGE_FOLIO
folio->_nr_pages = 0;
#endif
}
for (i = 1; i < (1 << order); i++) {
if (compound)
bad += free_tail_page_prepare(page, page + i);
if (is_check_pages_enabled()) {
if (free_page_is_bad(page + i)) {
bad++;
continue;
}
}
(page + i)->flags.f &= ~PAGE_FLAGS_CHECK_AT_PREP;
}
hwpoison_rcu_unlock();
}
> But I suspect it's not going to make that much of a
> difference.
It makes a difference! Just not enough to make it completely unmeasureable.
> I concluded, similar to Andi, that stop_machine() is too big of a hammer.
>
> I wonder if something could be built out of preempt_disable() and sync SMP
> calls. hmm :(
rcu_lock is basically same as preempt_disable if rcu is non preemptible,
no?
> --
> Cheers,
>
> David
next prev parent reply other threads:[~2026-06-29 21:50 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-28 21:45 [PATCH 0/2] mm: memory-failure: fix HWPoison flag race with non-atomic page flag ops Michael S. Tsirkin
2026-06-28 21:45 ` [PATCH 1/2] mm: memory-failure: use RCU to fix HWPoison flag race Michael S. Tsirkin
2026-06-28 21:45 ` [PATCH 2/2] mm: wrap non-atomic page flag ops in RCU for HWPoison safety Michael S. Tsirkin
2026-06-29 2:11 ` [PATCH 0/2] mm: memory-failure: fix HWPoison flag race with non-atomic page flag ops Andi Kleen
2026-06-29 8:10 ` Michael S. Tsirkin
2026-06-29 8:21 ` David Hildenbrand (Arm)
2026-06-29 8:39 ` Michael S. Tsirkin
2026-06-29 16:54 ` Andi Kleen
2026-06-29 17:04 ` David Hildenbrand (Arm)
2026-06-29 20:43 ` Michael S. Tsirkin
2026-06-29 6:49 ` David Hildenbrand (Arm)
2026-06-29 7:34 ` Michael S. Tsirkin
2026-06-29 13:05 ` David Hildenbrand (Arm)
2026-06-29 20:08 ` Michael S. Tsirkin
2026-06-29 20:55 ` Andi Kleen
2026-06-29 21:17 ` Michael S. Tsirkin
2026-06-29 21:39 ` Andi Kleen
2026-06-29 21:59 ` Michael S. Tsirkin
2026-06-29 21:22 ` David Hildenbrand (Arm)
2026-06-29 21:43 ` David Hildenbrand (Arm)
2026-06-29 23:34 ` Michael S. Tsirkin
2026-06-29 21:50 ` Michael S. Tsirkin [this message]
2026-06-29 21:54 ` Michael S. Tsirkin
2026-06-29 23:29 ` Michael S. Tsirkin
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=20260629174225-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=andi@firstfloor.org \
--cc=baohua@kernel.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=byungchul@sk.com \
--cc=cl@gentwo.org \
--cc=david@kernel.org \
--cc=dev.jain@arm.com \
--cc=hannes@cmpxchg.org \
--cc=hao.li@linux.dev \
--cc=harry@kernel.org \
--cc=hidehiro.kawai.ez@hitachi.com \
--cc=jackmanb@google.com \
--cc=kas@kernel.org \
--cc=lance.yang@linux.dev \
--cc=liam@infradead.org \
--cc=linmiaohe@huawei.com \
--cc=linux-cxl@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=mhocko@suse.com \
--cc=nao.horiguchi@gmail.com \
--cc=npache@redhat.com \
--cc=osalvador@suse.de \
--cc=riel@redhat.com \
--cc=rientjes@google.com \
--cc=roman.gushchin@linux.dev \
--cc=rppt@kernel.org \
--cc=ryan.roberts@arm.com \
--cc=surenb@google.com \
--cc=vbabka@kernel.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