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

Anton Ivanov anton.ivanov at kot-begemot.co.uk
Tue Dec 1 06:15:25 EST 2020


On 01/12/2020 10:57, Johannes Berg wrote:
> 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?

I had a gut feeling that there has to be a better way :)

Yes. Definitely.

>
> johannes
>
>
> _______________________________________________
> linux-um mailing list
> linux-um at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-um
>

-- 
Anton R. Ivanov
https://www.kot-begemot.co.uk/




More information about the linux-um mailing list