From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932068AbbBBRaD (ORCPT ); Mon, 2 Feb 2015 12:30:03 -0500 Received: from mail-we0-f174.google.com ([74.125.82.174]:42794 "EHLO mail-we0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751753AbbBBRaA (ORCPT ); Mon, 2 Feb 2015 12:30:00 -0500 Date: Mon, 2 Feb 2015 18:29:53 +0100 From: Frederic Weisbecker To: Peter Zijlstra Cc: Ingo Molnar , LKML , Steven Rostedt , Linus Torvalds Subject: Re: [RFC PATCH 4/4] sched: Account PREEMPT_ACTIVE context as atomic Message-ID: <20150202172950.GC11054@lerouge> References: <1422404652-29067-1-git-send-email-fweisbec@gmail.com> <1422404652-29067-5-git-send-email-fweisbec@gmail.com> <20150128154637.GI23038@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150128154637.GI23038@twins.programming.kicks-ass.net> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 28, 2015 at 04:46:37PM +0100, Peter Zijlstra wrote: > On Wed, Jan 28, 2015 at 01:24:12AM +0100, Frederic Weisbecker wrote: > > PREEMPT_ACTIVE implies non-preemptible context and thus atomic context > > despite what in_atomic*() APIs reports about it. These functions > > shouldn't ignore this value like they are currently doing. > > > > It appears that these APIs were ignoring PREEMPT_ACTIVE in order to > > ease the check in schedule_debug(). Meanwhile it is sufficient to rely > > on PREEMPT_ACTIVE in order to disable preemption in __schedule(). > > > > So lets fix the in_atomic*() APIs and simplify the preempt count ops > > on __schedule() callers. > > So what I think the history is here is that PREEMPT_ACTIVE is/was seen > as a flag, protecting recursion, not so much a preempt-disable. > > By doing this, you loose that separation. Indeed, preemption disablement is a side effet. > > Note that (at least on x86) we have another flag in the preempt count. > > And I don't think the generated code really changes, the only difference > is the value added/subtracted and that's an encoded immediate I think. Right the resulting code isn't optimized at all with this patch. Only the C code was deemed to be more simple but actually it isn't since we are abusing a side effect property. I'm dropping this patch then. Thanks.