linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: linux-kernel@vger.kernel.org, linux-xfs@vger.kernel.org
Cc: linux-mm@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	yebin10@huawei.com
Subject: [PATCH 3/4] fork: remove use of percpu_counter_sum_all
Date: Wed, 15 Mar 2023 19:49:37 +1100	[thread overview]
Message-ID: <20230315084938.2544737-4-david@fromorbit.com> (raw)
In-Reply-To: <20230315084938.2544737-1-david@fromorbit.com>

From: Dave Chinner <dchinner@redhat.com>

This effectively reverts the change made in commit f689054aace2
("percpu_counter: add percpu_counter_sum_all interface") as the
race condition percpu_counter_sum_all() was invented to avoid is
now handled directly in percpu_counter_sum() and nobody needs to
care about summing racing with cpu unplug anymore.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
 kernel/fork.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/kernel/fork.c b/kernel/fork.c
index d8cda4c6de6c..c0257cbee093 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -755,11 +755,6 @@ static void check_mm(struct mm_struct *mm)
 	for (i = 0; i < NR_MM_COUNTERS; i++) {
 		long x = percpu_counter_sum(&mm->rss_stat[i]);
 
-		if (likely(!x))
-			continue;
-
-		/* Making sure this is not due to race with CPU offlining. */
-		x = percpu_counter_sum_all(&mm->rss_stat[i]);
 		if (unlikely(x))
 			pr_alert("BUG: Bad rss-counter state mm:%p type:%s val:%ld\n",
 				 mm, resident_page_types[i], x);
-- 
2.39.2


  parent reply	other threads:[~2023-03-15  8:49 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-15  8:49 [PATCH 0/4] pcpctr: fix percpu_counter_sum vs cpu offline race Dave Chinner
2023-03-15  8:49 ` [PATCH 1/4] cpumask: introduce for_each_cpu_or Dave Chinner
2023-03-15  8:49 ` [PATCH 2/4] pcpcntrs: fix dying cpu summation race Dave Chinner
2023-03-15  8:49 ` Dave Chinner [this message]
2023-03-15  8:49 ` [PATCH 4/4] pcpcntr: remove percpu_counter_sum_all() Dave Chinner
2023-03-15 19:22   ` kernel test robot
2023-03-15 20:55     ` Dave Chinner
2023-03-17  2:22       ` Yujie Liu
2023-03-15 20:14   ` kernel test robot
2023-03-15 21:21     ` Darrick J. Wong
     [not found] ` <20230315233618.2168-1-hdanton@sina.com>
2023-03-18  0:37   ` [PATCH 2/4] pcpcntrs: fix dying cpu summation race Dave Chinner
2023-03-18  0:41 ` [PATCH 0/4] pcpctr: fix percpu_counter_sum vs cpu offline race Darrick J. Wong

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=20230315084938.2544737-4-david@fromorbit.com \
    --to=david@fromorbit.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=yebin10@huawei.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;
as well as URLs for NNTP newsgroup(s).