All of lore.kernel.org
 help / color / mirror / Atom feed
From: Youngjun Park <youngjun.park@lge.com>
To: Kairui Song <ryncsn@gmail.com>
Cc: Youngjun Park <her0gyugyu@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Chris Li <chrisl@kernel.org>,
	Kemeng Shi <shikemeng@huaweicloud.com>,
	Nhat Pham <nphamcs@gmail.com>, Baoquan He <baoquan.he@linux.dev>,
	Barry Song <baohua@kernel.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] mm/swap: scan by cluster in find_next_to_unuse()
Date: Wed, 5 Aug 2026 23:23:21 +0900	[thread overview]
Message-ID: <anNHWTMmpfHV0waH@yjaykim-PowerEdge-T330> (raw)
In-Reply-To: <CAMgjq7B8-HuC4JS1oSL355QNMLOV3c1iaoaA8GJB6CPf0J_7Xg@mail.gmail.com>

...

Hello Kairui
Thanks for the review.

> > -       for (i = prev + 1; i < si->max; i++) {
> > -               swp_tb = swap_table_get(__swap_offset_to_cluster(si, i),
> > -                                       i % SWAPFILE_CLUSTER);
> > -               if (!swp_tb_is_null(swp_tb) && !swp_tb_is_bad(swp_tb))
> > -                       break;
> > -               if ((i % LATENCY_LIMIT) == 0)
> > +       i = prev + 1;
> > +       while (i < si->max) {
> > +               ci = __swap_offset_to_cluster(si, i);
> > +               ci_off = i % SWAPFILE_CLUSTER;
> > +               end = min(si->max, i - ci_off + SWAPFILE_CLUSTER);
> 
> Do we need the min here? Table size is always SWAPFILE_CLUSTER aligned.

Yes. I remove it.

> > +
> > +               /*
> > +                * An empty cluster has no slot in use, so skip it whole.
> > +                * A slot is uncounted only after its folio left the swap
> > +                * cache, so there is nothing here for try_to_unuse() to act on.
> > +                */
> > +               if (cluster_is_empty(ci)) {
> 
> Hmm, it's not wrong, but this is indeed the only user calling
> cluster_is_empty without holding a lock, and not in initilization
> path, perhaps we should at least make it READ_ONCE? Maybe KCSAN will
> not be happy, I guess? Just nitpick.

Right it is better to use READ_ONCE. I also applied it and submited v2!

Youngjun


      reply	other threads:[~2026-08-05 14:23 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-28 15:59 [PATCH 0/2] mm/swap: skip empty clusters in the swapoff scan Youngjun Park
2026-07-28 15:59 ` [PATCH 1/2] mm/swap: fix stale comment on swap_info_struct::cluster_info Youngjun Park
2026-08-04  9:48   ` Kairui Song
2026-08-04 16:36     ` Youngjun Park
2026-08-04  9:51   ` Barry Song
2026-08-04 16:33     ` Youngjun Park
2026-07-28 15:59 ` [PATCH 2/2] mm/swap: scan by cluster in find_next_to_unuse() Youngjun Park
2026-08-04 16:51   ` Kairui Song
2026-08-05 14:23     ` Youngjun Park [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=anNHWTMmpfHV0waH@yjaykim-PowerEdge-T330 \
    --to=youngjun.park@lge.com \
    --cc=akpm@linux-foundation.org \
    --cc=baohua@kernel.org \
    --cc=baoquan.he@linux.dev \
    --cc=chrisl@kernel.org \
    --cc=her0gyugyu@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=nphamcs@gmail.com \
    --cc=ryncsn@gmail.com \
    --cc=shikemeng@huaweicloud.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.