public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Stefani Seibold <stefani@seibold.net>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Arnd Bergmann <arnd@arndb.de>, Andi Kleen <andi@firstfloor.org>,
	Amerigo Wang <xiyou.wangcong@gmail.com>,
	Joe Perches <joe@perches.com>
Subject: Re: [PATCH 2/7] kfifo: move out spinlock
Date: Mon, 17 Aug 2009 01:21:50 -0700	[thread overview]
Message-ID: <20090817012150.9bb699ed.akpm@linux-foundation.org> (raw)
In-Reply-To: <20090817090829.689a604c@lxorguk.ukuu.org.uk>

On Mon, 17 Aug 2009 09:08:29 +0100 Alan Cox <alan@lxorguk.ukuu.org.uk> wrote:

> > > Those wrappers happen to be called kfifo_get and kfifo_put
> > 
> > Those names are wrong.
> 
> We've had them for years

So?  It's been wrong for years.  This is a chance to fix it.

> > They're wrong because they are the spinlock-specific variant.  What are
> > we going to call the mutex_lock-specific variant?
> 
> There isn't one.

Oh come on.

> > 
> > > > 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.
> > > 
> > > All over the kernel unlocked function versions have a leading _ name.
> > > It's the kernel convention.
> > 
> > tisn't.  radix-tree, rbrtee, idr, list_head, prio_tree, flex_array -
> > none of them use that convention.
> 
> Some random "10 second grep" examples, and this is also used more
> generally for the "without extra goo" variant of things
> 
> __set_special_pids
> __sysrq_put_key_op
> __sysrq_get_key_op
> __handle_sysrq
> __audit_getname
> __audit_inode
> __audit_node_child
> 
> and the without extra goo use includes such minor classics
> __get_user
> __put_user
> 
> the kernel contains lots and lots of
> 
> __foo()
> 
> foo()
> {
> 	spin_lock(bar);
> 	__foo()
> 	spin_unlock(bar)
> }

None of those functions are part of general container libraries.  All
the ones I mentioned _are_ part of general container libraries.

Plus, as I've said enty en times and keep getting ignored: the current
naming is wrong.  The generic kfifo_get() should not be assuming that
the caller wants spinlock-based locking.

> > > The other thing I must say I dislike about these patches is the
> > > gratuitious 'let's rename all the functions' approach it takes. The kfifo
> > > API is documented, used and random API of the year type changes mess
> > > stuff up and cause unneeded churn.
> > 
> > It fixes naming mistakes.  Long-term it is the correct thing to do. 
> > Best to do it now before we get more callers.
> 
> Why don't we fix all the really dumb naming mistakes then - things like
> the chrdev interfaces ? Massive churn, massive confusion. Patches are
> always being rejected (and rightfully so) for causing such messes.

These patches don't make a mess.  Stefani has already fixed all callers
in a small number of patches.

> And remember: its very hard to fix existing API documentation and books.
> It's doubly dangerous (and IMHO a complete no-no) to change the API of an
> interface if you don't change it such that old code will not reliably get
> a compile time failure.

The patchet will cause unmigrated code to fail to build, won't it?

  parent reply	other threads:[~2009-08-17  8:23 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-16 20:39 [PATCH 0/7] kfifo: new API v0.4 Stefani Seibold
2009-08-16 20:44 ` [PATCH 1/7] kfifo: move struct kfifo in place Stefani Seibold
2009-08-16 20:46 ` [PATCH 2/7] kfifo: move out spinlock Stefani Seibold
2009-08-16 22:58   ` Alan Cox
2009-08-16 23:34     ` Andrew Morton
2009-08-17  6:48       ` Alan Cox
2009-08-17  7:36         ` Andrew Morton
2009-08-17  8:08           ` Alan Cox
2009-08-17  8:14             ` Stefani Seibold
2009-08-17  8:21             ` Andrew Morton [this message]
2009-08-17  8:48               ` Alan Cox
2009-08-17  9:22                 ` Stefani Seibold
2009-08-17  7:46         ` Stefani Seibold
2009-08-17  8:15           ` Alan Cox
2009-08-17  8:28             ` Stefani Seibold
2009-08-17  8:53               ` Alan Cox
2009-08-17  9:26                 ` Stefani Seibold
2009-08-17  9:51                   ` Alan Cox
2009-08-17  9:52           ` Andi Kleen
2009-08-17  9:56             ` Stefani Seibold
2009-08-16 20:50 ` [PATCH 3/7] kfifo: cleanup namespace Stefani Seibold
2009-08-16 20:53 ` [PATCH 4/7] kfifo: rename kfifo_put... into kfifo_in... and kfifo_get... into kfifo_out Stefani Seibold
2009-08-16 20:57 ` [PATCH 5/7] kfifo: add DEFINE_KFIFO and friends, add very tiny functions Stefani Seibold
2009-08-16 21:00 ` [PATCH 6/7] kfifo: add kfifo_skip, kfifo_from_user and kfifo_to_user Stefani Seibold
2009-08-16 21:03 ` [PATCH 0/7] kfifo: add record handling functions Stefani Seibold
2009-08-16 21:04 ` [PATCH 7/7] " Stefani Seibold
2009-08-16 21:08 ` [PATCH 0/7] kfifo: new API v0.4 Stefani Seibold
  -- strict thread matches above, loose matches on Subject: below --
2009-08-19 20:49 [PATCH 0/7] kfifo: new API v0.5 Stefani Seibold
2009-08-19 20:53 ` [PATCH 2/7] kfifo: move out spinlock Stefani Seibold
2009-11-16 11:50 [PATCH 0/7] kfifo: new API v0.6 Stefani Seibold
2009-11-16 11:58 ` [PATCH 2/7] kfifo: move out spinlock Stefani Seibold
2009-11-17 11:44   ` Roger Quadros
2009-11-20  8:15 [PATCH 0/7] kfifo: new API v0.7 Stefani Seibold
2009-11-20  8:20 ` [PATCH 2/7] kfifo: move out spinlock Stefani Seibold

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=20090817012150.9bb699ed.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=andi@firstfloor.org \
    --cc=arnd@arndb.de \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stefani@seibold.net \
    --cc=xiyou.wangcong@gmail.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