summaryrefslogtreecommitdiff
path: root/mm/swap_state.c
diff options
context:
space:
mode:
authorBaoquan He <bhe@redhat.com>2025-02-05 17:27:11 +0800
committerAndrew Morton <akpm@linux-foundation.org>2025-03-16 22:06:05 -0700
commitcd57a3fb37f91ef6106bc970d2b5c5878d3b5627 (patch)
tree8fa56b03b38062c0514ac7c67f489ae42badd931 /mm/swap_state.c
parent81fe88a946051f1dceef72fb3f87bb0880392464 (diff)
mm/swap_state.c: optimize the code in clear_shadow_from_swap_cache()
Use ALIGN to achieve the same effect and simplify the code. Link: https://lkml.kernel.org/r/20250205092721.9395-3-bhe@redhat.com Signed-off-by: Baoquan He <bhe@redhat.com> Cc: Chris Li <chrisl@kernel.org> Cc: Kairui Song <ryncsn@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm/swap_state.c')
-rw-r--r--mm/swap_state.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/mm/swap_state.c b/mm/swap_state.c
index aabde86d1f47..8a84371980e9 100644
--- a/mm/swap_state.c
+++ b/mm/swap_state.c
@@ -270,9 +270,7 @@ void clear_shadow_from_swap_cache(int type, unsigned long begin,
xa_unlock_irq(&address_space->i_pages);
/* search the next swapcache until we meet end */
- curr >>= SWAP_ADDRESS_SPACE_SHIFT;
- curr++;
- curr <<= SWAP_ADDRESS_SPACE_SHIFT;
+ curr = ALIGN((curr + 1), SWAP_ADDRESS_SPACE_PAGES);
if (curr > end)
break;
}