linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Hyeonggon Yoo <42.hyeyoo@gmail.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: Hugh Dickins <hughd@google.com>, Vlastimil Babka <vbabka@suse.cz>,
	David Laight <David.Laight@aculab.com>,
	Joel Fernandes <joel@joelfernandes.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Minchan Kim <minchan@kernel.org>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	rcu@vger.kernel.org
Subject: Re: amusing SLUB compaction bug when CC_OPTIMIZE_FOR_SIZE
Date: Wed, 5 Oct 2022 20:07:23 +0900	[thread overview]
Message-ID: <Yz1lawQXGHZBvuqe@hyeyoo> (raw)
In-Reply-To: <YzxF5Bs/tgLDOB0T@casper.infradead.org>

On Tue, Oct 04, 2022 at 03:40:36PM +0100, Matthew Wilcox wrote:
> On Tue, Oct 04, 2022 at 11:26:33PM +0900, Hyeonggon Yoo wrote:
> > > It's the acquisition of
> > > the refcount which stabilises the slab flag, not holding the lock.
> > 
> > But can you please elaborate how this prevents race between
> > allocation & initialization of a slab and isolate_movable_page()?
> > 
> > Or maybe we can handle it with frozen folio as Vlastimil suggested? ;-) 
> 
> Yes, we discussed that a little yesterday.  I'm hoping to have a
> refreshed patchset for frozen folios out today.  Some of this patch
> is still needed, even if we go that route.

Good to hear that.
With that, everyting looks sane to me.
 
> > > @@ -91,8 +99,8 @@ int isolate_movable_page(struct page *page, isolate_mode_t mode)
> > >  	 * lets be sure we have the page lock
> > >  	 * before proceeding with the movable page isolation steps.
> > >  	 */
> > > -	if (unlikely(!trylock_page(page)))
> > > -		goto out_putpage;
> > > +	if (unlikely(!folio_trylock(folio)))
> > > +		goto out_put;
> > 
> > I don't know much about callers that this is trying to avoid race aginst...
> > 
> > But for this to make sense, I think *every users* that doing their stuff with
> > sub-page of a compound page should acquire folio lock and not page lock
> > of sub-page, right?
> 
> There is no page lock per se.  If you try to acquire the lock on a tail
> page, it acquires the lock on its head page.  It's been that way for a
> very long time.  A lot of people are confused by this, which was part of
> the motivation for making it explicit with folios.

You are right! Reading the code, too bad
I even assumed that there was sub-page lock.

-- 
Thanks,
Hyeonggon


  reply	other threads:[~2022-10-05 11:07 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-28  5:16 Hugh Dickins
2022-09-28  5:49 ` Hyeonggon Yoo
2022-09-28 13:48   ` Joel Fernandes
2022-09-28 15:09     ` Hyeonggon Yoo
2022-09-28 16:20     ` Vlastimil Babka
2022-09-28 17:50       ` Hugh Dickins
2022-09-29  9:58         ` Vlastimil Babka
2022-09-29 21:54           ` Hugh Dickins
2022-09-30  7:39             ` Vlastimil Babka
2022-09-30 10:45               ` Hugh Dickins
2022-09-30 11:02                 ` David Laight
2022-09-30 16:21                   ` Hugh Dickins
2022-09-30 21:34                     ` David Laight
2022-10-02  5:48             ` Hyeonggon Yoo
2022-10-03 17:00               ` Matthew Wilcox
2022-10-04 14:26                 ` Hyeonggon Yoo
2022-10-04 14:40                   ` Matthew Wilcox
2022-10-05 11:07                     ` Hyeonggon Yoo [this message]
2022-10-24 14:35                 ` Vlastimil Babka
2022-10-24 15:06                   ` Matthew Wilcox
2022-10-24 15:24                     ` Vlastimil Babka
2022-10-24 16:49                   ` Vlastimil Babka
2022-10-25  4:19                   ` Hugh Dickins
2022-10-25  9:17                     ` Vlastimil Babka
2022-10-25 15:45                       ` Hugh Dickins
2022-10-25 13:47                   ` Hyeonggon Yoo
2022-10-25 14:08                     ` Vlastimil Babka
2022-10-26 10:52                       ` Vlastimil Babka
2022-10-26 12:29                         ` Hyeonggon Yoo
2022-11-04 15:57                   ` Vlastimil Babka
2022-09-29 11:53         ` David Laight
2022-09-29 13:01           ` Vlastimil Babka
2022-09-29 14:04             ` David Laight
2022-09-28 17:56       ` Hyeonggon Yoo
2022-09-28 19:53         ` Joel Fernandes

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=Yz1lawQXGHZBvuqe@hyeyoo \
    --to=42.hyeyoo@gmail.com \
    --cc=David.Laight@aculab.com \
    --cc=akpm@linux-foundation.org \
    --cc=hughd@google.com \
    --cc=joel@joelfernandes.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=minchan@kernel.org \
    --cc=rcu@vger.kernel.org \
    --cc=vbabka@suse.cz \
    --cc=willy@infradead.org \
    /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