lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <491113FF.9070007@kernel.org>
Date:	Wed, 05 Nov 2008 12:33:19 +0900
From:	Tejun Heo <tj@...nel.org>
To:	Alan Stern <stern@...land.harvard.edu>
CC:	Jens Axboe <jens.axboe@...cle.com>,
	Kernel development list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/2] Add round_jiffies_up and related routines

Alan Stern wrote:
> This patch (as1158) adds round_jiffies_up() and friends.  These
> routines work like the analogous round_jiffies() functions, except
> that they will never round down.
> 
> The new routines will be useful for timeouts where we don't care
> exactly when the timer expires, provided it doesn't expire too soon.
> 
> Signed-off-by: Alan Stern <stern@...land.harvard.edu>

Heh... I have exactly the same patches but mines were named
round_up_jiffies().

> +	unsigned long j0 = jiffies;
> +
> +	barrier();	/* Prevent the compiler from aliasing j0 and jiffies */
> +	return round_jiffies_common(j + j0, cpu, false) - j0;

jiffies is volatile.  No need for explicit barrier, but this part is
necessary for correct operation as if jiffies go up by two the
calculation will wrap and the returned value will be very large.  I
think this fix deserves a separate patch and proper explanation.

Thanks.

-- 
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ