mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: Peter Zijlstra <peterz@infradead.org>, Ingo Molnar <mingo@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Ian Rogers <irogers@google.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Eric Dumazet <edumazet@google.com>
Subject: [PATCH] perf/x86: Add cond_resched() when allocate/release DS buffers
Date: Mon, 27 Oct 2025 14:27:24 -0700	[thread overview]
Message-ID: <20251027212724.1759322-1-namhyung@kernel.org> (raw)

On large systems, it's possible to trigger sched latency warning during
the DS buffer allocation or release.  Add cond_resched() to avoid it.

Reported-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 arch/x86/events/intel/ds.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/x86/events/intel/ds.c b/arch/x86/events/intel/ds.c
index c0b7ac1c7594ea92..c8e90c5a8d3390ab 100644
--- a/arch/x86/events/intel/ds.c
+++ b/arch/x86/events/intel/ds.c
@@ -754,6 +754,7 @@ void release_ds_buffers(void)
 		if (x86_pmu.ds_pebs)
 			release_pebs_buffer(cpu);
 		release_bts_buffer(cpu);
+		cond_resched();
 	}
 }
 
@@ -791,6 +792,8 @@ void reserve_ds_buffers(void)
 
 		if (bts_err && pebs_err)
 			break;
+
+		cond_resched();
 	}
 
 	if (bts_err) {
-- 
2.51.1.838.g19442a804e-goog


             reply	other threads:[~2025-10-27 21:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-27 21:27 Namhyung Kim [this message]
2025-10-28 14:15 ` Peter Zijlstra
2025-10-28 15:27   ` Peter Zijlstra
2025-10-28 19:02     ` Namhyung Kim
2025-10-28 19:04       ` Peter Zijlstra
2025-10-28 20:13         ` Sebastian Andrzej Siewior
2025-10-29  9:07           ` Peter Zijlstra

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=20251027212724.1759322-1-namhyung@kernel.org \
    --to=namhyung@kernel.org \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=edumazet@google.com \
    --cc=irogers@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    /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

all inboxes | Powered by JetHome®