From: Youngjun Park <youngjun.park@lge.com>
To: gaoguixing <gaoguixing@uniontech.com>
Cc: kasong@tencent.com, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
chrisl@kernel.org, shikemeng@huaweicloud.com, nphamcs@gmail.com,
bhe@redhat.com, baohua@kernel.org
Subject: Re: [RFC PATCH] mm/swap: fix swap table count encoding for empty slots
Date: Fri, 4 Sep 2026 15:07:46 +0900 [thread overview]
Message-ID: <appgMkDEZkgKID48@yjaykim-PowerEdge-T330> (raw)
In-Reply-To: <2FDEE109C6578F17+20260904025411.106943-1-gaoguixing@uniontech.com>
On Fri, Sep 04, 2026 at 10:54:11AM +0800, gaoguixing wrote:
....
> mm/swapfile.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/mm/swapfile.c b/mm/swapfile.c
> index d6c5c25755be..02fd5ad94185 100644
> --- a/mm/swapfile.c
> +++ b/mm/swapfile.c
> @@ -163,16 +163,16 @@ static void __swap_table_update_count(struct swap_cluster_info *ci,
> unsigned char count)
> {
> unsigned long swp_tb = __swap_table_get(ci, ci_off);
> - unsigned char flags = swap_table_count(count);
> + unsigned char tb_count = swap_table_count(count);
>
> if (WARN_ON_ONCE(swp_tb_is_bad(swp_tb)))
> return;
> - if (!flags && swp_tb_is_null(swp_tb))
> + if (!tb_count && swp_tb_is_null(swp_tb))
> return;
> - if (flags && swp_tb_is_null(swp_tb))
> - swp_tb = shadow_to_swp_tb(NULL, flags);
> - else
> - swp_tb = __swp_tb_mk_count(swp_tb, flags);
> + if (tb_count && swp_tb_is_null(swp_tb))
> + swp_tb = shadow_to_swp_tb(NULL, 0);
> +
> + swp_tb = __swp_tb_mk_count(swp_tb, tb_count);
> __swap_table_set(ci, ci_off, swp_tb);
> }
>
Hello,
If I understand correctly, this function was added during a custom
kernel adaptation, and since the flags field mixes the count and the
Z flag, you'd like to split out a dedicated helper for updating the
swap count?
To me the layout and helpers in swap_table.h and swapfile.c already
read well enough. A mistake is possible, but following how the flags
field is used across swap_table.h and its callers was not hard.
I can't quite see where this would apply or what it buys us from this
diff alone. Could you progress & share the rationale and an actual patch on top
of the upstream series?
Thanks,
Youngjun
next prev parent reply other threads:[~2026-09-04 6:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-04 2:54 gaoguixing
2026-09-04 6:07 ` Youngjun Park [this message]
2026-09-04 11:58 gaoguixing
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=appgMkDEZkgKID48@yjaykim-PowerEdge-T330 \
--to=youngjun.park@lge.com \
--cc=akpm@linux-foundation.org \
--cc=baohua@kernel.org \
--cc=bhe@redhat.com \
--cc=chrisl@kernel.org \
--cc=gaoguixing@uniontech.com \
--cc=kasong@tencent.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=nphamcs@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®