linux/fs/proc
Chengming Zhou c2dc78b86e 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/20240528-b4-ksm-counters-v3-2-34bb358fdc13@linux.dev
Fixes: e2942062e0 ("ksm: count all zero pages placed by KSM")
Fixes: 6080d19f07 ("ksm: add ksm zero pages for each process")
Signed-off-by: Chengming Zhou <chengming.zhou@linux.dev>
Acked-by: David Hildenbrand <david@redhat.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Ran Xiaokai <ran.xiaokai@zte.com.cn>
Cc: Stefan Roesch <shr@devkernel.io>
Cc: xu xin <xu.xin16@zte.com.cn>
Cc: Yang Yang <yang.yang29@zte.com.cn>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2024-06-05 19:19:26 -07:00
..
array.c
base.c mm/ksm: fix ksm_zero_pages accounting 2024-06-05 19:19:26 -07:00
bootconfig.c fs/proc: Skip bootloader comment if no embedded kernel parameters 2024-04-09 23:36:18 +09:00
cmdline.c
consoles.c
cpuinfo.c
devices.c
fd.c Assorted commits that had missed the last merge window... 2024-05-21 13:11:44 -07:00
fd.h
generic.c
inode.c mm: switch mm->get_unmapped_area() to a flag 2024-04-25 20:56:25 -07:00
internal.h
interrupts.c
Kconfig
kcore.c
kmsg.c
loadavg.c
Makefile kbuild: make -Woverride-init warnings more consistent 2024-03-31 11:32:26 +09:00
meminfo.c mm: zswap: optimize zswap pool size tracking 2024-04-25 20:55:47 -07:00
namespaces.c
nommu.c
page.c mm: add is_huge_zero_folio() 2024-04-25 20:56:18 -07:00
proc_net.c fs: Add kernel-doc comments to proc_create_net_data_write() 2024-03-26 09:01:18 +01:00
proc_sysctl.c sysctl: drop now unnecessary out-of-bounds check 2024-04-24 09:43:54 +02:00
proc_tty.c
root.c
self.c
softirqs.c
stat.c
task_mmu.c mm: /proc/pid/smaps_rollup: avoid skipping vma after getting mmap_lock again 2024-05-24 11:55:07 -07:00
task_nommu.c
thread_self.c
uptime.c
util.c
version.c
vmcore.c fs/proc: fix softlockup in __read_vmcore 2024-05-11 15:51:44 -07:00