From: zhong jiang <zhongjiang@huawei.com>
To: Michal Hocko <mhocko@kernel.org>
Cc: Johannes Weiner <hannes@cmpxchg.org>,
Minchan Kim <minchan@kernel.org>, <akpm@linux-foundation.org>,
<ktkhai@virtuozzo.com>, <linux-mm@kvack.org>
Subject: Re: [PATCH] mm: fix unevictable page reclaim when calling madvise_pageout
Date: Fri, 1 Nov 2019 20:56:31 +0800 [thread overview]
Message-ID: <5DBC2B7F.4090504@huawei.com> (raw)
In-Reply-To: <20191031091601.GE13102@dhcp22.suse.cz>
On 2019/10/31 17:16, Michal Hocko wrote:
> On Wed 30-10-19 15:33:07, Johannes Weiner wrote:
>> On Wed, Oct 30, 2019 at 06:45:33PM +0100, Michal Hocko wrote:
>>> On Wed 30-10-19 09:52:39, Minchan Kim wrote:
> [...]
>>>> madvise_pageout could work with a shared page and one of the vmas among processes
>>>> could do mlock so it could pass Unevictable LRU pages into shrink_page_list.
>>>> It's pointless to try reclaim unevictable pages from the beginning so I want to fix
>>>> madvise_pageout via introducing only_evictable flag into the API so that
>>>> madvise_pageout uses it as "true".
>>>>
>>>> If we want to remove the PageUnevictable VM_BUG_ON_PAGE in shrink_page_list,
>>>> I want to see more strong reason why it happens and why caller couldn't
>>>> filter them out from the beginning.
>>> Why is this preferable over removing the VM_BUG_ON condition? In other
>>> words why should we keep PageUnevictable check there?
>> The mlock LRU shuffling is a bit tricky and can race with page reclaim
>> or others isolating the page from the LRU list. If another isolator
>> wins, it has to move the page during putback on behalf of mlock.
>>
>> See the implementation and comments in __pagevec_lru_add_fn().
>>
>> That's why page reclaim can see !page_evictable(), but it must not see
>> pages that have the PageUnevictable lru bit already set. Because that
>> would mean the isolation/putback machinery messed up somewhere and the
>> page LRU state is corrupt.
>>
>> As that machinery is non-trivial, it's useful to have that sanity
>> check in page reclaim.
> Thanks for the clarification! This sounds reasonable (as much as the
> mlock juggling does) to me. This is probably worth a comment right above
> the bug_on.
Could you write a comment down on VM_BUG_ON() ? :-)
Thanks,
zhong jiang
> I have to confess that I am still not clear on all the details here,
> though. E.g. migrate_misplaced_transhuge_page sets the flag without
> lru_lock and relies only on page lock IIUC and the bug on is done right
> after the lock is released. Maybe I am just confused or maybe the race
> window is too small to matter but isn't this race possible at least
> theoretically?
>
next prev parent reply other threads:[~2019-11-01 12:56 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-28 15:08 [PATCH] mm: fix unevictable page reclaim when calling madvise_pageout zhong jiang
2019-10-28 15:27 ` David Hildenbrand
2019-10-28 15:45 ` zhong jiang
2019-10-28 16:07 ` David Hildenbrand
2019-10-28 16:15 ` zhong jiang
2019-10-28 16:15 ` David Hildenbrand
2019-10-29 2:29 ` zhong jiang
2019-10-29 8:11 ` Michal Hocko
2019-10-29 9:30 ` zhong jiang
2019-10-29 9:40 ` Michal Hocko
2019-10-29 10:45 ` zhong jiang
2019-10-30 16:52 ` Minchan Kim
2019-10-30 17:22 ` Johannes Weiner
2019-10-30 18:39 ` Minchan Kim
2019-11-01 8:57 ` zhong jiang
2019-10-30 17:45 ` Michal Hocko
2019-10-30 18:42 ` Minchan Kim
2019-10-30 19:33 ` Johannes Weiner
2019-10-31 9:16 ` Michal Hocko
2019-10-31 14:48 ` Minchan Kim
2019-10-31 17:17 ` Michal Hocko
2019-11-01 12:56 ` zhong jiang [this message]
2019-10-31 9:46 ` zhong jiang
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=5DBC2B7F.4090504@huawei.com \
--to=zhongjiang@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=ktkhai@virtuozzo.com \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=minchan@kernel.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;
as well as URLs for NNTP newsgroup(s).