From: Andrew Morton <akpm@linux-foundation.org>
To: Miaohe Lin <linmiaohe@huawei.com>
Cc: <linux-mm@kvack.org>, <linux-kernel@vger.kernel.org>,
Hugh Dickins <hughd@google.com>
Subject: Re: [PATCH] mm/swap_state: Skip meaningless swap cache readahead when ra_info.win == 0
Date: Sun, 25 Oct 2020 16:59:48 -0700 [thread overview]
Message-ID: <20201025165948.bd4f59d127952b9979d5c61e@linux-foundation.org> (raw)
In-Reply-To: <20201009133059.58407-1-linmiaohe@huawei.com>
On Fri, 9 Oct 2020 09:30:59 -0400 Miaohe Lin <linmiaohe@huawei.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.
>
>
> --- a/mm/swap_state.c
> +++ b/mm/swap_state.c
> @@ -839,7 +839,7 @@ static struct page *swap_vma_readahead(swp_entry_t fentry, gfp_t gfp_mask,
> swp_entry_t entry;
> unsigned int i;
> bool page_allocated;
> - struct vma_swap_readahead ra_info = {0,};
> + struct vma_swap_readahead ra_info = {1,};
>
> swap_ra_info(vmf, &ra_info);
> if (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.
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)
_
next prev parent reply other threads:[~2020-10-25 23:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-09 13:30 Miaohe Lin
2020-10-25 23:59 ` Andrew Morton [this message]
2020-10-26 2:46 linmiaohe
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=20201025165948.bd4f59d127952b9979d5c61e@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=hughd@google.com \
--cc=linmiaohe@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.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