From: Richard Weinberger <richard@nod.at>
To: Anton Ivanov <aivanov@brocade.com>,
user-mode-linux-devel@lists.sourceforge.net
Cc: Thomas Meyer <thomas@m3y3r.de>
Subject: Re: [uml-devel] [PATCH v4] um: Switch clocksource to hrtimers
Date: Mon, 2 Nov 2015 22:50:12 +0100 [thread overview]
Message-ID: <5637DA94.5000302@nod.at> (raw)
In-Reply-To: <1446480997-155855-1-git-send-email-aivanov@brocade.com>
Am 02.11.2015 um 17:16 schrieb Anton Ivanov:
> -void idle_sleep(unsigned long long nsecs)
> +/**
> + * os_idle_sleep() - sleep for a given time of nsecs
> + * @nsecs: nanoseconds to sleep
> + */
> +void os_idle_sleep(unsigned long long nsecs)
> {
> struct timespec ts;
>
> - /*
> - * nsecs can come in as zero, in which case, this starts a
> - * busy loop. To prevent this, reset nsecs to the tick
> - * interval if it is zero.
> - */
> - if (nsecs == 0)
> - nsecs = UM_NSEC_PER_SEC / UM_HZ;
> + if (nsecs <= 0) {
> + return;
> + }
>
> - nsecs = sleep_time(nsecs);
> - ts = ((struct timespec) { .tv_sec = nsecs / UM_NSEC_PER_SEC,
> - .tv_nsec = nsecs % UM_NSEC_PER_SEC });
> + ts = ((struct timespec) {
> + .tv_sec = nsecs / UM_NSEC_PER_SEC,
> + .tv_nsec = nsecs % UM_NSEC_PER_SEC
> + });
>
> - if (nanosleep(&ts, &ts) == 0)
> + if (clock_nanosleep(CLOCK_MONOTONIC, 0, &ts, NULL)) {
> deliver_alarm();
> - after_sleep_interval(&ts);
> + }
Hmm, now this function sleeps at most nsecs. If it is interrupted
the alarm is delivered.
Why only upon interruption and not also if clock_nanosleep()
completes?
Thanks,
//richard
------------------------------------------------------------------------------
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
next prev parent reply other threads:[~2015-11-02 21:50 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-02 16:16 [uml-devel] [PATCH v4] um: Switch clocksource to hrtimers Anton Ivanov
2015-11-02 21:50 ` Richard Weinberger [this message]
2015-11-02 22:13 ` Anton Ivanov
2015-11-03 7:11 ` Anton Ivanov
2015-11-03 7:58 ` Thomas Meyer
2015-11-06 21:56 ` Richard Weinberger
2015-11-07 10:29 ` Anton Ivanov
2015-11-07 10:32 ` Richard Weinberger
2015-11-18 1:20 ` Lorenzo Colitti
2015-11-18 7:00 ` Anton Ivanov
2015-11-18 7:10 ` Lorenzo Colitti
2015-11-18 8:06 ` Richard Weinberger
2015-11-18 13:32 ` Lorenzo Colitti
2015-11-18 13:40 ` Richard Weinberger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5637DA94.5000302@nod.at \
--to=richard@nod.at \
--cc=aivanov@brocade.com \
--cc=thomas@m3y3r.de \
--cc=user-mode-linux-devel@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.