This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFC] A method for forcing IFUNC selector


This commit:

  commit 2d48b41c8fa610067c4d664ac2339ae6ca43e78c
  Author: Ondrej Bilka <>
  Date:   Mon May 20 08:20:00 2013 +0200

     Faster memcpy on x64.

     We add new memcpy version that uses unaligned loads which are fast
     on modern processors. This allows second improvement which is avoiding
     computed jump which is relatively expensive operation.

     Tests available here:

changed the default memcpy selected on all of our processors from
__memcpy_ssse3_back to __memcpy_sse2_unaligned.

That caused a nice 2-3% improvement on some of our benchmarks (thanks!),
but also 10-15% degradation on others (boo!).

It appears that for certain sizes and alignments, the new memcpy could be
50% slower than the old one.

While we figure out how to re-tune our applications to get rid of the
"slow" size/alignment memcpy()s, we'd like to keep the applications that
suffer degradation on the old memcpy.

Unfortunately, glibc currently provides no way to do that [1].

Proposal: a new environment variable, say LD_IFUNC_SELECTOR, that will
contain semi-colon separated list of ifunc->implementation mappings that
the end-user desires to force. E.g. for our degraded applications, we
would set LD_IFUNC_SELECTOR to "memcpy=__memcpy_ssse3_back", while someone
who also wanted to force strcmp to __strcmp_sse42 would set it to

This mechanism could also simplify debugging when one particular
implementation appears to be broken (as has happened in this past).

If this is an acceptable approach, I will send a patch to implement it.


[1] Or rather, I have not found a way to do that without a gross hack.
    If there is a way, I am all ears.

Paul Pluzhnikov

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]