[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ada1b9f4-82de-f25c-f8ed-45e589644bd5@google.com>
Date: Tue, 25 Jun 2024 13:12:17 -0700 (PDT)
From: Hugh Dickins <hughd@...gle.com>
To: David Hildenbrand <david@...hat.com>
cc: Hugh Dickins <hughd@...gle.com>, Andrew Morton <akpm@...ux-foundation.org>,
Barry Song <21cnbao@...il.com>, baolin.wang@...ux.alibaba.com,
chrisl@...nel.org, linux-kernel@...r.kernel.org, linux-mm@...ck.org,
mhocko@...e.com, ryan.roberts@....com, shy828301@...il.com,
surenb@...gle.com, v-songbaohua@...o.com, willy@...radead.org,
ying.huang@...el.com, yosryahmed@...gle.com, yuanshuai@...o.com,
yuzhao@...gle.com
Subject: Re: [PATCH mm-unstable] mm: folio_add_new_anon_rmap() careful
__folio_set_swapbacked()
On Tue, 25 Jun 2024, David Hildenbrand wrote:
> On 25.06.24 21:37, Hugh Dickins wrote:
> > On Tue, 25 Jun 2024, David Hildenbrand wrote:
> >>
> >> I'll point out that it's sufficient for a PFN walker to do a tryget +
> >> trylock
> >> to cause trouble.
> >
> > That surprises me. I thought a racer's tryget was irrelevant (touching
> > a different field) and its trylock not a problem, since "we" hold the
> > folio lock throughout. If my mental model is too naive there, please
> > explain in more detail: we all need to understand this better.
>
> Sorry, I was imprecise.
>
> tryget+trylock should indeed not be a problem, tryget+lock would be, because
> IIRC folio_wait_bit_common()->folio_set_waiters() would be messing with folio
> flags.
Interesting observation, thanks. I had imagined that a folio locker was
safe, but think you're right that (before the fix) this could have erased
its PG_waiters. Typically, I guess something else would come along sooner
or later to lock the folio, and that succeed in waking up the earlier one:
so probably not an issue that would be detected in testing, but not good.
Hugh
Powered by blists - more mailing lists