public inbox for linux-trace-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
To: "Masami Hiramatsu (Google)" <mhiramat@kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>,
	Naveen N Rao <naveen@kernel.org>,
	"David S . Miller" <davem@davemloft.net>,
	linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org
Subject: Re: [PATCH] kprobes: Use dedicated kthread for kprobe optimizer
Date: Tue, 13 Jan 2026 10:49:42 +0900	[thread overview]
Message-ID: <20260113104942.9eaed0b4c92e85ce33a368cb@kernel.org> (raw)
In-Reply-To: <176805562740.355924.11587476104510049915.stgit@devnote2>

On Sat, 10 Jan 2026 23:33:47 +0900
"Masami Hiramatsu (Google)" <mhiramat@kernel.org> wrote:

> +static int kprobe_optimizer_thread(void *data)
> +{
> +	set_freezable();

Steve pointed that the kthread usually don't need to be freezable and
the workqueue is not freezable too. So I decided to remove this.

> +	while (!kthread_should_stop()) {
> +		wait_event_freezable(kprobe_optimizer_wait,
> +				     atomic_read(&optimizer_state) != OPTIMIZER_ST_IDLE ||
> +				     kthread_should_stop());
> +
> +		if (kthread_should_stop())
> +			break;
> +
> +		if (try_to_freeze())
> +			continue;
> +
> +		/*
> +		 * If it was a normal kick, wait for OPTIMIZE_DELAY.
> +		 * This wait can be interrupted by a flush request.
> +		 */
> +		if (atomic_read(&optimizer_state) == 1)
> +			wait_event_freezable_timeout(kprobe_optimizer_wait,
> +				atomic_read(&optimizer_state) == OPTIMIZER_ST_FLUSHING ||
> +				kthread_should_stop(),
> +				OPTIMIZE_DELAY);

Also, forgot to add kthread_should_stop() check here.

Let me update to v2.

Thanks,


-- 
Masami Hiramatsu (Google) <mhiramat@kernel.org>

      reply	other threads:[~2026-01-13  1:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-10 14:33 [PATCH] kprobes: Use dedicated kthread for kprobe optimizer Masami Hiramatsu (Google)
2026-01-13  1:49 ` Masami Hiramatsu [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=20260113104942.9eaed0b4c92e85ce33a368cb@kernel.org \
    --to=mhiramat@kernel.org \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=naveen@kernel.org \
    --cc=rostedt@goodmis.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