[PATCH v6 1/5] um: simplify os_idle_sleep() and sleep longer

Johannes Berg johannes at sipsolutions.net
Tue Dec 1 05:57:32 EST 2020


On Mon, 2020-11-30 at 13:15 +0100, Johannes Berg wrote:
> 
> -void os_idle_sleep(unsigned long long nsecs)
> +void os_idle_sleep(void)
>  {
> -	struct timespec ts = {
> -		.tv_sec  = nsecs / UM_NSEC_PER_SEC,
> -		.tv_nsec = nsecs % UM_NSEC_PER_SEC
> -	};
> -
> -	/*
> -	 * Relay the signal if clock_nanosleep is interrupted.
> -	 */
> -	if (clock_nanosleep(CLOCK_MONOTONIC, 0, &ts, NULL))
> -		deliver_alarm();
> +	select(0, NULL, NULL, NULL, NULL);
> 

I found out about the pause() syscall the other day. Maybe we should use
that here? It's basically equivalent, though with a shorter kernel code
path?

johannes




More information about the linux-um mailing list