Whamcloud - gitweb
LU-5443 lnet: replace direct HZ access with kernel APIs 03/11303/3
authorJian Yu <jian.yu@intel.com>
Fri, 1 Aug 2014 08:41:17 +0000 (01:41 -0700)
committerOleg Drokin <oleg.drokin@intel.com>
Sat, 30 Aug 2014 01:25:56 +0000 (01:25 +0000)
commit7b8487f170af5ddb80ffe7a3b6e2655550006ff8
tree8ba9e528ac133b6583382d38cdacca73c910369c
parentf3b3e3f1b92f507816120a53bbfd0ab4887a7a98
LU-5443 lnet: replace direct HZ access with kernel APIs

On some customers’ systems, kernel was compiled with HZ defined to
100, instead of 1000. This improves performance for HPC applications.
However, to use these systems with Lustre, customers have to re-build
Lustre for the kernel because Lustre directly uses the defined
constant HZ.

Since kernel 2.6.21, some non-HZ dependent timing APIs become non-
inline functions, which can be used in Lustre codes to replace the
direct HZ access.

These kernel APIs include:
 jiffies_to_msecs()
 jiffies_to_usecs()
 jiffies_to_timespec()
 msecs_to_jiffies()
 usecs_to_jiffies()
 timespec_to_jiffies()

And here are some samples of the replacement:
 HZ            -> msecs_to_jiffies(MSEC_PER_SEC)
 n * HZ        -> msecs_to_jiffies(n * MSEC_PER_SEC)
 HZ / n        -> msecs_to_jiffies(MSEC_PER_SEC / n)
 n / HZ        -> jiffies_to_msecs(n) / MSEC_PER_SEC
 n / HZ * 1000 -> jiffies_to_msecs(n)

This patch replaces the direct HZ access in lnet module.

Signed-off-by: Jian Yu <jian.yu@intel.com>
Change-Id: I0be6c82636df08b0a0a763ea31dafa817c077fe1
Reviewed-on: http://review.whamcloud.com/11303
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Nathaniel Clark <nathaniel.l.clark@intel.com>
Reviewed-by: James Simmons <uja.ornl@gmail.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lnet/klnds/gnilnd/gnilnd.h
lnet/klnds/mxlnd/mxlnd.c
lnet/klnds/mxlnd/mxlnd.h
lnet/klnds/mxlnd/mxlnd_cb.c
lnet/klnds/o2iblnd/o2iblnd.h
lnet/klnds/o2iblnd/o2iblnd_cb.c
lnet/klnds/ralnd/ralnd.c
lnet/klnds/ralnd/ralnd_cb.c