hulk inclusion category: bugfix bugzilla: https://atomgit.com/openeuler/kernel/issues/8456 -------------------------------- This reverts commit 5ba723cc37230e616fe47ec19d441ba3168b4c4c. The existing LTS patch has an adaptation issue and is incompatible with the existing atomic mode in mm Counter. Now revert it and adapt it again later. Fixes: 5ba723cc3723 ("mm: fix the inaccurate memory statistics issue for users") Signed-off-by: Quanmin Yan <yanquanmin1@huawei.com> --- fs/proc/task_mmu.c | 14 +++++++------- include/linux/mm.h | 5 ----- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index fa1678a431a5..411c36224ae8 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c @@ -33,9 +33,9 @@ void task_mem(struct seq_file *m, struct mm_struct *mm) unsigned long text, lib, swap, anon, file, shmem; unsigned long hiwater_vm, total_vm, hiwater_rss, total_rss; - anon = get_mm_counter_sum(mm, MM_ANONPAGES); - file = get_mm_counter_sum(mm, MM_FILEPAGES); - shmem = get_mm_counter_sum(mm, MM_SHMEMPAGES); + anon = get_mm_counter(mm, MM_ANONPAGES); + file = get_mm_counter(mm, MM_FILEPAGES); + shmem = get_mm_counter(mm, MM_SHMEMPAGES); /* * Note: to minimize their overhead, mm maintains hiwater_vm and @@ -56,7 +56,7 @@ void task_mem(struct seq_file *m, struct mm_struct *mm) text = min(text, mm->exec_vm << PAGE_SHIFT); lib = (mm->exec_vm << PAGE_SHIFT) - text; - swap = get_mm_counter_sum(mm, MM_SWAPENTS); + swap = get_mm_counter(mm, MM_SWAPENTS); SEQ_PUT_DEC("VmPeak:\t", hiwater_vm); SEQ_PUT_DEC(" kB\nVmSize:\t", total_vm); SEQ_PUT_DEC(" kB\nVmLck:\t", mm->locked_vm); @@ -90,12 +90,12 @@ unsigned long task_statm(struct mm_struct *mm, unsigned long *shared, unsigned long *text, unsigned long *data, unsigned long *resident) { - *shared = get_mm_counter_sum(mm, MM_FILEPAGES) + - get_mm_counter_sum(mm, MM_SHMEMPAGES); + *shared = get_mm_counter(mm, MM_FILEPAGES) + + get_mm_counter(mm, MM_SHMEMPAGES); *text = (PAGE_ALIGN(mm->end_code) - (mm->start_code & PAGE_MASK)) >> PAGE_SHIFT; *data = mm->data_vm + mm->stack_vm; - *resident = *shared + get_mm_counter_sum(mm, MM_ANONPAGES); + *resident = *shared + get_mm_counter(mm, MM_ANONPAGES); return mm->total_vm; } diff --git a/include/linux/mm.h b/include/linux/mm.h index 585197c9c2fc..036822cb1b9d 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2653,11 +2653,6 @@ static inline unsigned long get_mm_counter(struct mm_struct *mm, int member) return percpu_counter_atomic_read(fbc); } -static inline unsigned long get_mm_counter_sum(struct mm_struct *mm, int member) -{ - return percpu_counter_sum_positive(&mm->rss_stat[member]); -} - void mm_trace_rss_stat(struct mm_struct *mm, int member); static inline void add_mm_counter(struct mm_struct *mm, int member, long value) -- 2.43.0