Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752432AbcLFOBl (ORCPT ); Tue, 6 Dec 2016 09:01:41 -0500 Received: from mail-wm0-f66.google.com ([74.125.82.66]:35432 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751581AbcLFOBj (ORCPT ); Tue, 6 Dec 2016 09:01:39 -0500 Date: Tue, 6 Dec 2016 14:47:47 +0100 From: luca abeni To: Peter Zijlstra Cc: Steven Rostedt , Daniel Bristot de Oliveira , linux-kernel@vger.kernel.org, Ingo Molnar , Juri Lelli , Claudio Scordino Subject: Re: [RFC v3 1/6] Track the active utilisation Message-ID: <20161206144747.45e2d4ba@sweethome> In-Reply-To: <20161206083501.GW3092@twins.programming.kicks-ass.net> References: <1477317998-7487-1-git-send-email-luca.abeni@unitn.it> <1477317998-7487-2-git-send-email-luca.abeni@unitn.it> <20161025112916.67eb245c@utopia> <20161025095811.50a5856a@gandalf.local.home> <20161118142359.GK3142@twins.programming.kicks-ass.net> <20161205233005.54275bd6@sweethome> <20161206083501.GW3092@twins.programming.kicks-ass.net> Organization: university of trento X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mail.home.local id uB6E1m9X026436 Content-Length: 1852 Lines: 63 Hi Peter, On Tue, 6 Dec 2016 09:35:01 +0100 Peter Zijlstra wrote: [...] > > This is because of the definition used when CONFIG_SCHED_DEBUG is > > not defined (I noticed the issue when testing with random kernel > > configurations). > > I'm fine changing the definition, just find something that works. The > current ((void)(x)) thing was to avoid unused complaints -- although > I'm not sure there were any. Below is what I came up with... It fixes the build, and seems to work fine generating no warnings (I tested with gcc 5.4.0). To write this patch, I re-used some code from include/asm-generic/bug.h, that has no copyright header, so I just added my signed-off-by (but I am not sure if this is the correct way to go). Luca >From 74e67d61c4b98c2498880932b953c65e9653c121 Mon Sep 17 00:00:00 2001 From: Luca Abeni Date: Tue, 6 Dec 2016 10:02:28 +0100 Subject: [PATCH 7/7] sched.h: Improve SCHED_WARN_ON() when CONFIG_SCHED_DEBUG is not defined With the current definition of SCHED_WARN_ON(), something like if (SCHED_WARN_ON(condition)) ... fails with error: void value not ignored as it ought to be #define SCHED_WARN_ON(x) ((void)(x)) ^ This patch fixes the issue by using the same code used in WARN_ON() Signed-off-by: Luca Abeni --- kernel/sched/sched.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index ef4bdaa..2e96aa4 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -19,7 +19,10 @@ #ifdef CONFIG_SCHED_DEBUG #define SCHED_WARN_ON(x) WARN_ONCE(x, #x) #else -#define SCHED_WARN_ON(x) ((void)(x)) +#define SCHED_WARN_ON(x) ({ \ + int __ret_warn_on = !!(x); \ + unlikely(__ret_warn_on); \ +}) #endif struct rq; -- 2.7.4