]> www.infradead.org Git - users/jedix/linux-maple.git/commit
mm: swap: use swap_entries_free() to free swap entry in swap_entry_put_locked()
authorKemeng Shi <shikemeng@huaweicloud.com>
Tue, 25 Mar 2025 16:25:23 +0000 (00:25 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 12 May 2025 00:48:13 +0000 (17:48 -0700)
commit835b868878d0127bd29b8c0009dc424a63dadffb
tree311cce2430a06414a942c92d8b6794f57309b08e
parent64944ef6a13e774546eb7635bdd26ef963335a41
mm: swap: use swap_entries_free() to free swap entry in swap_entry_put_locked()

In swap_entry_put_locked(), we will set slot to SWAP_HAS_CACHE before
using swap_entries_free() to do actual swap entry freeing.  This introduce
an unnecessary intermediate state.  By using swap_entries_free() in
swap_entry_put_locked(), we can eliminate the need to set slot to
SWAP_HAS_CACHE.  This change would make the behavior of
swap_entry_put_locked() more consistent with other put() operations which
will do actual free work after put last reference.

Link: https://lkml.kernel.org/r/20250325162528.68385-4-shikemeng@huaweicloud.com
Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
Reviewed-by: Tim Chen <tim.c.chen@linux.intel.com>
Reviewed-by: Kairui Song <kasong@tencent.com>
Reviewed-by: Baoquan He <bhe@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/swapfile.c