diff options
author | David Howells <dhowells@redhat.com> | 2012-02-09 15:48:20 (GMT) |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-02-09 18:09:30 (GMT) |
commit | 690d137f448d4c4da9001871e6569d5636f116c7 (patch) | |
tree | a6ccb2a00ce2e1fd2f3d8facabd0242e61431704 /kernel/Kconfig.locks | |
parent | d65b4e98d7ea3038b767b70fe8be959b2913f16d (diff) | |
download | linux-fsl-qoriq-690d137f448d4c4da9001871e6569d5636f116c7.tar.xz |
Reduce the number of expensive division instructions done by _parse_integer()
_parse_integer() does one or two division instructions (which are slow)
per digit parsed to perform the overflow check.
Furthermore, these are particularly expensive examples of division
instruction as the number of clock cycles required to complete them may
go up with the position of the most significant set bit in the dividend:
if (*res > div_u64(ULLONG_MAX - val, base))
which is as maximal as possible.
Worse, on 32-bit arches, more than one of these division instructions
may be required per digit.
So, assuming we don't support a base of more than 16, skip the check if the
top nibble of the result is not set at this point.
Signed-off-by: David Howells <dhowells@redhat.com>
[ Changed it to not dereference the pointer all the time - even if the
compiler can and does optimize it away, the code just looks cleaner.
And edited the top nybble test slightly to make the code generated on
x86-64 better in the loop - test against a hoisted constant instead of
shifting and testing the result ]
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/Kconfig.locks')
0 files changed, 0 insertions, 0 deletions