From: William Lee Irwin III <wli@holomorphy.com>
To: Andrew Morton <akpm@osdl.org>,
linux-kernel@vger.kernel.org, suparna@in.ibm.com,
linux-aio@kvack.org
Subject: [2/2] fix io_getevents() timer expiry setting
Date: Tue, 1 Jun 2004 18:26:36 -0700 [thread overview]
Message-ID: <20040602012636.GW2093@holomorphy.com> (raw)
In-Reply-To: <20040602012429.GV2093@holomorphy.com>
On Tue, Jun 01, 2004 at 06:24:29PM -0700, William Lee Irwin III wrote:
> The time conversion functions may have const args, which is in fact
> useful for when they are passed const variables as arguments so as
> to avoid discarding qualifiers from pointer types warnings. This is
> a preparatory cleanup for a minor aio bugfix.
start_jiffies was not respected by set_timeout(), which reread jiffies
instead of respecting what read_events() passed it. This difference can
be significant, particularly if the calling process slept during the
copy_to_user() operation in read_events(). To correct this, this patch
teaches it to respect its argument, with the additional bonus of
converting it to use timespec_to_jiffies() instead of open-coding it.
Index: timer-2.6.7-rc2/fs/aio.c
===================================================================
--- timer-2.6.7-rc2.orig/fs/aio.c 2004-06-01 03:25:53.000000000 -0700
+++ timer-2.6.7-rc2/fs/aio.c 2004-06-01 16:03:41.000000000 -0700
@@ -777,19 +777,11 @@
static inline void set_timeout(long start_jiffies, struct timeout *to,
const struct timespec *ts)
{
- unsigned long how_long;
-
- if (ts->tv_sec < 0 || (!ts->tv_sec && !ts->tv_nsec)) {
+ to->timer.expires = start_jiffies + timespec_to_jiffies(ts);
+ if (time_after(to->timer.expires, jiffies))
+ add_timer(&to->timer);
+ else
to->timed_out = 1;
- return;
- }
-
- how_long = ts->tv_sec * HZ;
-#define HZ_NS (1000000000 / HZ)
- how_long += (ts->tv_nsec + HZ_NS - 1) / HZ_NS;
-
- to->timer.expires = jiffies + how_long;
- add_timer(&to->timer);
}
static inline void clear_timeout(struct timeout *to)
next prev parent reply other threads:[~2004-06-02 1:27 UTC|newest]
Thread overview: 61+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-06-01 9:15 2.6.7-rc2-mm1 Andrew Morton
2004-06-01 9:59 ` 2.6.7-rc2-mm1 Alexander Gran
2004-06-01 11:28 ` 2.6.7-rc2-mm1 AKIYAMA Nobuyuki
2004-06-01 11:39 ` 2.6.7-rc2-mm1 Alexander Gran
2004-06-01 16:07 ` 2.6.7-rc2-mm1 Ari Pollak
2004-06-01 16:22 ` 2.6.7-rc2-mm1 Ari Pollak
2004-06-01 10:00 ` 2.6.7-rc2-mm1 Gabriel Ebner
2004-06-01 11:05 ` 2.6.7-rc2-mm1 Andrey Panin
2004-06-01 13:58 ` 2.6.7-rc2-mm1 Gabriel Ebner
2004-06-01 14:05 ` 2.6.7-rc2-mm1 Jan Killius
2004-06-01 10:29 ` 2.6.7-rc2-mm1 Christoph Hellwig
2004-06-01 13:43 ` 2.6.7-rc2-mm1 Mikael Pettersson
2004-06-01 13:57 ` 2.6.7-rc2-mm1 Christoph Hellwig
2004-06-01 14:14 ` 2.6.7-rc2-mm1 Mikael Pettersson
2004-06-01 10:48 ` 2.6.7-rc2-mm1 Dominik Karall
2004-06-01 11:24 ` 2.6.7-rc2-mm1 William Lee Irwin III
2004-06-01 11:37 ` 2.6.7-rc2-mm1 William Lee Irwin III
2004-06-02 10:18 ` 2.6.7-rc2-mm1 Paul Jackson
2004-06-02 10:23 ` 2.6.7-rc2-mm1 Andrew Morton
2004-06-05 11:07 ` 2.6.7-rc2-mm1 Matthias Urlichs
2004-06-06 8:02 ` 2.6.7-rc2-mm1 Paul Jackson
2004-06-01 11:26 ` 2.6.7-rc2-mm1 William Lee Irwin III
2004-06-01 11:36 ` 2.6.7-rc2-mm1 Keith Owens
2004-06-01 11:26 ` 2.6.7-rc2-mm1 Andy Lutomirski
2004-06-01 11:29 ` 2.6.7-rc2-mm1 William Lee Irwin III
2004-06-01 16:24 ` 2.6.7-rc2-mm1 Mikael Pettersson
2004-06-01 11:51 ` 2.6.7-rc2-mm1 Alexander Gran
2004-06-01 12:19 ` 2.6.7-rc2-mm1 Eric BEGOT
2004-06-01 16:19 ` 2.6.7-rc2-mm1 Adrian Bunk
2004-06-01 21:18 ` 2.6.7-rc2-mm1 Chris Wedgwood
2004-06-01 21:36 ` 2.6.7-rc2-mm1 Andrew Morton
2004-06-01 21:36 ` 2.6.7-rc2-mm1 David S. Miller
2004-06-01 22:21 ` 2.6.7-rc2-mm1 Alexander Gran
2004-06-01 21:45 ` 2.6.7-rc2-mm1 Alex Romosan
2004-06-01 14:55 ` 2.6.7-rc2-mm1: gcc 2.95 uaccess.h warnings Adrian Bunk
2004-06-01 15:03 ` Linus Torvalds
2004-06-01 16:10 ` Adrian Bunk
2004-06-01 16:07 ` 2.6.7-rc2-mm1 Norberto Bensa
2004-06-01 16:07 ` 2.6.7-rc2-mm1: e1000_ethtool.c compile error Adrian Bunk
2004-06-01 19:09 ` 2.6.7-rc2-mm1 Dominik Karall
2004-06-01 19:47 ` 2.6.7-rc2-mm1 Luiz Fernando N. Capitulino
2004-06-01 21:06 ` 2.6.7-rc2-mm1 Dominik Karall
2004-06-01 19:35 ` 2.6.7-rc2-mm1: compile error in kernel/exit.c Peter Lundkvist
2004-06-01 21:24 ` Mikael Pettersson
2004-06-01 23:12 ` 2.6.7-rc2-mm1 (compile stats) John Cherry
2004-06-02 0:39 ` [patch] 2.6.7-rc2-mm1: let SERIAL_8250_ACPI depend on ACPI_PCI Adrian Bunk
2004-06-02 11:27 ` [ACPI] " Matthew Wilcox
2004-06-02 16:51 ` Bjorn Helgaas
2004-06-02 1:24 ` [1/2] use const in time.h unit conversion functions William Lee Irwin III
2004-06-02 1:26 ` William Lee Irwin III [this message]
2004-06-02 18:43 ` Matt Mackall
2004-06-02 18:52 ` William Lee Irwin III
2004-06-03 8:17 ` Denis Vlasenko
2004-06-02 9:21 ` 2.6.7-rc2-mm1 - bk-netdev.patch e1000_ethtool.c doesn't build Paul Jackson
2004-06-02 9:41 ` Paul Jackson
2004-06-02 13:26 ` 2.6.7-rc2-mm1 William Lee Irwin III
2004-06-03 23:38 ` 2.6.7-rc2-mm1 Greg KH
2004-06-04 0:07 ` 2.6.7-rc2-mm1 William Lee Irwin III
2004-06-04 5:18 ` 2.6.7-rc2-mm1 Vojtech Pavlik
2004-06-03 0:51 ` 2.6.7-rc2-mm1 Joshua Kwan
2004-06-03 13:24 ` 2.6.7-rc2-mm1 Mikael Pettersson
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=20040602012636.GW2093@holomorphy.com \
--to=wli@holomorphy.com \
--cc=akpm@osdl.org \
--cc=linux-aio@kvack.org \
--cc=linux-kernel@vger.kernel.org \
--cc=suparna@in.ibm.com \
/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