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]
Message-ID: <adaiqmmf87v.fsf@cisco.com>
Date:	Fri, 06 Mar 2009 17:11:00 -0800
From:	Roland Dreier <rdreier@...co.com>
To:	Timur Tabi <timur@...escale.com>
Cc:	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] add function spin_event_timeout()

 > The function spin_event_timeout() takes a condition and timeout value
 > (in jiffies) as parameters.  It spins until either the condition is true
 > or the timeout expires.  It returns non-zero if the condition is true,
 > zero otherwise.

What's the motivation for this?  Where do you plan to use it?

 > + * The function returns non-zero if the @condition evaluated to true, or

It's not a function but rather a macro.

 > +#define spin_event_timeout(condition, timeout)		\
 > +({							\
 > +	long __timeout = jiffies + (timeout);		\
 > +	while (!(condition) && (jiffies < __timeout));	\
 > +	(condition);					\
 > +})

If we're going to make this core infrastructure, it seems we should
implement it with all best practices... eg I would think the while loop
should include cpu_relax().
--
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