All of lore.kernel.org
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: Ingo Molnar <mingo@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Mike Galbraith <bitbucket@online.de>,
	Andi Kleen <ak@linux.intel.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [RFC] per-cpu preempt_count
Date: Tue, 13 Aug 2013 09:28:21 -0700	[thread overview]
Message-ID: <520A5EA5.8090301@zytor.com> (raw)
In-Reply-To: <20130813155637.GA5280@gmail.com>

On 08/13/2013 08:56 AM, Ingo Molnar wrote:
> 
> * Linus Torvalds <torvalds@linux-foundation.org> wrote:
> 
>> On Tue, Aug 13, 2013 at 5:26 AM, Peter Zijlstra <peterz@infradead.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


  parent reply	other threads:[~2013-08-13 16:29 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-12 11:51 [RFC] per-cpu preempt_count Peter Zijlstra
2013-08-12 17:35 ` Linus Torvalds
2013-08-12 17:51   ` H. Peter Anvin
2013-08-12 18:53     ` Linus Torvalds
2013-08-13  8:39       ` Peter Zijlstra
2013-08-12 17:58   ` Ingo Molnar
2013-08-12 19:00     ` Linus Torvalds
2013-08-12 20:44       ` H. Peter Anvin
2013-08-13 10:30       ` Ingo Molnar
2013-08-13 12:26         ` Peter Zijlstra
2013-08-13 15:39           ` Linus Torvalds
2013-08-13 15:56             ` Ingo Molnar
2013-08-13 16:26               ` Peter Zijlstra
2013-08-13 16:28               ` H. Peter Anvin [this message]
2013-08-13 16:29             ` Peter Zijlstra
2013-08-13 16:38               ` Linus Torvalds
2013-08-18 17:57   ` Paul E. McKenney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=520A5EA5.8090301@zytor.com \
    --to=hpa@zytor.com \
    --cc=ak@linux.intel.com \
    --cc=bitbucket@online.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.