public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: mm-commits@vger.kernel.org,zhang.run@zte.com.cn,tglx@linutronix.de,stable@vger.kernel.org,pmladek@suse.com,mingo@kernel.org,broonie@kernel.org,hu.shengming@zte.com.cn,akpm@linux-foundation.org
Subject: + watchdog-softlockup-fix-sample-ring-index-wrap-in-need_counting_irqs.patch added to mm-nonmm-unstable branch
Date: Wed, 28 Jan 2026 10:13:36 -0800	[thread overview]
Message-ID: <20260128181337.0A426C4CEF1@smtp.kernel.org> (raw)


The patch titled
     Subject: watchdog/softlockup: fix sample ring index wrap in need_counting_irqs()
has been added to the -mm mm-nonmm-unstable branch.  Its filename is
     watchdog-softlockup-fix-sample-ring-index-wrap-in-need_counting_irqs.patch

This patch will shortly appear at
     https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/watchdog-softlockup-fix-sample-ring-index-wrap-in-need_counting_irqs.patch

This patch will later appear in the mm-nonmm-unstable branch at
    git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days

------------------------------------------------------
From: Shengming Hu <hu.shengming@zte.com.cn>
Subject: watchdog/softlockup: fix sample ring index wrap in need_counting_irqs()
Date: Mon, 19 Jan 2026 21:59:05 +0800

cpustat_tail indexes cpustat_util[], which is a NUM_SAMPLE_PERIODS-sized
ring buffer. need_counting_irqs() currently wraps the index using
NUM_HARDIRQ_REPORT, which only happens to match NUM_SAMPLE_PERIODS.

Use NUM_SAMPLE_PERIODS for the wrap to keep the ring math correct even if
the NUM_HARDIRQ_REPORT or  NUM_SAMPLE_PERIODS changes.

Link: https://lkml.kernel.org/r/tencent_7068189CB6D6689EB353F3D17BF5A5311A07@qq.com
Fixes: e9a9292e2368 ("watchdog/softlockup: Report the most frequent interrupts")
Signed-off-by: Shengming Hu <hu.shengming@zte.com.cn>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Mark Brown <broonie@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Zhang Run <zhang.run@zte.com.cn>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 kernel/watchdog.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/kernel/watchdog.c~watchdog-softlockup-fix-sample-ring-index-wrap-in-need_counting_irqs
+++ a/kernel/watchdog.c
@@ -550,7 +550,7 @@ static bool need_counting_irqs(void)
 	u8 util;
 	int tail = __this_cpu_read(cpustat_tail);
 
-	tail = (tail + NUM_HARDIRQ_REPORT - 1) % NUM_HARDIRQ_REPORT;
+	tail = (tail + NUM_SAMPLE_PERIODS - 1) % NUM_SAMPLE_PERIODS;
 	util = __this_cpu_read(cpustat_util[tail][STATS_HARDIRQ]);
 	return util > HARDIRQ_PERCENT_THRESH;
 }
_

Patches currently in -mm which might be from hu.shengming@zte.com.cn are

watchdog-softlockup-fix-sample-ring-index-wrap-in-need_counting_irqs.patch


                 reply	other threads:[~2026-01-28 18:13 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20260128181337.0A426C4CEF1@smtp.kernel.org \
    --to=akpm@linux-foundation.org \
    --cc=broonie@kernel.org \
    --cc=hu.shengming@zte.com.cn \
    --cc=mingo@kernel.org \
    --cc=mm-commits@vger.kernel.org \
    --cc=pmladek@suse.com \
    --cc=stable@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=zhang.run@zte.com.cn \
    /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