public inbox for linux-trace-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
To: hongao <hongao@uniontech.com>
Cc: naveen@kernel.org, anil.s.keshavamurthy@intel.com,
	davem@davemloft.net, linux-kernel@vger.kernel.org,
	linux-trace-kernel@vger.kernel.org
Subject: Re: [PATCH v3 1/1] kprobes: retry blocked optprobe in do_free_cleaned_kprobes
Date: Tue, 20 Jan 2026 14:50:36 +0900	[thread overview]
Message-ID: <20260120145036.f3fda6f57da8fd21745af7e9@kernel.org> (raw)
In-Reply-To: <349359900266B25F+20260115023804.3951960-2-hongao@uniontech.com>

On Thu, 15 Jan 2026 10:38:03 +0800
hongao <hongao@uniontech.com> wrote:

> Once the aggrprobe is fully reverted in do_free_cleaned_kprobes(), retry
> optimize_kprobe() on that sibling so it can return to OPTIMIZED.
> 
> Also remove the stale comment in __disarm_kprobe().
> 

Thanks, let me pick it.

> Signed-off-by: hongao <hongao@uniontech.com>
> ---
>  kernel/kprobes.c | 18 ++++++++++++------
>  1 file changed, 12 insertions(+), 6 deletions(-)
> 
> diff --git a/kernel/kprobes.c b/kernel/kprobes.c
> index ab8f9fc1f0d1..1bd84d3b4817 100644
> --- a/kernel/kprobes.c
> +++ b/kernel/kprobes.c
> @@ -516,6 +516,7 @@ static LIST_HEAD(freeing_list);
>  
>  static void kprobe_optimizer(struct work_struct *work);
>  static DECLARE_DELAYED_WORK(optimizing_work, kprobe_optimizer);
> +static void optimize_kprobe(struct kprobe *p);
>  #define OPTIMIZE_DELAY 5
>  
>  /*
> @@ -593,6 +594,17 @@ static void do_free_cleaned_kprobes(void)
>  			 */
>  			continue;
>  		}
> +
> +		/*
> +		 * The aggregator was holding back another probe while it sat on the
> +		 * unoptimizing/freeing lists.  Now that the aggregator has been fully
> +		 * reverted we can safely retry the optimization of that sibling.
> +		 */
> +
> +		struct kprobe *_p = get_optimized_kprobe(op->kp.addr);
> +		if (unlikely(_p))
> +			optimize_kprobe(_p);
> +
>  		free_aggr_kprobe(&op->kp);
>  	}
>  }
> @@ -1002,12 +1014,6 @@ static void __disarm_kprobe(struct kprobe *p, bool reopt)
>  		if (unlikely(_p) && reopt)
>  			optimize_kprobe(_p);
>  	}
> -	/*
> -	 * TODO: Since unoptimization and real disarming will be done by
> -	 * the worker thread, we can not check whether another probe are
> -	 * unoptimized because of this probe here. It should be re-optimized
> -	 * by the worker thread.
> -	 */
>  }
>  
>  #else /* !CONFIG_OPTPROBES */
> -- 
> 2.50.1
> 


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

      reply	other threads:[~2026-01-20  5:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-10  3:33 [[PATCH v2] 1/1] kprobes: retry pending optprobe after freeing blocker hongao
2026-01-05  4:58 ` Masami Hiramatsu
2026-01-15  2:38   ` [PATCH v3 0/1] hongao
     [not found]   ` <20260115023804.3951960-1-hongao@uniontech.com>
2026-01-15  2:38     ` [PATCH v3 1/1] kprobes: retry blocked optprobe in do_free_cleaned_kprobes hongao
2026-01-20  5:50       ` 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=20260120145036.f3fda6f57da8fd21745af7e9@kernel.org \
    --to=mhiramat@kernel.org \
    --cc=anil.s.keshavamurthy@intel.com \
    --cc=davem@davemloft.net \
    --cc=hongao@uniontech.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=naveen@kernel.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