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

Thomas Gleixner tglx at linutronix.de
Fri Feb 8 10:56:25 MSK 2019


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




More information about the CRIU mailing list