From: Jan Kara <jack@suse.cz>
To: Linux Upstream <linux.upstream@oneplus.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
Chintan Pandya <chintan.pandya@oneplus.com>,
"hughd@google.com" <hughd@google.com>,
"jack@suse.cz" <jack@suse.cz>,
"mawilcox@microsoft.com" <mawilcox@microsoft.com>,
"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-mm@kvack.org" <linux-mm@kvack.org>
Subject: Re: [RFC 1/2] page-flags: Make page lock operation atomic
Date: Mon, 11 Feb 2019 18:48:46 +0100 [thread overview]
Message-ID: <20190211174846.GM19029@quack2.suse.cz> (raw)
In-Reply-To: <364c7595-14f5-7160-d076-35a14c90375a@oneplus.com>
On Mon 11-02-19 13:59:24, Linux Upstream wrote:
> >
> >> Signed-off-by: Chintan Pandya <chintan.pandya@oneplus.com>
> >
> > NAK.
> >
> > This is bound to regress some stuff. Now agreed that using non-atomic
> > ops is tricky, but many are in places where we 'know' there can't be
> > concurrency.
> >
> > If you can show any single one is wrong, we can fix that one, but we're
> > not going to blanket remove all this just because.
>
> Not quite familiar with below stack but from crash dump, found that this
> was another stack running on some other CPU at the same time which also
> updates page cache lru and manipulate locks.
>
> [84415.344577] [20190123_21:27:50.786264]@1 preempt_count_add+0xdc/0x184
> [84415.344588] [20190123_21:27:50.786276]@1 workingset_refault+0xdc/0x268
> [84415.344600] [20190123_21:27:50.786288]@1 add_to_page_cache_lru+0x84/0x11c
> [84415.344612] [20190123_21:27:50.786301]@1 ext4_mpage_readpages+0x178/0x714
> [84415.344625] [20190123_21:27:50.786313]@1 ext4_readpages+0x50/0x60
> [84415.344636] [20190123_21:27:50.786324]@1
> __do_page_cache_readahead+0x16c/0x280
> [84415.344646] [20190123_21:27:50.786334]@1 filemap_fault+0x41c/0x588
> [84415.344655] [20190123_21:27:50.786343]@1 ext4_filemap_fault+0x34/0x50
> [84415.344664] [20190123_21:27:50.786353]@1 __do_fault+0x28/0x88
>
> Not entirely sure if it's racing with the crashing stack or it's simply
> overrides the the bit set by case 2 (mentioned in 0/2).
So this is interesting. Looking at __add_to_page_cache_locked() nothing
seems to prevent __SetPageLocked(page) in add_to_page_cache_lru() to get
reordered into __add_to_page_cache_locked() after page is actually added to
the xarray. So that one particular instance might benefit from atomic
SetPageLocked or a barrier somewhere between __SetPageLocked() and the
actual addition of entry into the xarray.
Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
next prev parent reply other threads:[~2019-02-11 17:48 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-11 12:53 [RFC 0/2] Potential race condition with page lock Chintan Pandya
2019-02-11 12:53 ` [RFC 1/2] page-flags: Make page lock operation atomic Chintan Pandya
2019-02-11 13:46 ` Peter Zijlstra
2019-02-11 13:59 ` Linux Upstream
2019-02-11 17:48 ` Jan Kara [this message]
2019-02-11 17:56 ` Matthew Wilcox
2019-02-12 7:45 ` Jan Kara
2019-02-12 12:29 ` Peter Zijlstra
2019-02-11 12:53 ` [RFC 2/2] page-flags: Catch the double setter of page flags Chintan Pandya
2019-02-11 13:47 ` Peter Zijlstra
2019-02-11 14:01 ` Linux Upstream
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=20190211174846.GM19029@quack2.suse.cz \
--to=jack@suse.cz \
--cc=akpm@linux-foundation.org \
--cc=chintan.pandya@oneplus.com \
--cc=hughd@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux.upstream@oneplus.com \
--cc=mawilcox@microsoft.com \
--cc=peterz@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