linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Mateusz Guzik <mjguzik@gmail.com>
To: akpm@linux-foundation.org
Cc: shakeelb@google.com, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org, Mateusz Guzik <mjguzik@gmail.com>
Subject: [PATCH] mm: remove remnants of SPLIT_RSS_COUNTING
Date: Wed, 23 Aug 2023 19:05:56 +0200	[thread overview]
Message-ID: <20230823170556.2281747-1-mjguzik@gmail.com> (raw)

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@gmail.com>
---
 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



             reply	other threads:[~2023-08-23 17:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-23 17:05 Mateusz Guzik [this message]
2023-08-25 19:58 ` Mateusz Guzik
2023-08-25 20:08   ` Andrew Morton
2023-08-27  6:32 ` Shakeel Butt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230823170556.2281747-1-mjguzik@gmail.com \
    --to=mjguzik@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=shakeelb@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox