linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Hugh Dickins <hughd@google.com>
To: David Hildenbrand <david@redhat.com>
Cc: Hugh Dickins <hughd@google.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	 Barry Song <21cnbao@gmail.com>,
	baolin.wang@linux.alibaba.com,  chrisl@kernel.org,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	 mhocko@suse.com, ryan.roberts@arm.com, shy828301@gmail.com,
	 surenb@google.com, v-songbaohua@oppo.com, willy@infradead.org,
	 ying.huang@intel.com, yosryahmed@google.com, yuanshuai@oppo.com,
	 yuzhao@google.com
Subject: Re: [PATCH mm-unstable] mm: folio_add_new_anon_rmap() careful __folio_set_swapbacked()
Date: Tue, 25 Jun 2024 13:12:17 -0700 (PDT)	[thread overview]
Message-ID: <ada1b9f4-82de-f25c-f8ed-45e589644bd5@google.com> (raw)
In-Reply-To: <9e8d71f4-69dc-4bf4-a40d-e1b89586f5c9@redhat.com>

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


      reply	other threads:[~2024-06-25 20:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-25  5:00 Hugh Dickins
2024-06-25  5:55 ` Barry Song
2024-06-25  7:04   ` Baolin Wang
2024-06-25  7:40 ` David Hildenbrand
2024-06-25 19:37   ` Hugh Dickins
2024-06-25 19:45     ` David Hildenbrand
2024-06-25 20:12       ` Hugh Dickins [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=ada1b9f4-82de-f25c-f8ed-45e589644bd5@google.com \
    --to=hughd@google.com \
    --cc=21cnbao@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=chrisl@kernel.org \
    --cc=david@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=ryan.roberts@arm.com \
    --cc=shy828301@gmail.com \
    --cc=surenb@google.com \
    --cc=v-songbaohua@oppo.com \
    --cc=willy@infradead.org \
    --cc=ying.huang@intel.com \
    --cc=yosryahmed@google.com \
    --cc=yuanshuai@oppo.com \
    --cc=yuzhao@google.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