From: Hubertus Franke <frankeh@watson.ibm.com>
To: drepper@redhat.com
Cc: rusty@rustcorp.com.au, matthew@hairy.beasts.org,
linux-kernel@vger.kernel.org, lse-tech@lists.sourceforge.net
Subject: futex and timeouts
Date: Wed, 13 Mar 2002 13:26:53 -0500 [thread overview]
Message-ID: <20020313182552.945523FE06@smtp.linux.ibm.com> (raw)
Ulrich, it seems to me that absolute timeouts are the easiest to do.
(a) expand by additional parameter (0) means no timeout desired
(b) differentiate the schedule call in futex_down..
Question is whether the granularity of jiffies (10ms) is sufficiently small
for timeouts.....
Rusty, take a look, wether there's something wrong with this and see whether
you can integrate it or improve and integrate it.
/* Simplified from arch/ppc/kernel/semaphore.c: Paul M. is a genius. */
static int futex_down(struct list_head *head, struct page *page, int offset,
signed long timeout)
{
int retval = 0;
struct futex_q q;
current->state = TASK_INTERRUPTIBLE;
queue_me(head, &q, page, offset);
while (!decrement_to_zero(page, offset)) {
if (signal_pending(current)) {
retval = -EINTR;
break;
}
if (!timeout) {
schedule();
current->state = TASK_INTERRUPTIBLE;
continue;
}
delay = schedule_timeout(timeout);
if (delay == 0) {
retval = -EAGAIN;
break;
}
current->state = TASK_INTERRUPTIBLE;
timeout -= delay;
}
current->state = TASK_RUNNING;
unqueue_me(&q);
/* If we were signalled, we might have just been woken: we
must wake another one. Otherwise we need to wake someone
else (if they are waiting) so they drop the count below 0,
and when we "up" in userspace, we know there is a
waiter. */
wake_one_waiter(head, page, offset);
return retval;
}
--
-- Hubertus Franke (frankeh@watson.ibm.com)
next reply other threads:[~2002-03-13 18:26 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-03-13 18:26 Hubertus Franke [this message]
2002-03-13 18:54 ` futex and timeouts Ulrich Drepper
2002-03-14 4:15 ` Rusty Russell
2002-03-14 15:19 ` Hubertus Franke
2002-03-15 5:39 ` [PATCH] " Rusty Russell
2002-03-15 6:08 ` Joel Becker
2002-03-15 6:56 ` H. Peter Anvin
2002-03-15 8:49 ` Rusty Russell
2002-03-15 15:16 ` Hubertus Franke
2002-03-15 16:04 ` Joel Becker
2002-03-15 18:59 ` Hubertus Franke
2002-03-15 19:28 ` Joel Becker
2002-03-16 1:12 ` [Lse-tech] " george anzinger
2002-03-18 21:35 ` Hubertus Franke
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=20020313182552.945523FE06@smtp.linux.ibm.com \
--to=frankeh@watson.ibm.com \
--cc=drepper@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lse-tech@lists.sourceforge.net \
--cc=matthew@hairy.beasts.org \
--cc=rusty@rustcorp.com.au \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox