Messages in this thread | | | From | Nicholas Mc Guire <> | Subject | [PATCH 0/3] time: use __builtin_constant_p() in msecs_to_jiffies | Date | Sun, 5 Apr 2015 09:23:53 +0200 |
| |
In the overall kernel source there currently are 2544 msecs_to_jiffies 126 usecs_to_jiffies and a few places that are using var * HZ / 1000 constructs which are not always safe (no check of corner cases) and should be switched to msecs_to_jiffies (roughly 25 left). Allowing gcc to fold constants for these calls that in most cases are passing in constants (roughly 95%) has some potential to improve performance (and should save a few bytes).
size impact: x86_64_defconfig: without patches vmlinux 24628843 with patches vmlinux 24628797 ppc64_defconfig: without patches 27412024 with patches 27412040 (no clue why it is bigger!) multi_v7_defconfig: without patches vmlinux.o 22901462 with patches vmlinux.o 22899843
As the changes to the top level Kbuild will impact every architecture this is probably not enough testing - but should be suitable for a first review.
Once this is clean a patch for usecs_to_jiffies will be provided as well
The patch set: 0001 moves timeconst.h from kernel/time/ to include/generated/ and makes it available early enough so that the build can use the constants for msecs_to_jiffies 0002 rename msecs_to_jiffies to __msecs_to_jiffies, the only modification is that the < 0 is moved out. modified version of msecs_to_jiffies that checks for constant via call to __builtin_constant_p() and calls __msecs_to_jiffies if it can't determine that the argument is constant. 0003 documentation update and reformatting to kernel-doc format
| |