Re: [PATCH 07/32] timens/kernel: Take into account timens clock offsets in clock_nanosleep

From: Thomas Gleixner
Date: Fri Feb 08 2019 - 02:56:49 EST


On Wed, 6 Feb 2019, Dmitry Safonov wrote:
>
> @@ -1721,9 +1722,16 @@ long hrtimer_nanosleep(const struct timespec64 *rqtp,
> {
> struct restart_block *restart;
> struct hrtimer_sleeper t;
> + struct timespec64 tp;
> int ret = 0;
> u64 slack;
>
> + if (!(mode & HRTIMER_MODE_REL)) {
> + tp = *rqtp;
> + rqtp = &tp;

So every invocation of hrtimer_nanosleep() gains a copy of the timespec64
even if the namespace muck is disabled.

The only relevant caller of this is common_nsleep(). So it might make sense
to have common_nsleep() separated for CLOCK_MONOTONIC/BOOTTIME and handle
the thing there. That again avoids the switch() to and out of line calls.

Thanks,

tglx