Commit 795fead
mm: swap: move nr_swap_pages counter decrement from folio_alloc_swap() to swap_range_alloc()
commit 4f78252 upstream.
Patch series "Some randome fixes and cleanups to swapfile".
Patch 0-3 are some random fixes. Patch 4 is a cleanup. More details can
be found in respective patches.
This patch (of 4):
When folio_alloc_swap() encounters a failure in either
mem_cgroup_try_charge_swap() or add_to_swap_cache(), nr_swap_pages counter
is not decremented for allocated entry. However, the following
put_swap_folio() will increase nr_swap_pages counter unpairly and lead to
an imbalance.
Move nr_swap_pages decrement from folio_alloc_swap() to swap_range_alloc()
to pair the nr_swap_pages counting.
Link: https://lkml.kernel.org/r/[email protected]
Link: https://lkml.kernel.org/r/[email protected]
Fixes: 0ff67f9 ("mm, swap: remove swap slot cache")
Signed-off-by: Kemeng Shi <[email protected]>
Reviewed-by: Kairui Song <[email protected]>
Reviewed-by: Baoquan He <[email protected]>
Cc: Johannes Weiner <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>1 parent 815c528 commit 795fead
1 file changed
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1115 | 1115 | | |
1116 | 1116 | | |
1117 | 1117 | | |
| 1118 | + | |
1118 | 1119 | | |
1119 | 1120 | | |
1120 | 1121 | | |
| |||
1313 | 1314 | | |
1314 | 1315 | | |
1315 | 1316 | | |
1316 | | - | |
1317 | 1317 | | |
1318 | 1318 | | |
1319 | 1319 | | |
| |||
0 commit comments