diff options
author | Chengming Zhou <[email protected]> | 2024-05-28 13:15:22 +0800 |
---|---|---|
committer | Andrew Morton <[email protected]> | 2024-06-05 19:19:26 -0700 |
commit | c2dc78b86e0821ecf9a9d0c35dba2618279a5bb6 (patch) | |
tree | b023d4ec8ba10a50829dae578c56b2edf698f4ee /lib/memory-notifier-error-inject.c | |
parent | 730cdc2c72c6905a2eda2fccbbf67dcef1206590 (diff) |
mm/ksm: fix ksm_zero_pages accounting
We normally ksm_zero_pages++ in ksmd when page is merged with zero page,
but ksm_zero_pages-- is done from page tables side, where there is no any
accessing protection of ksm_zero_pages.
So we can read very exceptional value of ksm_zero_pages in rare cases,
such as -1, which is very confusing to users.
Fix it by changing to use atomic_long_t, and the same case with the
mm->ksm_zero_pages.
Link: https://lkml.kernel.org/r/[email protected]
Fixes: e2942062e01d ("ksm: count all zero pages placed by KSM")
Fixes: 6080d19f0704 ("ksm: add ksm zero pages for each process")
Signed-off-by: Chengming Zhou <[email protected]>
Acked-by: David Hildenbrand <[email protected]>
Cc: Andrea Arcangeli <[email protected]>
Cc: Hugh Dickins <[email protected]>
Cc: Ran Xiaokai <[email protected]>
Cc: Stefan Roesch <[email protected]>
Cc: xu xin <[email protected]>
Cc: Yang Yang <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Diffstat (limited to 'lib/memory-notifier-error-inject.c')
0 files changed, 0 insertions, 0 deletions