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: <520A5EA5.8090301@zytor.com>
Date:	Tue, 13 Aug 2013 09:28:21 -0700
From:	"H. Peter Anvin" <hpa@...or.com>
To:	Ingo Molnar <mingo@...nel.org>
CC:	Linus Torvalds <torvalds@...ux-foundation.org>,
	Peter Zijlstra <peterz@...radead.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	Mike Galbraith <bitbucket@...ine.de>,
	Andi Kleen <ak@...ux.intel.com>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [RFC] per-cpu preempt_count

On 08/13/2013 08:56 AM, Ingo Molnar wrote:
> 
> * Linus Torvalds <torvalds@...ux-foundation.org> wrote:
> 
>> On Tue, Aug 13, 2013 at 5:26 AM, Peter Zijlstra <peterz@...radead.org> wrote:
>>>
>>> So we're now down to something like:
>>>
>>>   decl fs:preempt_count
>>>   cmpl PREEMPT_NEED_RESCHED,fs:preempt_count
>>>   jnz 1f
>>
>> Well, this isn't worth doing unless you can make PREEMPT_NEED_RESCHED be 
>> the high bit, and we can combine it into just "decl+jns". Otherwise we'd 
>> be better off with the simpler two separate adjacent variables.
> 
> Definitely, the cmpl should be avoided.
> 
> PREEMPT_NEED_RESCHED could be made the high bit - or maybe an even simpler 
> solution is to invert its meaning: making '0' the "it needs to resched!" 
> case, so the check would be decl+jz?
> 

That is pretty elegant.  A little more elegant in fact than my
suggestion to bias NEED_RESCHED by 0x7fffffff and test the overflow flag.

That way we also avoid going off to the slow path without the count
being zero, which although we already covered that it doesn't matter all
that much still is a nice bonus.

	-hpa

--
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