Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2331716imm; Fri, 7 Sep 2018 14:49:25 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYVcrx3RBaYRyoGUgvuvV/aVb+hKltG0ULCyvMd4BMkicaPTcD22kK7bluiVgGkgQrRvy9Z X-Received: by 2002:a17:902:e088:: with SMTP id cb8-v6mr10033386plb.189.1536356965180; Fri, 07 Sep 2018 14:49:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536356965; cv=none; d=google.com; s=arc-20160816; b=MHEzRJn2uygMY4cJWVRqgU929GFtGozbweWG4yKjpTL/tn5/wDabGgQISpVE52/d9+ ipf8mPr94/GoCf5p0L0yjVFZ87qjx0CAD/lVgtmRjgIVes9R2MbhUOKOPhMifnFWmBOp YFmsNG830NaarYttyLV4Q/I7AfKNG2uBt4yTeHOFOjYH2ziPWLxGZqZes4yQPIi2m7v/ 3KDjBKE0PTmjzJXfnYkgY0ZaY5q46ZFZnglXIxAo7jwaS6ZcNv0xWLcmp0hSLtKt2gSP y3ywHRoYtYpMQoXbZDG1RGNuoC24fRZbbgp9TKc15UhlEBXF7D0fRFhi1OnhpE46zlI1 NtVQ== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=fMzps2uRqzz58I2miAAfrusRjUa8pr6F+7xe2ISsdoc=; b=XvIVt2314KVyokTSei8CZG13C9C94ZupJqULJcSocdvvkSXBmhl4dqPAyt4muAo0u6 /Cug0FICRMV/s/HF0lI1R/kS1C+vX+dEKWveJOlti/yMlMteqPKjv/hc1w9F67GGH2Ta CG7WdQseqnW7qpBhiTROPI+qfmXiqjF6MlOX/ca1l5tm045CI5X3hzpgXKQWa6vTbBMP KwDtQp016eNEbjD5en+9c70NKWxxOvFaopzlmOT5VtNueh2vj7Zyt7tceb02nA/Gaum9 lx5q7+EYvNmogB0W8f7nOvRrLsKtAO3eKAC2YYzw5QETF4HIGPWBmeADeze4qzBiJfZd EOUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.de header.s=amazon201209 header.b=bKUl83Yq; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g21-v6si10050067pgk.232.2018.09.07.14.49.09; Fri, 07 Sep 2018 14:49: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; dkim=pass header.i=@amazon.de header.s=amazon201209 header.b=bKUl83Yq; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731202AbeIHC3A (ORCPT + 99 others); Fri, 7 Sep 2018 22:29:00 -0400 Received: from smtp-fw-33001.amazon.com ([207.171.190.10]:32030 "EHLO smtp-fw-33001.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728133AbeIHC3A (ORCPT ); Fri, 7 Sep 2018 22:29:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.de; i=@amazon.de; q=dns/txt; s=amazon201209; t=1536356764; x=1567892764; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=fMzps2uRqzz58I2miAAfrusRjUa8pr6F+7xe2ISsdoc=; b=bKUl83YqFfWVBdxAWdK0sqb1zaZ78wQjvIo1cubh3deRIXY3JDH2CCdg Zi+rI7gi98OCpwycwaeIT/ixdTfIOCpOrxG5YuyHhUzj18cKBI0WLdDpC RmdET/9ceZvFmlizdFzl85SGodT7gWX871gOtBsSIKEeiy51mDJgcVRaW A=; X-IronPort-AV: E=Sophos;i="5.53,343,1531785600"; d="scan'208";a="752286766" Received: from sea3-co-svc-lb6-vlan2.sea.amazon.com (HELO email-inbound-relay-1a-7d76a15f.us-east-1.amazon.com) ([10.47.22.34]) by smtp-border-fw-out-33001.sea14.amazon.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 07 Sep 2018 21:43:33 +0000 Received: from u7588a65da6b65f.ant.amazon.com (iad7-ws-svc-lb50-vlan2.amazon.com [10.0.93.210]) by email-inbound-relay-1a-7d76a15f.us-east-1.amazon.com (8.14.7/8.14.7) with ESMTP id w87LfmcA115551 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Fri, 7 Sep 2018 21:41:51 GMT Received: from u7588a65da6b65f.ant.amazon.com (localhost [127.0.0.1]) by u7588a65da6b65f.ant.amazon.com (8.15.2/8.15.2/Debian-3) with ESMTPS id w87LflGS027304 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 7 Sep 2018 23:41:47 +0200 Received: (from jschoenh@localhost) by u7588a65da6b65f.ant.amazon.com (8.15.2/8.15.2/Submit) id w87LfkUA027300; Fri, 7 Sep 2018 23:41:46 +0200 From: =?UTF-8?q?Jan=20H=2E=20Sch=C3=B6nherr?= To: Ingo Molnar , Peter Zijlstra Cc: =?UTF-8?q?Jan=20H=2E=20Sch=C3=B6nherr?= , linux-kernel@vger.kernel.org Subject: [RFC 18/60] sched: Fix return value of SCHED_WARN_ON() Date: Fri, 7 Sep 2018 23:40:05 +0200 Message-Id: <20180907214047.26914-19-jschoenh@amazon.de> X-Mailer: git-send-email 2.9.3.1.gcba166c.dirty In-Reply-To: <20180907214047.26914-1-jschoenh@amazon.de> References: <20180907214047.26914-1-jschoenh@amazon.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org SCHED_WARN_ON() is conditionally compiled depending on CONFIG_SCHED_DEBUG. WARN_ON() and variants can be used in if() statements to take an action in the unlikely case that the WARN_ON condition is true. This is supposed to work independently of whether the warning is actually printed. However, without CONFIG_SCHED_DEBUG, SCHED_WARN_ON() evaluates to false unconditionally. Change SCHED_WARN_ON() to not discard the WARN_ON condition, even without CONFIG_SCHED_DEBUG, so that it can be used within if() statements as expected. Signed-off-by: Jan H. Schönherr --- kernel/sched/sched.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 9ecbb57049a2..3e0ad36938fb 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -76,7 +76,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) ({ unlikely(!!(x)); }) #endif struct rq; -- 2.9.3.1.gcba166c.dirty