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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 18 May 2009 09:14:21 +0200
From:	Andi Kleen <andi@...stfloor.org>
To:	Chris Peterson <cpeterso@...terso.com>
Cc:	linux-kernel@...r.kernel.org, tglx@...utronix.de
Subject: Re: [RFC] mod_timer() helper functions?

Chris Peterson <cpeterso@...terso.com> writes:
>
> Any suggestions? Is there enough value to warrant adding helper
> function like these as an alternative to mod_timer()?

I like the basic idea. The opencoding has always annoyed me.
>
>
> chris
>
> ---
> static inline int mod_timer_seconds(struct timer_list *timer, time_t seconds)

I would prefer a name like mod_timer_in_secs() to make it clear it's relative

> {
> 	return mod_timer(timer, round_jiffies(jiffies + seconds * HZ));
> }

>
> static inline int mod_timer_msecs(struct timer_list *timer, unsigned int msecs)
> {
> 	/* TODO? Round jiffies if within some epsilon of a whole second? */
> 	return mod_timer(timer, jiffies + msecs_to_jiffies(msecs));

This is a bit misleading because depending on HZ the accuracy is far from
a millisecond (worst case 10ms error with HZ==100). Naming should make
that clearer. Or maybe these users should all switch to hrtimers,
but then those could be not available either.

I suspect you also want a helper for longer term delays that uses
deferred timers or more aggressive rounding.


> }
>
> static inline int mod_timer_yield(struct timer_list *timer)
> {
> 	/* After these messages, we'll be right back. */
> 	return mod_timer(timer, jiffies + 1);

Can't say I like the name here, although I don't have a better one.

-Andi

-- 
ak@...ux.intel.com -- Speaking for myself only.
--
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