All of lore.kernel.org
 help / color / mirror / Atom feed
From: Henrik Nordstrom <hno@marasystems.com>
To: Henrik Nordstrom <hno@actionbase.se>
Cc: linux-kernel@vger.kernel.org
Subject: sigtimedwait timeout
Date: Sat, 24 Mar 2001 13:14:15 +0100	[thread overview]
Message-ID: <3ABC8F97.88806231@marasystems.com> (raw)
In-Reply-To: <39CB844E.5ECBEA20@actionbase.se>


Noticed that my sigtimedwait timeout patch got into the kernel, so polled signal I/O should now
work much better.

The question on why the timeout is calculated with an +1 for non-zero timeouts is still open.
AFAICT is is not needed as timespec_to_jiffies() does a correct rounding. The effect now is

 timeout    sleeping
 0          0
 1ns        2 jiffies
 1 jiffies  2 jiffies
 2 jiffies  3 jiffies
 3 jiffies  4 jiffies
 ...

If the "+1" is taken out then the timeout scale becomes the expected one, starting at 1 jiffie, not
2.


--
Henirk Nordstrom


Henrik Nordstrom wrote 22 September 2000:

> As I mentioned earlier sigtimedwait with a zero timeout (0,0) should not
> block, but it currently does for 10msec (one jiffie). This is a
> performance problem for applications using polled signal queues. SUSV2
> says specifically for this case "returns immediately with an error".
>
> Attached is a new version of my patch. The previous version messed up
> the signal mask if the signal queue was empty and a zero timeout was
> selected.
>
> It is still waiting one more jiffie than what is indicated by the
> timeout value if other than zero, caused by the following code fragment:
>
>                         timeout = (timespec_to_jiffies(&ts)
>                                    + (ts.tv_sec || ts.tv_nsec));
>
> Does anyone have any clue on why this +1 is there? I think this should
> also go away to only read
>
>                         timeout = timespec_to_jiffies(&ts);
>
> --
> Henrik Nordstrom

[patch deleted]



           reply	other threads:[~2001-03-24 12:14 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <39CB844E.5ECBEA20@actionbase.se>]

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=3ABC8F97.88806231@marasystems.com \
    --to=hno@marasystems.com \
    --cc=hno@actionbase.se \
    --cc=linux-kernel@vger.kernel.org \
    /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.