Linux Perf Users
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
	 Jiawei Sun <abyssmystery@gmail.com>
Cc: acme@kernel.org, peterz@infradead.org, mingo@redhat.com,
	 mark.rutland@arm.com, jolsa@kernel.org, irogers@google.com,
	 adrian.hunter@intel.com, alexander.shishkin@linux.intel.com,
	 james.clark@linaro.org, alexey.budankov@linux.intel.com
Subject: Re: [PATCH] perf record: fix poll storm when monitored threads exit
Date: Wed, 08 Jul 2026 12:25:42 -0700	[thread overview]
Message-ID: <178353874226.478719.6694278917863620651.b4-ty@kernel.org> (raw)
In-Reply-To: <20260707153801.315352-1-abyssmystery@gmail.com>

On Tue, 07 Jul 2026 23:38:00 +0800, Jiawei Sun wrote:
> When `perf record` samples a multi-threaded process and one of the
> target threads exits during the session, perf itself may start burning
> 100% CPU (up to 200% across two cores) until the session ends.  A
> single dead fd is sufficient to trigger this; it can be reproduced with
> 15 pthreads in a compute loop where one thread exits halfway through.
> 
> The root cause is two independent instances of the same defect: dead
> perf_event ring-buffer fds are left in a pollfd array.  When a monitored
> thread exits, the kernel closes its ring-buffer fd, which then returns
> POLLHUP.  POSIX specifies that poll() always reports POLLHUP and POLLERR
> regardless of the events mask, so any dead fd left in the array makes
> poll() return immediately every time, spinning in a tight loop:
> 
> [...]
Applied to perf-tools-next, thanks!

Best regards,
Namhyung



      parent reply	other threads:[~2026-07-08 19:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-07 15:38 [PATCH] perf record: fix poll storm when monitored threads exit Jiawei Sun
2026-07-07 17:58 ` Ian Rogers
2026-07-08 19:25 ` Namhyung Kim [this message]

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=178353874226.478719.6694278917863620651.b4-ty@kernel.org \
    --to=namhyung@kernel.org \
    --cc=abyssmystery@gmail.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=alexey.budankov@linux.intel.com \
    --cc=irogers@google.com \
    --cc=james.clark@linaro.org \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --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