Re: [PATCH v4 06/14] locks: encapsulate the fl_link list handling

From: Jeff Layton
Date: Tue Jun 25 2013 - 06:33:07 EST


On Tue, 25 Jun 2013 11:37:04 +1000
Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx> wrote:

> Hi Jeff,
>
> Thanks for doing all this work!
>
> Trivial comments below.
>
> On Fri, 21 Jun 2013 08:58:14 -0400 Jeff Layton <jlayton@xxxxxxxxxx> wrote:
> >
> > +static inline void
> > +locks_insert_global_locks(struct file_lock *fl)
> > +{
> > + list_add_tail(&fl->fl_link, &file_lock_list);
> > +}
>
> We generally do not use "inline" in C files any more and leave it to the
> compiler to do that. Also, without the "inline" these function headers
> should all be able to fit on single lines like the others here i.e.
>
> static void locks_insert_global_locks(struct file_lock *fl)
>

Thanks for helping review.

Usually that makes sense, but doesn't the compiler generally determine
that by counting the number of call sites? In this case, we'll have
several call sites and it probably wouldn't inline the function. That
makes this a little less efficient since we'll have to jump to this
routine, do the list_add_tail and then jump back.

That said, I'm not opposed to doing that since these routines grow a
bit in size later and we'll only do this when a lock is acquired or
dropped. I think Al has already merged most of this set into his
for-next branch though. Perhaps I can do a patch on top of that set
that removes the inline keywords from those functions?

--
Jeff Layton <jlayton@xxxxxxxxxx>

Attachment: signature.asc
Description: PGP signature