From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964910AbbI2MBO (ORCPT ); Tue, 29 Sep 2015 08:01:14 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:53227 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964878AbbI2MBI (ORCPT ); Tue, 29 Sep 2015 08:01:08 -0400 Date: Tue, 29 Sep 2015 13:55:39 +0200 From: Peter Zijlstra To: Linus Torvalds Cc: Ingo Molnar , Linux Kernel Mailing List , =?iso-8859-1?Q?Fr=E9d=E9ric?= Weisbecker , Oleg Nesterov , Mike Galbraith , Thomas Gleixner , Steven Rostedt Subject: Re: [RFC][PATCH v2 12/11] sched: Add preempt_count invariant check Message-ID: <20150929115539.GE3816@twins.programming.kicks-ass.net> References: <20150929092825.540553633@infradead.org> <20150929102755.GD3816@twins.programming.kicks-ass.net> <20150929105603.GG11639@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2012-12-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 29, 2015 at 07:55:49AM -0400, Linus Torvalds wrote: > On Tue, Sep 29, 2015 at 6:56 AM, Peter Zijlstra wrote: > > > > + * Initial preempt_count value; reflects the preempt_count schedule invariant > > + * which states that during schedule preempt_count() == 2. > > Is this actually *true*? > > preempt_count() is two only if preemption is enabled. But spinlocks do > not actually update the preemption count if there is no preemption, so > these kinds of checks and comments that aren't even inside #ifdef > CONFIG_PREEMPT seem to be actively misleading. > > I do believe that the preempt count is stable - but the actual value > would seem to depend on config options. Right, 2*PREEMPT_DISABLE_OFFSET is the 'right' number. That ends up being 0 for !PREEMPT_COUNT configs. I'll update the Changelog to be more accurate on this.