Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp4770250ybi; Tue, 30 Jul 2019 07:52:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqyM6lezJk6+ElxfL/QnIrubR3PlQVsfsOnwWV27A08Vlb8hh1j7mp/JJ8/nq3uMqNhwnkI2 X-Received: by 2002:a62:4d85:: with SMTP id a127mr16943838pfb.148.1564498349774; Tue, 30 Jul 2019 07:52:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564498349; cv=none; d=google.com; s=arc-20160816; b=cai/dd6ng+8+ZHYqmb0NYGUZR3O75oOM8XdWs3Kw2RzB/OuJU6hXPOmO2tKkDAcljo I6CYGAC37ZEhdup80SroBpj07yjI8iwuZ10PeZVcIvWga8zWct9Jwb5Le2Y9zdSKBQJa GURPNGBP/F5HqDjuQ8HyWahytJ06PViQBqln6BBoYbHa659oJdjCjVMqlDHkSfSAHR8Y CfyXFUxdniRBvfmCmaubyCPlN5keqSYTjilfVC/uIFu+vvN1+LLg7JBg9fLuYcTSTvUg Q0Yc04J2GRS1dd3hopRRIZPDz9ZBKRUCduerMHVevkU2kCmsv9QDdCzM/RR183s7nTMU mVeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=He46g3kl1/1+f74+KD+yC+jjKaZnawdh3B/wdfYNbj8=; b=dJG7ULXYiuzZzTSI+5MW/tBIefYBIvwR/llYEjeQngmFL96oWD1vNw036NB+3gpcoJ X3v27DRZU1ViYglgJh9cXWZkyLOmEdNf1EnEp7Ajk1cZvZ4IvAuaN8Wwd2XqR22t+8E2 2r/9iUdU1fdXdh6byJrYlEWaCzHDrsWJ/t2ZmW4rdBsf1t93+yPYLro89Sa0jYleTJVq jDaqxu1AwMg0dh+NMs4S4tBSpYSeBC+4HwS6gQExUZhqf3uRROA0e8gapkILSByFrwtI qTiXerwolaX1So4UCYDLBgfT6j8mbf/aTZtSBGy1Lmqi12JOMuIwLLh4L3QmuKHD+duY /VnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=NzOWXb0f; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x26si13837827pgl.351.2019.07.30.07.52.15; Tue, 30 Jul 2019 07:52:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=NzOWXb0f; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730499AbfG3IXV (ORCPT + 99 others); Tue, 30 Jul 2019 04:23:21 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:49650 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728901AbfG3IXU (ORCPT ); Tue, 30 Jul 2019 04:23:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=He46g3kl1/1+f74+KD+yC+jjKaZnawdh3B/wdfYNbj8=; b=NzOWXb0f5m8dKQbCqbMySPnBq uLhqkEdK8OOdPIsk6kG4QVH++UodNpFAwa8OjrmlafwmYcWrNsHtBBDFAGrkfZi1/bvnGuQg5EUx3 VMEGkXzsUBVcYymFWu7dJcqcrxfDZlLOf3qBKaAV05z+Go8GTyqBlgVzXi9qdBfTqhNnbIjxJ6Bvu 8M7WuJyYUWtJUbAxKjMQcUJQvDaHMEE/8/BYzFuYX1Am1IIF6oHcDBJltUVb1gLRuEL/Au1a6YyPU WXt2mdCJWER/TrLuTJSNNqDiBUiH4DE3edwA/P/3Q1vwPoscAJjiSLfL+IVnFN8pOJHqPzvW+p4Zk MxuF3ONgg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1hsNPi-00089P-0A; Tue, 30 Jul 2019 08:23:18 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 6BC3120D27EAD; Tue, 30 Jul 2019 10:23:16 +0200 (CEST) Date: Tue, 30 Jul 2019 10:23:16 +0200 From: Peter Zijlstra To: Dietmar Eggemann Cc: luca abeni , Ingo Molnar , Juri Lelli , Daniel Bristot de Oliveira , Valentin Schneider , Qais Yousef , linux-kernel@vger.kernel.org Subject: Re: [PATCH 5/5] sched/deadline: Use return value of SCHED_WARN_ON() in bw accounting Message-ID: <20190730082316.GK31381@hirez.programming.kicks-ass.net> References: <20190726082756.5525-1-dietmar.eggemann@arm.com> <20190726082756.5525-6-dietmar.eggemann@arm.com> <20190726121819.32be6fb1@sweethome> <20190729165434.GO31398@hirez.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.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 29, 2019 at 05:59:04PM +0100, Dietmar Eggemann wrote: > On 7/29/19 5:54 PM, Peter Zijlstra wrote: > > On Fri, Jul 26, 2019 at 12:18:19PM +0200, luca abeni wrote: > >> Hi Dietmar, > >> > >> On Fri, 26 Jul 2019 09:27:56 +0100 > >> Dietmar Eggemann wrote: > >> > >>> To make the decision whether to set rq or running bw to 0 in underflow > >>> case use the return value of SCHED_WARN_ON() rather than an extra if > >>> condition. > >> > >> I think I tried this at some point, but if I remember well this > >> solution does not work correctly when SCHED_DEBUG is not enabled. > > > > Well, it 'works' in so far that it compiles. But it might not be what > > one expects. That is, for !SCHED_DEBUG the return value is an > > unconditional false. > > > > In this case I think that's fine, the WARN _should_ not be happending. > > But there is commit 6d3aed3d ("sched/debug: Fix SCHED_WARN_ON() to > return a value on !CONFIG_SCHED_DEBUG as well")? > > But it doesn't work with !CONFIG_SCHED_DEBUG > > What compiles and work is (at least on Arm64). > > diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h > index 4012f98b9d26..494a767a4091 100644 > --- a/kernel/sched/sched.h > +++ b/kernel/sched/sched.h > @@ -78,7 +78,7 @@ > #ifdef CONFIG_SCHED_DEBUG > # define SCHED_WARN_ON(x) WARN_ONCE(x, #x) > #else > -# define SCHED_WARN_ON(x) ({ (void)(x), 0; }) > +# define SCHED_WARN_ON(x) ({ (void)(x), x; }) Why doesn't the ,0 compile? That should work just fine. The thing is, the two existing users: kernel/sched/fair.c: if (SCHED_WARN_ON(!se->on_rq)) kernel/sched/fair.c: if (SCHED_WARN_ON(!se->on_rq)) seem to compile just fine with it.