public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] time: use __builtin_constant_p() in msecs_to_jiffies
@ 2015-04-05  7:23 Nicholas Mc Guire
  2015-04-05  7:23 ` [PATCH 1/3] time: move timeconst.h into include/generated Nicholas Mc Guire
                   ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: Nicholas Mc Guire @ 2015-04-05  7:23 UTC (permalink / raw)
  To: Michal Marek
  Cc: Masahiro Yamada, Sam Ravnborg, Thomas Gleixner, H. Peter Alvin,
	Joe Perches, John Stultz, Andrew Hunter, Paul Turner,
	linux-kernel, Nicholas Mc Guire

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  

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2015-04-12  8:36 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-05  7:23 [PATCH 0/3] time: use __builtin_constant_p() in msecs_to_jiffies Nicholas Mc Guire
2015-04-05  7:23 ` [PATCH 1/3] time: move timeconst.h into include/generated Nicholas Mc Guire
2015-04-05  7:23 ` [PATCH 2/3] time: allow gcc to fold constants when using msecs_to_jiffies Nicholas Mc Guire
2015-04-06  0:03   ` Joe Perches
2015-04-06  1:00     ` Nicholas Mc Guire
2015-04-06  2:15       ` Joe Perches
2015-04-06  4:26         ` Nicholas Mc Guire
2015-04-06  4:33           ` Joe Perches
2015-04-06  6:40             ` Nicholas Mc Guire
2015-04-06  7:12               ` Joe Perches
2015-04-06  7:21                 ` Nicholas Mc Guire
2015-04-12  8:36         ` Nicholas Mc Guire
2015-04-05  7:23 ` [PATCH 3/3] time: update msecs_to_jiffies doc and move to kernel-doc format Nicholas Mc Guire
2015-04-05  9:33 ` [PATCH 0/3] time: use __builtin_constant_p() in msecs_to_jiffies Joe Perches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox