mm, swap: remove unneeded swap_extend_table_try_free() in swap_dup_entries_cluster()

Since commit 0475fde0f68de ("mm, swap: avoid leaving unused extend table
after alloc race"), extend table is always allocated when any swap count
reach MAX - 1 and is always freed when swap count decrease to MAX - 1 or
MAX - 2 with cluster lock held.  So the extend table will always be freed
properly when decrease swap count in __swap_cluster_put_entry().  So
swap_extend_table_try_free() outside of __swap_cluster_put_entry() is
unneeded and can be removed.

Link: https://lore.kernel.org/20260907091356.53026-5-shikemeng@huaweicloud.com
Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Youngjun Park <youngjun.park@lge.com>
Cc: Baoquan He <baoquan.he@linux.dev>
Cc: Barry Song <baohua@kernel.org>
Cc: Chris Li <chrisl@kernel.org>
Cc: Kairui Song <kasong@tencent.com>
Cc: Luiz Capitulino <luizcap@redhat.com>
Cc: Nhat Pham <nphamcs@gmail.com>
This commit is contained in:
Kemeng Shi 2026-09-07 17:13:56 +08:00 committed by Andrew Morton
parent 8683461020
commit 63a08a1124

View File

@ -1725,7 +1725,6 @@ static int swap_dup_entries_cluster(struct swap_info_struct *si,
failed:
while (ci_off-- > ci_start)
__swap_cluster_put_entry(ci, ci_off);
swap_extend_table_try_free(ci);
swap_cluster_unlock(ci);
return err;
}