[<prev] [next>] [day] [month] [year] [list]
Message-ID: <2cf3c4afef654fbcb625cb77ea294fe6@huawei.com>
Date: Mon, 26 Oct 2020 02:46:09 +0000
From: linmiaohe <linmiaohe@...wei.com>
To: Andrew Morton <akpm@...ux-foundation.org>
CC: "linux-mm@...ck.org" <linux-mm@...ck.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Hugh Dickins <hughd@...gle.com>
Subject: Re: [PATCH] mm/swap_state: Skip meaningless swap cache readahead when
ra_info.win == 0
Andrew Morton <akpm@...ux-foundation.org> wrote:
> On Fri, 9 Oct 2020 09:30:59 -0400 Miaohe Lin <linmiaohe@...wei.com> wrote:
>
>> swap_ra_info() may leave ra_info untouched in non_swap_entry() case as
>> page table lock is not held. In this case, we have ra_info.nr_pte == 0
>> and it is meaningless to continue with swap cache readahead. Skip such
>> ops by init ra_info.win = 1.
>>
>
>Looks right. But I think it would be better to fix this in
>swap_ra_info() - make it more consistent in its return state.
>
I think modernify the struct initializer is better because it means we have to swap in one page at least.
Many thanks.
>Otherwise, let's modernify that struct initializer:
>
>--- a/mm/swap_state.c~mm-swap_state-skip-meaningless-swap-cache-readahead-when-ra_infowin-==-0-fix
>+++ a/mm/swap_state.c
>@@ -839,7 +839,9 @@ static struct page *swap_vma_readahead(s
> swp_entry_t entry;
> unsigned int i;
> bool page_allocated;
>- struct vma_swap_readahead ra_info = {1,};
>+ struct vma_swap_readahead ra_info = {
>+ .win = 1,
>+ };
>
> swap_ra_info(vmf, &ra_info);
> if (ra_info.win == 1)
>_
>
Powered by blists - more mailing lists