linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Kairui Song <ryncsn@gmail.com>
To: "Huang, Ying" <ying.huang@intel.com>
Cc: Matthew Wilcox <willy@infradead.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	 Andrew Morton <akpm@linux-foundation.org>,
	Miaohe Lin <linmiaohe@huawei.com>,
	 David Hildenbrand <david@redhat.com>,
	Hugh Dickins <hughd@google.com>
Subject: Re: [PATCH 5/5] swap: avoid ra statistic lost when swapin races
Date: Sun, 11 Dec 2022 20:15:02 +0800	[thread overview]
Message-ID: <CAMgjq7Dk9gT_+SBo_ibQcuVryCfg0+pq2_B000ccnzocvdr89A@mail.gmail.com> (raw)
In-Reply-To: <87edt6qhay.fsf@yhuang6-desk2.ccr.corp.intel.com>

Huang, Ying <ying.huang@intel.com> 于2022年12月11日周日 20:03写道:
>
> Kairui Song <ryncsn@gmail.com> writes:
>
> > Matthew Wilcox <willy@infradead.org> 于2022年12月9日周五 03:14写道:
> >>
> >
> > Hi, thanks for the review.
> >
> >> On Fri, Dec 09, 2022 at 02:02:09AM +0800, Kairui Song wrote:
> >> > From: Kairui Song <kasong@tencent.com>
> >> >
> >> > __read_swap_cache_async should just call swap_cache_get_folio for trying
> >> > to look up the swap cache. Because swap_cache_get_folio handles the
> >> > readahead statistic, and clears the RA flag, looking up the cache
> >> > directly will skip these parts.
> >> >
> >> > And the comment no longer applies after commit 442701e7058b
> >> > ("mm/swap: remove swap_cache_info statistics"), just remove them.
> >>
> >> But what about the readahead stats?
> >>
> >
> > Shouldn't readahead stats be accounted here? __read_swap_cache_async
> > is called by swap read in path, if it hits the swap cache, and the
> > page have readahead page flag set, then accounting that readahead
> > should be just the right thing todo. And the readahead flag is checked
> > with folio_test_clear_readahead, so there should be no issue about
> > repeated accounting.
> >
> > Only the addr info of the swap_readahead_info could be updated for
> > multiple times by racing readers, but I think that seems fine, since
> > we don't know which swap read comes later in case of race, just let
> > the last reader that hits the swap cache update the address info of
> > readahead makes sense to me.
> >
> > Or do you mean I should update the comment about the readahead stat
> > instead of just drop the commnet?
>
> __read_swap_cache_async() is called by readahead too
> (swap_vma_readahead/__read_swap_cache_async).  I don't think that it's a
> good idea to do swap readahead operation in this function.

Ah, I got it.
Thanks for pointing out the issue, I'll drop this patch.

>
> Best Regards,
> Huang, Ying


      reply	other threads:[~2022-12-11 12:15 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-08 18:02 [PATCH 0/5] Clean up and fixes for swap Kairui Song
2022-12-08 18:02 ` [PATCH 1/5] swapfile: get rid of volatile and avoid redundant read Kairui Song
2022-12-09  2:48   ` Huang, Ying
2022-12-08 18:02 ` [PATCH 2/5] swap: avoid a redundant pte map if ra window is 1 Kairui Song
2022-12-09  3:15   ` Huang, Ying
2022-12-08 18:02 ` [PATCH 3/5] swap: fold swap_ra_clamp_pfn into swap_ra_info Kairui Song
2022-12-08 19:08   ` Matthew Wilcox
2022-12-09  2:00     ` Kairui Song
2022-12-09  3:23   ` Huang, Ying
2022-12-08 18:02 ` [PATCH 4/5] swap: remove the swap lock in swap_cache_get_folio Kairui Song
2022-12-11 11:39   ` Huang, Ying
2022-12-11 11:47     ` Kairui Song
2022-12-08 18:02 ` [PATCH 5/5] swap: avoid ra statistic lost when swapin races Kairui Song
2022-12-08 19:14   ` Matthew Wilcox
2022-12-09  1:54     ` Kairui Song
2022-12-11 12:02       ` Huang, Ying
2022-12-11 12:15         ` Kairui Song [this message]

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=CAMgjq7Dk9gT_+SBo_ibQcuVryCfg0+pq2_B000ccnzocvdr89A@mail.gmail.com \
    --to=ryncsn@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=hughd@google.com \
    --cc=linmiaohe@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=willy@infradead.org \
    --cc=ying.huang@intel.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