On Mon, Aug 12, 2013 at 10:35:48AM -0700, Linus Torvalds wrote:
> On Mon, Aug 12, 2013 at 4:51 AM, Peter Zijlstra wrote:
> >
> > The below boots to wanting to mount a root filesystem with
> > CONFIG_PREEMPT=y using kvm -smp 4.
>
> But doesn't work in general? Or you just never tested?
>
> I thin
On Tue, Aug 13, 2013 at 9:29 AM, Peter Zijlstra wrote:
>
> The inverted need_resched that gives decl+jnz idea from Ingo should do
> it though.
I agree that that is a good approach.
> Not entirely sure I understand your MSB + jns suggestion:
>
> 0x8002 - 1 = 0x8001
>
> Both are very muc
On 08/13/2013 08:56 AM, Ingo Molnar wrote:
>
> * Linus Torvalds wrote:
>
>> On Tue, Aug 13, 2013 at 5:26 AM, Peter Zijlstra 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 wo
On Tue, Aug 13, 2013 at 08:39:46AM -0700, Linus Torvalds wrote:
> Also, I think your patch is too big, and you should have aim to just
> made the "preempt_count()" helper function mask off PREEMPT_MASK, so
> that you don't change the semantics of that. I realize that there are
> a couple of users t
On Tue, Aug 13, 2013 at 05:56:37PM +0200, Ingo Molnar wrote:
> 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?
Right, inverted NEED_RESCHED would work.
-
* Linus Torvalds wrote:
> On Tue, Aug 13, 2013 at 5:26 AM, Peter Zijlstra 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
On Tue, Aug 13, 2013 at 5:26 AM, Peter Zijlstra 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 j
On Tue, Aug 13, 2013 at 12:30:56PM +0200, Ingo Molnar wrote:
> But we could perhaps do something else and push the overhead into
> resched_task(): instead of using atomics we could use the resched IPI to
> set the local preempt_count(). That way preempt_count() will only ever be
> updated CPU-l
* Linus Torvalds wrote:
> On Mon, Aug 12, 2013 at 10:58 AM, Ingo Molnar wrote:
> >
> > We could still have the advantages of NEED_RESCHED in preempt_count() by
> > realizing that we only rarely actually set/clear need_resched and mostly
> > read it from the highest freq user, the preempt_enable
On Mon, Aug 12, 2013 at 11:53:25AM -0700, Linus Torvalds wrote:
> On Mon, Aug 12, 2013 at 10:51 AM, H. Peter Anvin wrote:
> >
> > So we would have code looking something like:
> >
> > decl %fs:preempt_count
> > jnz 1f
> > cmpb $0,%fs:need_resched
> > je 1f
> >
On 08/12/2013 12:00 PM, Linus Torvalds wrote:
>
> Wrong. The thing is, the common case for preempt is to increment and
> decrement the count, not testing it. Exactly because we do this for
> spinlocks and for rcu read-locked regions.
>
> Now, what we *could* do is to say:
>
> - we will use the
On Mon, Aug 12, 2013 at 10:58 AM, Ingo Molnar wrote:
>
> We could still have the advantages of NEED_RESCHED in preempt_count() by
> realizing that we only rarely actually set/clear need_resched and mostly
> read it from the highest freq user, the preempt_enable() check.
>
> So we could have it ato
On Mon, Aug 12, 2013 at 10:51 AM, H. Peter Anvin wrote:
>
> So we would have code looking something like:
>
> decl %fs:preempt_count
> jnz 1f
> cmpb $0,%fs:need_resched
> je 1f
> call __preempt_schedule
> 1:
>
> It's a nontrivial amount of code, but would se
* Linus Torvalds wrote:
> On Mon, Aug 12, 2013 at 4:51 AM, Peter Zijlstra wrote:
> >
> > The below boots to wanting to mount a root filesystem with
> > CONFIG_PREEMPT=y using kvm -smp 4.
>
> But doesn't work in general? Or you just never tested?
(I think Peter never tested it on real hw - thi
On 08/12/2013 10:35 AM, Linus Torvalds wrote:
>
> Agreed. Making it atomic would suck, and cancel all advantages of the
> better code generation to access it. Good point.
>
> And yeah, it could be two variables in the same cacheline or something.
>
So we would have code looking something like:
On Mon, Aug 12, 2013 at 4:51 AM, Peter Zijlstra wrote:
>
> The below boots to wanting to mount a root filesystem with
> CONFIG_PREEMPT=y using kvm -smp 4.
But doesn't work in general? Or you just never tested?
I think that "thread_info->preempt_count" variable would need to be
renamed to "saved_
16 matches
Mail list logo