From: tip-bot for Bart Van Assche <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@kernel.org,
arjan@infradead.org, bvanassche@acm.org, tglx@linutronix.de,
sfr@canb.auug.org.au, bart.vanassche@gmail.com
Subject: [tip:timers/core] timer: Fix jiffies wrap behavior of round_jiffies_common()
Date: Fri, 28 Jun 2013 08:12:35 -0700 [thread overview]
Message-ID: <tip-9e04d3804d3ac97d8c03a41d78d0f0674b5d01e1@git.kernel.org> (raw)
In-Reply-To: <519BC066.5080600@acm.org>
Commit-ID: 9e04d3804d3ac97d8c03a41d78d0f0674b5d01e1
Gitweb: http://git.kernel.org/tip/9e04d3804d3ac97d8c03a41d78d0f0674b5d01e1
Author: Bart Van Assche <bart.vanassche@gmail.com>
AuthorDate: Tue, 21 May 2013 20:43:50 +0200
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Fri, 28 Jun 2013 17:10:11 +0200
timer: Fix jiffies wrap behavior of round_jiffies_common()
Direct compare of jiffies related values does not work in the wrap
around case. Replace it with time_is_after_jiffies().
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Cc: Arjan van de Ven <arjan@infradead.org>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Link: http://lkml.kernel.org/r/519BC066.5080600@acm.org
Cc: stable@vger.kernel.org
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
kernel/timer.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/kernel/timer.c b/kernel/timer.c
index 15ffdb3..15bc1b4 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -149,9 +149,11 @@ static unsigned long round_jiffies_common(unsigned long j, int cpu,
/* now that we have rounded, subtract the extra skew again */
j -= cpu * 3;
- if (j <= jiffies) /* rounding ate our timeout entirely; */
- return original;
- return j;
+ /*
+ * Make sure j is still in the future. Otherwise return the
+ * unmodified value.
+ */
+ return time_is_after_jiffies(j) ? j : original;
}
/**
prev parent reply other threads:[~2013-06-28 15:13 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-21 18:43 [PATCH] timer: Fix jiffies wrap behavior of round_jiffies*() Bart Van Assche
2013-05-29 23:01 ` Andrew Morton
2013-05-29 23:17 ` Joe Perches
2013-05-29 23:38 ` Andrew Morton
2013-05-29 23:48 ` Joe Perches
2013-05-30 0:13 ` Joe Perches
2013-05-30 4:50 ` Andrew Morton
2013-05-30 6:19 ` Bart Van Assche
2013-06-28 15:12 ` tip-bot for Bart Van Assche [this message]
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=tip-9e04d3804d3ac97d8c03a41d78d0f0674b5d01e1@git.kernel.org \
--to=tipbot@zytor.com \
--cc=arjan@infradead.org \
--cc=bart.vanassche@gmail.com \
--cc=bvanassche@acm.org \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=sfr@canb.auug.org.au \
--cc=tglx@linutronix.de \
/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
all inboxes | Powered by JetHome®