Re: [PATCH] mm: remove remnants of SPLIT_RSS_COUNTING
From: Mateusz Guzik
Date: Fri Aug 25 2023 - 16:01:28 EST
anyone in particular I should cc to get this reviewed?
this finishes a removal from an earlier commit, there is not much to
think about ;)
On 8/23/23, Mateusz Guzik <mjguzik@xxxxxxxxx> wrote:
> The feature got retired in f1a7941243c1 ("mm: convert mm's rss stats
> into percpu_counter"), but the patch failed to fully clean it up.
>
> Signed-off-by: Mateusz Guzik <mjguzik@xxxxxxxxx>
> ---
> fs/exec.c | 2 --
> include/linux/mm.h | 8 --------
> kernel/exit.c | 4 ----
> kernel/fork.c | 4 ----
> kernel/kthread.c | 1 -
> mm/madvise.c | 5 +----
> mm/memory.c | 2 --
> 7 files changed, 1 insertion(+), 25 deletions(-)
>
> diff --git a/fs/exec.c b/fs/exec.c
> index 1a827d55ba94..8d31d5fc658f 100644
> --- a/fs/exec.c
> +++ b/fs/exec.c
> @@ -985,8 +985,6 @@ static int exec_mmap(struct mm_struct *mm)
> tsk = current;
> old_mm = current->mm;
> exec_mm_release(tsk, old_mm);
> - if (old_mm)
> - sync_mm_rss(old_mm);
>
> ret = down_write_killable(&tsk->signal->exec_update_lock);
> if (ret)
> diff --git a/include/linux/mm.h b/include/linux/mm.h
> index 406ab9ea818f..08402054767a 100644
> --- a/include/linux/mm.h
> +++ b/include/linux/mm.h
> @@ -2606,14 +2606,6 @@ static inline void setmax_mm_hiwater_rss(unsigned
> long *maxrss,
> *maxrss = hiwater_rss;
> }
>
> -#if defined(SPLIT_RSS_COUNTING)
> -void sync_mm_rss(struct mm_struct *mm);
> -#else
> -static inline void sync_mm_rss(struct mm_struct *mm)
> -{
> -}
> -#endif
> -
> #ifndef CONFIG_ARCH_HAS_PTE_SPECIAL
> static inline int pte_special(pte_t pte)
> {
> diff --git a/kernel/exit.c b/kernel/exit.c
> index edb50b4c9972..3cdbe797008f 100644
> --- a/kernel/exit.c
> +++ b/kernel/exit.c
> @@ -539,7 +539,6 @@ static void exit_mm(void)
> exit_mm_release(current, mm);
> if (!mm)
> return;
> - sync_mm_rss(mm);
> mmap_read_lock(mm);
> mmgrab_lazy_tlb(mm);
> BUG_ON(mm != current->active_mm);
> @@ -829,9 +828,6 @@ void __noreturn do_exit(long code)
> io_uring_files_cancel();
> exit_signals(tsk); /* sets PF_EXITING */
>
> - /* sync mm's RSS info before statistics gathering */
> - if (tsk->mm)
> - sync_mm_rss(tsk->mm);
> acct_update_integrals(tsk);
> group_dead = atomic_dec_and_test(&tsk->signal->live);
> if (group_dead) {
> diff --git a/kernel/fork.c b/kernel/fork.c
> index d2e12b6d2b18..1ac1d850f7ab 100644
> --- a/kernel/fork.c
> +++ b/kernel/fork.c
> @@ -2409,10 +2409,6 @@ __latent_entropy struct task_struct *copy_process(
> p->io_uring = NULL;
> #endif
>
> -#if defined(SPLIT_RSS_COUNTING)
> - memset(&p->rss_stat, 0, sizeof(p->rss_stat));
> -#endif
> -
> p->default_timer_slack_ns = current->timer_slack_ns;
>
> #ifdef CONFIG_PSI
> diff --git a/kernel/kthread.c b/kernel/kthread.c
> index 4fff7df17a68..0cf5582122b3 100644
> --- a/kernel/kthread.c
> +++ b/kernel/kthread.c
> @@ -1470,7 +1470,6 @@ void kthread_unuse_mm(struct mm_struct *mm)
> * clearing tsk->mm.
> */
> smp_mb__after_spinlock();
> - sync_mm_rss(mm);
> local_irq_disable();
> tsk->mm = NULL;
> membarrier_update_current_mm(NULL);
> diff --git a/mm/madvise.c b/mm/madvise.c
> index 886f06066622..39bed9e4b08b 100644
> --- a/mm/madvise.c
> +++ b/mm/madvise.c
> @@ -741,11 +741,8 @@ static int madvise_free_pte_range(pmd_t *pmd, unsigned
> long addr,
> folio_mark_lazyfree(folio);
> }
>
> - if (nr_swap) {
> - if (current->mm == mm)
> - sync_mm_rss(mm);
> + if (nr_swap)
> add_mm_counter(mm, MM_SWAPENTS, nr_swap);
> - }
> if (start_pte) {
> arch_leave_lazy_mmu_mode();
> pte_unmap_unlock(start_pte, ptl);
> diff --git a/mm/memory.c b/mm/memory.c
> index cdc4d4c1c858..b72d90ece7fe 100644
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -474,8 +474,6 @@ static inline void add_mm_rss_vec(struct mm_struct *mm,
> int *rss)
> {
> int i;
>
> - if (current->mm == mm)
> - sync_mm_rss(mm);
> for (i = 0; i < NR_MM_COUNTERS; i++)
> if (rss[i])
> add_mm_counter(mm, i, rss[i]);
> --
> 2.39.2
>
>
--
Mateusz Guzik <mjguzik gmail.com>