[lkml]   [2007]   [Sep]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: [PATCH 10/25] Unionfs: add un/likely conditionals on copyup ops
    On Sep 26, 2007, at 09:40:20, Erez Zadok wrote:
    > In message <>, "Kok, Auke" writes:
    >> I've been told several times that adding these is almost always
    >> bogus - either it messes up the CPU branch prediction or the
    >> compiler/CPU just does a lot better at finding the right way
    >> without these hints.
    >> Adding them as a blanket seems rather strange. Have you got any
    >> numbers that this really improves performance?
    > 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).

    Hmm, even still I agree with Auke, you probably use it too much.

    > 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).

    Actually due to the performance penalty on some systems I think you
    only want to use it if the chance of succeeding is 99% or better, as
    the benefit if predicted is a cycle or two and the harm if
    mispredicted can be more than 50 cycles, depending on the CPU. You
    should also remember than in filesystems many "failures" are
    triggered by things like the library searches, where it
    literally calls access() 20 different times on various possible paths
    for library files, failing the first 19. It does this once for each
    necessary library.

    Typically you only want to add unlikely() or likely() for about 2
    (A) It's a hot path and the unlikely case is just going to burn a
    bunch of CPU anyways
    (B) It really is extremely unlikely that it fails (Think physical
    hardware failure)

    Anything else is just bogus.

    Kyle Moffett

    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    More majordomo info at
    Please read the FAQ at

     \ /
      Last update: 2007-09-26 17:27    [W:0.021 / U:0.040 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site