Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755540Ab3EUSn4 (ORCPT ); Tue, 21 May 2013 14:43:56 -0400 Received: from mail-ea0-f179.google.com ([209.85.215.179]:59716 "EHLO mail-ea0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752488Ab3EUSnz (ORCPT ); Tue, 21 May 2013 14:43:55 -0400 Message-ID: <519BC066.5080600@acm.org> Date: Tue, 21 May 2013 20:43:50 +0200 From: Bart Van Assche User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 MIME-Version: 1.0 To: Thomas Gleixner CC: Arjan van de Ven , Stephen Rothwell , linux-kernel Subject: [PATCH] timer: Fix jiffies wrap behavior of round_jiffies*() Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1083 Lines: 32 Make sure that the round_jiffies*() functions return a time that is in the future when the jiffies counter is about to wrap. Signed-off-by: Bart Van Assche Cc: Thomas Gleixner Cc: Arjan van de Ven Cc: Stephen Rothwell --- kernel/timer.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/kernel/timer.c b/kernel/timer.c index 15ffdb3..aa8b964 100644 --- a/kernel/timer.c +++ b/kernel/timer.c @@ -149,9 +149,7 @@ 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; + return time_is_after_jiffies(j) ? j : original; } /** -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/