Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2770375pxk; Tue, 15 Sep 2020 01:41:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx44ZxUSMZbMhFfwaLFnKP4ckks77ieB/8e/dazuxvZEtbFSPz8ElZfxt+c4mG4WHW97PnH X-Received: by 2002:a05:6402:1fb:: with SMTP id i27mr22016346edy.379.1600159295226; Tue, 15 Sep 2020 01:41:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600159295; cv=none; d=google.com; s=arc-20160816; b=dxCdZ4j9EZOEyAnuIbyB0aEcYfsvNfHZFIlf56qjAX1vzisPAmK46Is1K+DnxR36RX 0aLEhN/mv4WM6iTTT+5jEOZyfNaJyIpLalfl/TLr9ZPczcP5TVQyAMGyCzYrUI9vPp9d Pmj1xDSCN5lo+5MrjiG1B6/StWiuh5WY/7JFODLo6cstZOZYz8eqWZvc0bZhrDi5F1eo egucAWQu12lcSjTBJxGknrJ3fVNxGv/LsN58PLUenwXGWGOskwqgnoc/YD9gASb/FxLJ JTYkYOsECivy4r5uhhqcq8Z58hQHmlSFHE2ayE/g53Y5Ij09gPpZxVNMq4c6qX6TvMQh cqRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=a15vj77Xa9KXo3Ek21dMycAwDWIIiMUe5bjhvVzzjCs=; b=oRB64UUtoEUfGgjKqw9hIS4TYtp6dChdR05xCWJWhSXzc1osiN2vtzgGhR66rbp9DL U6Dg4vPQwSj4Hi7qW+QGULivoZV/hh4CdWDgoGia7WEepyb1NDnh/KUllHhTWRZJZXp7 Ftjkq+GATmsgBItJn+cXHjM3LumV+VZRKduGgVQjkY7zbO4N+FPQHrEBCDsAyvHqLbd0 bNIeyhsAmegiJ7oI8vjNDTdqa6b/8kOya3GjAfADT3tyU0S/lV3DlzQ4n6wWt5zaHJUS aQc+TeWqotx1PJ1wZY2PwqUxjl+Bt+GwBqStvASTGC5iqSJVY9OjNmMNxhJjiRjS9ACM WpyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=4ZO6BoNl; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r17si8761760ejz.238.2020.09.15.01.41.12; Tue, 15 Sep 2020 01:41:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=4ZO6BoNl; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726222AbgIOIj4 (ORCPT + 99 others); Tue, 15 Sep 2020 04:39:56 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:40486 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726161AbgIOIjx (ORCPT ); Tue, 15 Sep 2020 04:39:53 -0400 From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1600159189; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=a15vj77Xa9KXo3Ek21dMycAwDWIIiMUe5bjhvVzzjCs=; b=4ZO6BoNleN8HQgP0z8q+4JbOh4PFsXqPl2O1VMMFsqMl6Je+Vd4svU6GjBOnz4JBLm59ef n28q3APVdlSA6QtUBbVtHjAsCDNA9DMNxmpB3Xs8JDO2mhj9om6HKXu9jHt5uTY4drNVe+ Xi88yb65/jAIcWHRrtrHzz6pJv5CkGBo0rMdCdV0m6UGwcjwsaPqQyFAYyPj9eb+iOpbLb OyGnJVFkDuM2Xw/Zd91HZnJtSCpZf4n90+HYVnsyWEI2CIiSdIZikeb1E30oqvvQPgJtwy 7GKY8eCHlWViBl9/zu9LXs5HqsgBdJJ10OMSGETAETJYeANond9fGhpnX7IhVQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1600159189; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=a15vj77Xa9KXo3Ek21dMycAwDWIIiMUe5bjhvVzzjCs=; b=8ik3d8quF/oYipmw+L5R6EnAKiYsBpkerr1Z3ToGRa9dHoJtFKl9KfoiSlZU5EwJHOK7Qp VqVAEKjJfZ9P9ICw== To: Linus Torvalds , Ard Biesheuvel , Herbert Xu Cc: LKML , linux-arch , Sebastian Andrzej Siewior , Valentin Schneider , Richard Henderson , Ivan Kokshaysky , Matt Turner , alpha , Jeff Dike , Richard Weinberger , Anton Ivanov , linux-um , Brian Cain , linux-hexagon@vger.kernel.org, Geert Uytterhoeven , linux-m68k , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Will Deacon , Andrew Morton , Linux-MM , Ingo Molnar , Russell King , Linux ARM , Chris Zankel , Max Filippov , linux-xtensa@linux-xtensa.org, Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , David Airlie , Daniel Vetter , intel-gfx , dri-devel , "Paul E. McKenney" , Josh Triplett , Mathieu Desnoyers , Lai Jiangshan , Shuah Khan , rcu@vger.kernel.org, "open list\:KERNEL SELFTEST FRAMEWORK" Subject: Re: [patch 00/13] preempt: Make preempt count unconditional In-Reply-To: References: <20200914204209.256266093@linutronix.de> <871rj4owfn.fsf@nanos.tec.linutronix.de> Date: Tue, 15 Sep 2020 10:39:48 +0200 Message-ID: <87bli75t7v.fsf@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 14 2020 at 15:24, Linus Torvalds wrote: > On Mon, Sep 14, 2020 at 2:55 PM Thomas Gleixner wrote: >> >> Yes it does generate better code, but I tried hard to spot a difference >> in various metrics exposed by perf. It's all in the noise and I only >> can spot a difference when the actual preemption check after the >> decrement > > I'm somewhat more worried about the small-device case. I just checked on one of my old UP ARM toys which I run at home. The .text increase is about 2% (75k) and none of the tests I ran showed any significant difference. Couldn't verify with perf though as the PMU on that piece of art is unusable. > That said, the diffstat certainly has its very clear charm, and I do > agree that it makes things simpler. > > I'm just not convinced people should ever EVER do things like that "if > (preemptible())" garbage. It sounds like somebody is doing seriously > bad things. OTOH, having a working 'preemptible()' or maybe better named 'can_schedule()' check makes tons of sense to make decisions about allocation modes or other things. We're currently looking through all of in_atomic(), in_interrupt() etc. usage sites and quite some of them are historic and have the clear intent of checking whether the code is called from task context or hard/softirq context. Lots of them are completely broken or just work by chance. But there is clearly historic precendence that context checks are useful, but they only can be useful if we have a consistent mechanism which works everywhere. Of course we could mandate that every interface which might be called from one or the other context has a context argument or provides two variants of the same thing. But I'm not really convinced whether that's a win over having a consistent and reliable set of checks. Thanks, tglx