The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Josh Poimboeuf <jpoimboe@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	x86@kernel.org, Jiri Olsa <jolsa@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>
Subject: Re: [PATCH v7 08/17] unwind_user/deferred: Add unwind cache
Date: Sun, 4 May 2025 11:37:54 +0200	[thread overview]
Message-ID: <aBc1cqWcTJmeqg3X@gmail.com> (raw)
In-Reply-To: <20250502165008.734340489@goodmis.org>


* Steven Rostedt <rostedt@goodmis.org> wrote:

> -struct unwind_task_info {
> +struct unwind_cache {
>  	unsigned long		*entries;
> +	unsigned int		nr_entries;
> +};
> +
> +struct unwind_task_info {
> +	struct unwind_cache	cache;
>  };

> @@ -19,17 +20,29 @@ int unwind_deferred_trace(struct unwind_stacktrace *trace)
>  	if (current->flags & PF_EXITING)
>  		return -EINVAL;
>  
> -       if (!info->entries) {
> -               info->entries = kmalloc_array(UNWIND_MAX_ENTRIES, sizeof(long),
> -                                             GFP_KERNEL);
> -               if (!info->entries)
> -		       return -ENOMEM;
> +	if (!cache->entries) {
> +		cache->entries = kmalloc_array(UNWIND_MAX_ENTRIES, sizeof(long),
> +					       GFP_KERNEL);
> +		if (!cache->entries)
> +			return -ENOMEM;
> +        }

That's just sloppy: why isn't the unwind_cache a pointer to begin with, 
with the dynamically allocated object containing ::nr_entries?

Also, the code has whitespace damage.

> +
> +	trace->entries = cache->entries;
> +
> +	if (cache->nr_entries) {
> +               /*
> +                * The user stack has already been previously unwound in this
> +                * entry context.  Skip the unwind and use the cache.
> +                */
> +               trace->nr = cache->nr_entries;
> +               return 0;

Whitespace damage here too. Maybe in other patches as well.

Please don't rush this series without first reviewing it carefully ...

Thanks,

	Ingo

  reply	other threads:[~2025-05-04  9:37 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-02 16:47 [PATCH v7 00/17] unwind_user: perf: x86: Deferred unwinding infrastructure Steven Rostedt
2025-05-02 16:47 ` [PATCH v7 01/17] unwind_user: Add user space unwinding API Steven Rostedt
2025-05-04  9:30   ` Ingo Molnar
2025-05-04 16:43     ` Steven Rostedt
2025-05-04 17:53       ` Josh Poimboeuf
2025-05-02 16:47 ` [PATCH v7 02/17] unwind_user: Add frame pointer support Steven Rostedt
2025-05-02 16:47 ` [PATCH v7 03/17] unwind_user/x86: Enable frame pointer unwinding on x86 Steven Rostedt
2025-05-02 16:47 ` [PATCH v7 04/17] perf/x86: Rename and move get_segment_base() and make it global Steven Rostedt
2025-05-02 16:47 ` [PATCH v7 05/17] unwind_user: Add compat mode frame pointer support Steven Rostedt
2025-05-02 16:47 ` [PATCH v7 06/17] unwind_user/x86: Enable compat mode frame pointer unwinding on x86 Steven Rostedt
2025-05-02 16:47 ` [PATCH v7 07/17] unwind_user/deferred: Add unwind_deferred_trace() Steven Rostedt
2025-05-02 16:47 ` [PATCH v7 08/17] unwind_user/deferred: Add unwind cache Steven Rostedt
2025-05-04  9:37   ` Ingo Molnar [this message]
2025-05-04 16:21     ` Steven Rostedt
2025-05-02 16:47 ` [PATCH v7 09/17] unwind_user/deferred: Add deferred unwinding interface Steven Rostedt
2025-05-02 16:47 ` [PATCH v7 10/17] unwind_user/deferred: Make unwind deferral requests NMI-safe Steven Rostedt
2025-05-02 16:47 ` [PATCH v7 11/17] unwind deferred: Use bitmask to determine which callbacks to call Steven Rostedt
2025-05-09  1:36   ` Steven Rostedt
2025-05-02 16:47 ` [PATCH v7 12/17] unwind deferred: Use SRCU unwind_deferred_task_work() Steven Rostedt
2025-05-02 16:47 ` [PATCH v7 13/17] perf: Remove get_perf_callchain() init_nr argument Steven Rostedt
2025-05-02 16:48 ` [PATCH v7 14/17] perf: Have get_perf_callchain() return NULL if crosstask and user are set Steven Rostedt
2025-05-02 16:48 ` [PATCH v7 15/17] perf: Use current->flags & PF_KTHREAD instead of current->mm == NULL Steven Rostedt
2025-05-02 16:48 ` [PATCH v7 16/17] perf: Simplify get_perf_callchain() user logic Steven Rostedt
2025-05-02 16:48 ` [PATCH v7 17/17] perf: Skip user unwind if the task is a kernel thread Steven Rostedt
2025-05-04  9:41 ` [PATCH v7 00/17] unwind_user: perf: x86: Deferred unwinding infrastructure Ingo Molnar
2025-05-04 16:32   ` Steven Rostedt

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=aBc1cqWcTJmeqg3X@gmail.com \
    --to=mingo@kernel.org \
    --cc=jolsa@kernel.org \
    --cc=jpoimboe@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mhiramat@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=x86@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