Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3650320ybi; Mon, 29 Jul 2019 10:07:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqyIIY6jquGOsucsgUqFGhgxXo22pWpKAiKLyVI8NK/3Che7MU7Vy9D6U7Fley6SpXFZVM/V X-Received: by 2002:a65:5082:: with SMTP id r2mr78952263pgp.170.1564420045517; Mon, 29 Jul 2019 10:07:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564420045; cv=none; d=google.com; s=arc-20160816; b=d5kSYAy3IYSLkjMaXwnEC9HkQRvJ2Wh60NlsbvUuBbUVVGSI2JEUWRE98hIZe+AcVr lDbtUKH/CaDwm5gBo7FWBnJyQDsR50pf5iujLf1RpVfzicZhJDdLn6zg9wjss9UcHXgp 6R61m61PmRObywCz9y0egJHVYDUDmTlflm/Ofkb//BnG31qYKAl9ViDuaATbZo/Scc2L 4EFfjoEmpg9maxI6T5ByMV3qC/LS0wuZJFUuD3T510lneb7KDlCcdiakLvvdPGN27oab 80r5fgxcnDsHNxwHK9vN8485/EmoUTTvJiD40GvI3V9uvJ6SsubmIQKpPuTjLEnH4RHv mjmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=JWH9FU6h2wQx+u5YYVF93SkK5yoQX7/d4/XJ1mCwTxc=; b=G2Oc+rRbWzEYUzEAGya1W1bOElV5X4B3cFmfpMYU8aSw0gx8cNpEO06mTOdR01kEzy mD4/KXS7+EU8vpbt3i3OWjCBZfRYDY9fIOK+Ub9wFxQB35TB+GvQFev00Vqd2+K2vLeh FolxEoI1YR6AojLV5WohGR+C0hExGnlSMYJ6/v2PN5XfhV+Tj89HdIc8sP0JZL/QWuqC FEEn8dBDMABRWaSmK35jAzNHJbgepk505t9tMHD/VLjbw2FhKwsbhAAqj9g17oDOu+qN pEE4lhSIrSRFSaJ7eQaVqDNVAuGzO0Yr8vHSGIJFiZd50xRZeYgAlYbui4OKhhCOGuYt KdDw== ARC-Authentication-Results: i=1; mx.google.com; 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 a65si1753530pgc.213.2019.07.29.10.07.10; Mon, 29 Jul 2019 10:07:25 -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; 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 S1728152AbfG2Q7L (ORCPT + 99 others); Mon, 29 Jul 2019 12:59:11 -0400 Received: from foss.arm.com ([217.140.110.172]:47964 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726845AbfG2Q7K (ORCPT ); Mon, 29 Jul 2019 12:59:10 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0A3F3337; Mon, 29 Jul 2019 09:59:08 -0700 (PDT) Received: from [10.1.32.39] (unknown [10.1.32.39]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id EFBDD3F694; Mon, 29 Jul 2019 09:59:06 -0700 (PDT) Subject: Re: [PATCH 5/5] sched/deadline: Use return value of SCHED_WARN_ON() in bw accounting To: Peter Zijlstra , luca abeni Cc: Ingo Molnar , Juri Lelli , Daniel Bristot de Oliveira , Valentin Schneider , Qais Yousef , linux-kernel@vger.kernel.org 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> From: Dietmar Eggemann Message-ID: Date: Mon, 29 Jul 2019 17:59:04 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190729165434.GO31398@hirez.programming.kicks-ass.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; })