linux-trace-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
To: Vincent Donnefort <vdonnefort@google.com>
Cc: rostedt@goodmis.org, linux-kernel@vger.kernel.org,
	linux-trace-kernel@vger.kernel.org,
	mathieu.desnoyers@efficios.com, kernel-team@android.com
Subject: Re: [PATCH v11 1/5] ring-buffer: Zero ring-buffer sub-buffers
Date: Sat, 13 Jan 2024 22:38:24 +0900	[thread overview]
Message-ID: <20240113223824.3e9eed42cf10748e4255afde@kernel.org> (raw)
In-Reply-To: <20240111161712.1480333-2-vdonnefort@google.com>

On Thu, 11 Jan 2024 16:17:08 +0000
Vincent Donnefort <vdonnefort@google.com> wrote:

> In preparation for the ring-buffer memory mapping where each subbuf will
> be accessible to user-space, zero all the page allocations.
> 
> Signed-off-by: Vincent Donnefort <vdonnefort@google.com>

Looks good to me.

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

Thank you!

> 
> diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
> index 173d2595ce2d..db73e326fa04 100644
> --- a/kernel/trace/ring_buffer.c
> +++ b/kernel/trace/ring_buffer.c
> @@ -1466,7 +1466,8 @@ static int __rb_allocate_pages(struct ring_buffer_per_cpu *cpu_buffer,
>  
>  		list_add(&bpage->list, pages);
>  
> -		page = alloc_pages_node(cpu_to_node(cpu_buffer->cpu), mflags,
> +		page = alloc_pages_node(cpu_to_node(cpu_buffer->cpu),
> +					mflags | __GFP_ZERO,
>  					cpu_buffer->buffer->subbuf_order);
>  		if (!page)
>  			goto free_pages;
> @@ -1551,7 +1552,8 @@ rb_allocate_cpu_buffer(struct trace_buffer *buffer, long nr_pages, int cpu)
>  
>  	cpu_buffer->reader_page = bpage;
>  
> -	page = alloc_pages_node(cpu_to_node(cpu), GFP_KERNEL, cpu_buffer->buffer->subbuf_order);
> +	page = alloc_pages_node(cpu_to_node(cpu), GFP_KERNEL | __GFP_ZERO,
> +				cpu_buffer->buffer->subbuf_order);
>  	if (!page)
>  		goto fail_free_reader;
>  	bpage->page = page_address(page);
> @@ -5525,7 +5527,8 @@ ring_buffer_alloc_read_page(struct trace_buffer *buffer, int cpu)
>  	if (bpage->data)
>  		goto out;
>  
> -	page = alloc_pages_node(cpu_to_node(cpu), GFP_KERNEL | __GFP_NORETRY,
> +	page = alloc_pages_node(cpu_to_node(cpu),
> +				GFP_KERNEL | __GFP_NORETRY | __GFP_ZERO,
>  				cpu_buffer->buffer->subbuf_order);
>  	if (!page) {
>  		kfree(bpage);
> -- 
> 2.43.0.275.g3460e3d667-goog
> 


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

  reply	other threads:[~2024-01-13 13:38 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-11 16:17 [PATCH v11 0/5] Introducing trace buffer mapping by user-space Vincent Donnefort
2024-01-11 16:17 ` [PATCH v11 1/5] ring-buffer: Zero ring-buffer sub-buffers Vincent Donnefort
2024-01-13 13:38   ` Masami Hiramatsu [this message]
2024-01-11 16:17 ` [PATCH v11 2/5] ring-buffer: Introducing ring-buffer mapping functions Vincent Donnefort
2024-01-11 16:34   ` Mathieu Desnoyers
2024-01-11 23:23     ` Steven Rostedt
2024-01-12  9:13       ` Vincent Donnefort
2024-01-12 15:06         ` Steven Rostedt
2024-01-12 15:58           ` Steven Rostedt
2024-01-15  4:43   ` Masami Hiramatsu
2024-01-15 15:37     ` Vincent Donnefort
2024-01-15 16:09       ` Steven Rostedt
2024-01-15 16:23         ` Steven Rostedt
2024-01-15 17:29           ` Vincent Donnefort
2024-01-15 18:03             ` Steven Rostedt
2024-01-15 23:48           ` Masami Hiramatsu
2024-01-11 16:17 ` [PATCH v11 3/5] tracing: Allow user-space mapping of the ring-buffer Vincent Donnefort
2024-01-11 16:17 ` [PATCH v11 4/5] Documentation: tracing: Add ring-buffer mapping Vincent Donnefort
2024-01-13 13:36   ` Masami Hiramatsu
2024-01-14 14:26   ` Masami Hiramatsu
2024-01-14 16:23     ` Steven Rostedt
2024-01-14 23:10       ` Masami Hiramatsu
2024-01-11 16:17 ` [PATCH v11 5/5] ring-buffer/selftest: Add ring-buffer mapping test Vincent Donnefort
2024-01-13 13:39   ` Masami Hiramatsu
2024-01-14 14:17     ` Masami Hiramatsu
2024-01-14 16:20       ` 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=20240113223824.3e9eed42cf10748e4255afde@kernel.org \
    --to=mhiramat@kernel.org \
    --cc=kernel-team@android.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=rostedt@goodmis.org \
    --cc=vdonnefort@google.com \
    /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;
as well as URLs for NNTP newsgroup(s).