From: Michal Hocko <mhocko@suse.com>
To: Alexander Sverdlin <alexander.sverdlin@nokia.com>
Cc: Nicholas Piggin <npiggin@gmail.com>,
Alexander Duyck <alexanderduyck@fb.com>,
Matthew Wilcox <willy@infradead.org>,
Hugh Dickins <hughd@google.com>, Yu Zhao <yuzhao@google.com>,
Mel Gorman <mgorman@techsingularity.net>,
Lee Schermerhorn <lee.schermerhorn@hp.com>,
Sasha Levin <sashal@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: mm: swap: locking in release_pages()
Date: Tue, 5 Apr 2022 12:43:41 +0200 [thread overview]
Message-ID: <YkwdRnuQBjoJ01YK@dhcp22.suse.cz> (raw)
In-Reply-To: <89009285-c75d-0f09-5b08-d133c42a18f9@nokia.com>
On Tue 05-04-22 12:20:15, Alexander Sverdlin wrote:
> Dear mm developers!
>
> After experiencing a crash in release_pages() [1] I'm trying to understand the locking in the release_pages():
>
> No matter if we consider v5.17 or v5.4 (as in my case), they both have similar locking patterns:
Similar but the notable difference is that 5.4 used per node lru locking
while newer versions 5.11+ kernels use per memcg locking. If you see the
issue on 5.4 then this is unlikely a regression.
[...]
> What I don't understand here is, what guarantees us that "if (PageLRU(page))" condition
> is still valid after we swap the locks in "if (pgdat != locked_pgdat)" case?
The underlying reasoning is that the PageLRU handling is done after the
last reference has been dropped. isolate_lru_page and others should
elevate the reference count before isolating page from LRU lists.
Some callers user TestClearPageLRU
> If we check under one lock and VM_BUG_ON_PAGE() under another lock, what actually stops
> it from crashing as below or BUG() from time to time?
G
>
> 1. Crash of v5.4.170 on an ARM32 machine:
>
> Unable to handle kernel NULL pointer dereference at virtual address 00000104
> pgd = e138149d
> [00000104] *pgd=84d2fd003, *pmd=8ffd6f003
> Internal error: Oops: a07 [#1] PREEMPT SMP ARM
> ...
> CPU: 1 PID: 6172 Comm: AaSysInfoRColle Tainted: G B O 5.4.170-... #1
> Hardware name: Keystone
> PC is at release_pages+0x194/0x358
> LR is at release_pages+0x10c/0x358
Which LOC does this correspond to? (faddr2line should give you a nice
output).
--
Michal Hocko
SUSE Labs
next prev parent reply other threads:[~2022-04-05 10:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-05 10:20 Alexander Sverdlin
2022-04-05 10:43 ` Michal Hocko [this message]
2022-04-05 11:36 ` Alexander Sverdlin
2022-04-05 11:45 ` Michal Hocko
2022-04-05 14:00 ` Alexander Sverdlin
2022-04-05 14:17 ` Michal Hocko
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=YkwdRnuQBjoJ01YK@dhcp22.suse.cz \
--to=mhocko@suse.com \
--cc=akpm@linux-foundation.org \
--cc=alexander.sverdlin@nokia.com \
--cc=alexanderduyck@fb.com \
--cc=hughd@google.com \
--cc=lee.schermerhorn@hp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@techsingularity.net \
--cc=npiggin@gmail.com \
--cc=sashal@kernel.org \
--cc=willy@infradead.org \
--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