Re: [PATCH 10/25] Unionfs: add un/likely conditionals on copyup ops

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Kok, Auke <auke-jan.h.kok@...>
Cc: Erez Zadok <ezk@...>, <akpm@...>, <linux-kernel@...>, <linux-fsdevel@...>, <viro@...>, <hch@...>
Date: Wednesday, September 26, 2007 - 9:40 am

In message <46F9E0EC.3010105@intel.com>, "Kok, Auke" writes:

Auke, that's a good question, but I found it hard to find any info about it.
There's no discussion on it in Documentation/, and very little I could find
elsewhere.  I did see one url explaining what un/likely does precisely, but
no guidelines.  My understanding is that it can improve performance, as long
as it's used carefully (otherwise it may hurt performance).

Background: we used un/likely in Unionfs only sparingly until now.  We
looked at what other filesystems and kernel components do, and it seems that
it varies a lot: some subsystems use it religiously wherever they can, and
some use it just a little here and there.  We looked at what other
filesystems do in particular and tried to follow a similar model under what
cases other filesystems use un/likely.

Recently we've done a full audit of the entire code, and added un/likely
where we felt that the chance of succeeding is 95% or better (e.g., error
conditions that should rarely happen, and such).  So while it looks like
we've added many of those in this series of patches, I can assure you we
didn't just wrap every conditional in an un/likely just for the sake of
using it. :-) There are plenty of conditionals (over 250) left untouched b/c
it didn't make sense to force the branch prediction on them one way or
another.

So my questions are, for everyone, what's the policy on using un/likely?
Any common conventions/wisdom?  I think we need something added to
Documentation/.

Also, Auke, if indeed compilers are [sic] likely to do better than
programmers adding un/likely wrappers, then why do we still support that in
the kernel?  (Working for a company tat produces high-quality compilers, you
may know the answer better.)

Personally I'm not too fond of what those wrappers do the code: they make it
a bit harder to read the code (yet another extra set of parentheses); and
they cause the code to be indented further to the right, which you sometimes
have to split to multiple lines to avoid going over 80 chars.

Cheers,
Erez.
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[GIT PULL -mm] 00/25 Unionfs updates/cleanups/fixes, Erez Zadok, (Tue Sep 25, 11:09 pm)
[PATCH 01/25] Unionfs: Simplify unionfs_get_nlinks, Erez Zadok, (Tue Sep 25, 11:09 pm)
[PATCH 04/25] Unionfs: cache-coherency fixes, Erez Zadok, (Tue Sep 25, 11:09 pm)
[PATCH 02/25] Unionfs: Remove unused #defines, Erez Zadok, (Tue Sep 25, 11:09 pm)
Re: [PATCH 10/25] Unionfs: add un/likely conditionals on cop..., Erez Zadok, (Wed Sep 26, 9:40 am)
[PATCH 06/25] Unionfs: minor coding style updates, Erez Zadok, (Tue Sep 25, 11:09 pm)
Re: [PATCH 05/25] Unionfs: cast page-&gt;index loff_t before..., Christoph Hellwig, (Wed Sep 26, 4:31 am)