From: Kairui Song <ryncsn@gmail.com>
To: Youngjun Park <youngjun.park@lge.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Chris Li <chrisl@kernel.org>, Kairui Song <kasong@tencent.com>,
Kemeng Shi <shikemeng@huaweicloud.com>,
Nhat Pham <nphamcs@gmail.com>, Baoquan He <baoquan.he@linux.dev>,
Barry Song <baohua@kernel.org>,
Jianyue Wu <wujianyue000@gmail.com>,
her0gyugyu@gmail.com, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 4/4] mm, swap: drop the swap cache guard and reclaim in swap_free_hibernation_slot()
Date: Wed, 12 Aug 2026 01:09:28 +0800 [thread overview]
Message-ID: <antScyyChj0XfXJy@KASONG-MC4> (raw)
In-Reply-To: <20260811132209.2862708-5-youngjun.park@lge.com>
On Tue, Aug 11, 2026 at 10:22:09PM +0800, Youngjun Park wrote:
> Both are there for a folio that readahead might have put on the slot. A
> hibernation entry is not a shadow and has no swap count, so the swap cache
> turns it away and no such folio can exist.
>
> Signed-off-by: Youngjun Park <youngjun.park@lge.com>
> ---
> mm/swapfile.c | 12 +-----------
> 1 file changed, 1 insertion(+), 11 deletions(-)
>
> diff --git a/mm/swapfile.c b/mm/swapfile.c
> index a337387f7431..4fba1770ce61 100644
> --- a/mm/swapfile.c
> +++ b/mm/swapfile.c
> @@ -2203,18 +2203,8 @@ void swap_free_hibernation_slot(swp_entry_t entry)
> pgoff_t offset = swp_offset(entry);
>
> ci = swap_cluster_lock(si, offset);
> - /*
> - * A slot with a folio in the swap cache is freed when the folio
> - * leaves the cache, the same rule swap_put_entries_cluster() follows.
> - * Readahead can put a folio here, and freeing the slot now would
> - * leave that folio with no entry behind it.
> - */
> - if (!swp_tb_is_folio(__swap_table_get(ci, offset % SWAPFILE_CLUSTER)))
> - __swap_cluster_free_entries(si, ci, offset % SWAPFILE_CLUSTER, 1);
> + __swap_cluster_free_entries(si, ci, offset % SWAPFILE_CLUSTER, 1);
> swap_cluster_unlock(ci);
> -
> - /* In theory readahead might add it to the swap cache by accident */
> - __try_to_reclaim_swap(si, offset, TTRS_ANYWAY);
Nice to see this gets cleaned up.
Acked-by: Kairui Song <kasong@tencent.com>
prev parent reply other threads:[~2026-08-11 17:09 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-11 13:22 [PATCH v3 0/4] mm, swap: keep hibernation swap slots out of the swap cache Youngjun Park
2026-08-11 13:22 ` [PATCH v3 1/4] mm, swap: don't free a hibernation slot that is in " Youngjun Park
2026-08-11 13:22 ` [PATCH v3 2/4] mm, swap: only allow swapped-out slots into " Youngjun Park
2026-08-11 13:22 ` [PATCH v3 3/4] mm, swap: give hibernation swap slots their own swap table entry type Youngjun Park
2026-08-11 16:48 ` Kairui Song
2026-08-11 13:22 ` [PATCH v3 4/4] mm, swap: drop the swap cache guard and reclaim in swap_free_hibernation_slot() Youngjun Park
2026-08-11 17:09 ` 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=antScyyChj0XfXJy@KASONG-MC4 \
--to=ryncsn@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=baohua@kernel.org \
--cc=baoquan.he@linux.dev \
--cc=chrisl@kernel.org \
--cc=her0gyugyu@gmail.com \
--cc=kasong@tencent.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=nphamcs@gmail.com \
--cc=shikemeng@huaweicloud.com \
--cc=wujianyue000@gmail.com \
--cc=youngjun.park@lge.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