Re: [PATCH 2/7] kfifo: move out spinlock
[Posted August 19, 2009 by jake]
| From: |
| Andrew Morton <akpm-AT-linux-foundation.org> |
| To: |
| Alan Cox <alan-AT-lxorguk.ukuu.org.uk> |
| Subject: |
| Re: [PATCH 2/7] kfifo: move out spinlock |
| Date: |
| Sun, 16 Aug 2009 16:34:22 -0700 |
| Message-ID: |
| <20090816163422.a147a918.akpm@linux-foundation.org> |
| Cc: |
| Stefani Seibold <stefani-AT-seibold.net>,
linux-kernel <linux-kernel-AT-vger.kernel.org>,
Arnd Bergmann <arnd-AT-arndb.de>,
Andi Kleen <andi-AT-firstfloor.org>,
Amerigo Wang <xiyou.wangcong-AT-gmail.com>,
Joe Perches <joe-AT-perches.com> |
| Archive-link: |
| Article, Thread
|
On Sun, 16 Aug 2009 23:58:43 +0100 Alan Cox <alan@lxorguk.ukuu.org.uk> wrote:
> On Sun, 16 Aug 2009 22:46:30 +0200
> Stefani Seibold <stefani@seibold.net> wrote:
>
> > Move the pointer to the spinlock out of struct kfifo. Most
> > users in tree do not actually use a spinlock, so the few
> > exceptions now have to call kfifo_{get,put}_locked, which takes
> > an extra argument to a spinlock.
>
> NAK this one for the moment
>
> We are about to set fifo loose through all the USB and some other
> char/serial drivers all of which will use the spinlock facility.
That sounds like a good reason for applying this patch first.
kfifo has no business assuming that the caller wants to use
spin_lock() locking.
If we want to add wrapper helpers around kfifo to reduce code
duplication in callers, and if one of those wrapper helpers provides
spinlock-based locking then fine.
But the happens-to-use-spin_lock functions shouldn't be called
kfifo_get(), because that steals namespace from the unlocked functions,
and makes the naming for the happens-to-use-mutex_lock functions look
weird.
(
Log in to post comments)