linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Vincent Donnefort <vdonnefort@google.com>
To: David Hildenbrand <david@redhat.com>
Cc: Steven Rostedt <rostedt@goodmis.org>,
	mhiramat@kernel.org, linux-kernel@vger.kernel.org,
	linux-trace-kernel@vger.kernel.org,
	mathieu.desnoyers@efficios.com, kernel-team@android.com,
	rdunlap@infradead.org, rppt@kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH v22 2/5] ring-buffer: Introducing ring-buffer mapping functions
Date: Fri, 10 May 2024 12:03:12 +0100	[thread overview]
Message-ID: <Zj3-8GHR_EiWY7lB@google.com> (raw)
In-Reply-To: <cc719813-ba73-461f-8b45-4728f926c151@redhat.com>

[...]

> > > +
> > > +	while (s < nr_subbufs && p < nr_pages) {
> > > +		struct page *page = virt_to_page(cpu_buffer->subbuf_ids[s]);
> > > +		int off = 0;
> > > +
> > > +		for (; off < (1 << (subbuf_order)); off++, page++) {
> > > +			if (p >= nr_pages)
> > > +				break;
> > > +
> > > +			pages[p++] = page;
> > > +		}
> > > +		s++;
> > > +	}
> > 
> > The above can be made to:
> > 
> > 	while (p < nr_pages) {
> > 		struct page *page;
> > 		int off = 0;
> > 
> > 		if (WARN_ON_ONCE(s >= nr_subbufs))
> > 			break;
> 
> I'm not particularly happy about us calling vm_insert_pages with NULL
> pointers stored in pages.
> 
> Should we instead do
> 
> if (WARN_ON_ONCE(s >= nr_subbufs)) {
> 	err = -EINVAL;
> 	goto out;
> }
> 
> ?

I could also nr_pages = p in the event of s >= nr_subbufs... but that
really that shouldn't happen so let's return an error.

> 
> -- 
> Cheers,
> 
> David / dhildenb
> 


  reply	other threads:[~2024-05-10 11:03 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20240430111354.637356-1-vdonnefort@google.com>
2024-04-30 11:13 ` Vincent Donnefort
2024-05-02 13:30   ` David Hildenbrand
2024-05-02 13:38     ` Vincent Donnefort
2024-05-02 13:46       ` Steven Rostedt
2024-05-08  2:34   ` Steven Rostedt
2024-05-09 11:05     ` Vincent Donnefort
2024-05-10  9:15       ` David Hildenbrand
2024-05-10 10:57         ` Vincent Donnefort
2024-05-10  9:19     ` David Hildenbrand
2024-05-10 11:03       ` Vincent Donnefort [this message]
2024-05-10 18:42         ` Steven Rostedt
2024-04-30 11:13 ` [PATCH v22 3/5] tracing: Allow user-space mapping of the ring-buffer Vincent Donnefort

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=Zj3-8GHR_EiWY7lB@google.com \
    --to=vdonnefort@google.com \
    --cc=david@redhat.com \
    --cc=kernel-team@android.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mhiramat@kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=rppt@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