diff options
author | Zhaoyang Huang <[email protected]> | 2020-12-15 20:42:23 -0800 |
---|---|---|
committer | Linus Torvalds <[email protected]> | 2020-12-15 22:46:15 -0800 |
commit | b50da6e9f42ade19141f6cf8870bb2312b055aa3 (patch) | |
tree | d504e2dec660733535ee66b19181cbde335b65c5 /lib/test_overflow.c | |
parent | 489e9fea66f31086f85d9a18e61e4791d94a56a4 (diff) |
mm: fix a race on nr_swap_pages
The scenario on which "Free swap = -4kB" happens in my system, which is caused
by several get_swap_pages racing with each other and show_swap_cache_info
happens simutaniously. No need to add a lock on get_swap_page_of_type as we
remove "Presub/PosAdd" here.
ProcessA ProcessB ProcessC
ngoals = 1 ngoals = 1
avail = nr_swap_pages(1) avail = nr_swap_pages(1)
nr_swap_pages(1) -= ngoals
nr_swap_pages(0) -= ngoals
nr_swap_pages = -1
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Zhaoyang Huang <[email protected]>
Acked-by: Vlastimil Babka <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Diffstat (limited to 'lib/test_overflow.c')
0 files changed, 0 insertions, 0 deletions