Prev: pidns: Support unsharing the pid namespace.
Next: [PATCH 8/8] firewire: cdev: extend fw_cdev_event_iso_interrupt documentation
From: Henrik Rydberg on 20 Jun 2010 16:20 .... diff --git a/include/linux/buflock.h b/include/linux/buflock.h index 3d5df22..05996d5 100644 --- a/include/linux/buflock.h +++ b/include/linux/buflock.h @@ -125,8 +125,8 @@ static inline unsigned int bufwrite_at(const struct buflock_ writer *bw) */ static inline void bufwrite_unlock(struct buflock_writer *bw) { - ++bw->head; smp_wmb(); + ++bw->head; } -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: Henrik Rydberg on 22 Jun 2010 10:00
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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ |