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: <20150422143618.GA28213@opentech.at>
Date:	Wed, 22 Apr 2015 16:36:18 +0200
From:	Nicholas Mc Guire <der.herr@...r.at>
To:	Thomas Gleixner <tglx@...utronix.de>
Cc:	Nicholas Mc Guire <hofrat@...dl.org>,
	Michal Marek <mmarek@...e.cz>,
	Masahiro Yamada <yamada.m@...panasonic.com>,
	Sam Ravnborg <sam@...nborg.org>,
	"H. Peter Alvin" <hpa@...or.com>, Joe Perches <joe@...ches.com>,
	John Stultz <john.stultz@...aro.org>,
	Andrew Hunter <ahh@...gle.com>, Paul Turner <pjt@...gle.com>,
	Aaron Sierra <asierra@...-inc.com>,
	Brian Norris <computersforpeace@...il.com>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/3 V2] time: allow gcc to fold constants when using

On Wed, 22 Apr 2015, Thomas Gleixner wrote:

> On Sun, 12 Apr 2015, Nicholas Mc Guire wrote:
> > +extern unsigned long __msecs_to_jiffies(const unsigned int m);
> > +#if HZ <= MSEC_PER_SEC && !(MSEC_PER_SEC % HZ)
> > +static inline unsigned long _msecs_to_jiffies(const unsigned int m)
> > +{
> 
> This should move the comments explaining the logic for each variant as
> well.

should be covered by [PATCH 3/3 V2] time: update msecs_to_jiffies doc and move to kernel-doc

> 
> > +		return (m + (MSEC_PER_SEC / HZ) - 1) / (MSEC_PER_SEC / HZ);
> > +}
> > +#elif HZ > MSEC_PER_SEC && !(HZ % MSEC_PER_SEC)
> > +static inline unsigned long _msecs_to_jiffies(const unsigned int m)
> > +{
> > +		if (m > jiffies_to_msecs(MAX_JIFFY_OFFSET))
> > +			return MAX_JIFFY_OFFSET;
> > +		return m * (HZ / MSEC_PER_SEC);
> > +}
> > +#else
> > +static inline unsigned long _msecs_to_jiffies(const unsigned int m)
> > +{
> > +		if (HZ > MSEC_PER_SEC && m > jiffies_to_msecs(MAX_JIFFY_OFFSET))
> > +			return MAX_JIFFY_OFFSET;
> > +
> > +		return (MSEC_TO_HZ_MUL32 * m + MSEC_TO_HZ_ADJ32)
> > +			>> MSEC_TO_HZ_SHR32;
> > +}
> > +#endif
> > +static inline unsigned long msecs_to_jiffies(const unsigned int m)
> > +{
> > +	if (__builtin_constant_p(m)) {
> > +		if ((int)m < 0)
> > +			return MAX_JIFFY_OFFSET;
> > +		return _msecs_to_jiffies(m);
> > +	} else
> > +		return __msecs_to_jiffies(m);
> 
> It'd be nice to have this as two patches:
> 
> 1) Factor out the code into inline helpers w/o adding anything
> 
> 2) Add the __builtin_constant_p() check
>

so basically 1) is refactoring only and 2) is the actual
change keept at a minimum or what is the intent of this split ?

will cleanup and resubmit - just waiting for some feedback on
the Kbuild change.

thx!
hofrat 
--
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