[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190423193435.GX4038@hirez.programming.kicks-ass.net>
Date: Tue, 23 Apr 2019 21:34:35 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Waiman Long <longman@...hat.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
Ingo Molnar <mingo@...hat.com>,
Will Deacon <will.deacon@....com>,
Thomas Gleixner <tglx@...utronix.de>,
Linux List Kernel Mailing <linux-kernel@...r.kernel.org>,
the arch/x86 maintainers <x86@...nel.org>,
Davidlohr Bueso <dave@...olabs.net>,
Tim Chen <tim.c.chen@...ux.intel.com>,
huang ying <huang.ying.caritas@...il.com>
Subject: Re: [PATCH v4 14/16] locking/rwsem: Guard against making count
negative
On Tue, Apr 23, 2019 at 03:12:16PM -0400, Waiman Long wrote:
> On 4/23/19 12:27 PM, Linus Torvalds wrote:
> > On Tue, Apr 23, 2019 at 7:17 AM Peter Zijlstra <peterz@...radead.org> wrote:
> >> I'm not aware of an architecture where disabling interrupts is faster
> >> than disabling preemption.
> > I don't thin kit ever is, but I'd worry a bit about the
> > preempt_enable() just because it also checks if need_resched() is true
> > when re-enabling preemption.
> >
> > So doing preempt_enable() as part of rwsem_read_trylock() might cause
> > us to schedule in *exactly* the wrong place,
>
> You are right on that. However, there is a variant called
> preempt_enable_no_resched() that doesn't have this side effect. So I am
> going to use that one instead.
Only if the very next line is schedule(). Otherwise you're very much not
going to use that function.
Powered by blists - more mailing lists