linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Henrik Rydberg <rydberg@euromail.se>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
	Oleg Nesterov <oleg@redhat.com>, Jiri Kosina <jkosina@suse.cz>,
	Jonathan Cameron <jic23@cam.ac.uk>
Subject: Re: [PATCH] Introduce buflock, a one-to-many circular buffer mechanism (rev2)
Date: Tue, 22 Jun 2010 15:54:32 +0200	[thread overview]
Message-ID: <4C20C098.1010200@euromail.se> (raw)
In-Reply-To: <20100621161610.fdfe23a6.akpm@linux-foundation.org>

Andrew Morton wrote:
[...]
> I don't understand why this has "lock" in its name.
> 
> The API itself is a mixture of "bufwrite_foo" and "bufread_foo".
> 
> It's all a bit chaotic.  I'd suggest picking a sane name for the whole
> subsytem - perhaps "mrbuf" for "multi reader buffer"?  Then
> consistently name all interface functions as "mrbuf_foo". 
> mrbuf.h, mrbuf_write_lock(), etc.

Point taken.

>> +static __always_inline bool __must_check bufread_retry(struct buflock_reader *br, const struct buflock_writer *bw)
>> +{
>> +	smp_rmb();
>> +	if (unlikely(((br->tail - br->last) & bw->page) < bw->next - br->last))
>> +		return true;
>> +	++br->tail;
>> +	if (unlikely(br->head - br->tail > bw->page))
>> +		br->tail = br->head;
>> +	return false;
>> +}
> 
> This looks too large to be inlined.
> 
> What's the __always_inline for?  Was gcc uninlining this within
> separate compilation units?

As you say, the function is large, and I am uncertain about the rules regarding
compiler reordering across general function calls. Starting a general function
with a memory barrier feels weird. Perhaps the function should be split?

Thanks,
Henrik


      reply	other threads:[~2010-06-22 13:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-20 19:05 [PATCH] Introduce buflock, a one-to-many circular buffer mechanism (rev2) Henrik Rydberg
2010-06-20 20:13 ` Henrik Rydberg
2010-06-21 23:16 ` Andrew Morton
2010-06-22 13:54   ` Henrik Rydberg [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=4C20C098.1010200@euromail.se \
    --to=rydberg@euromail.se \
    --cc=akpm@linux-foundation.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=jic23@cam.ac.uk \
    --cc=jkosina@suse.cz \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg@redhat.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).