Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1536992
| From | luca abeni <luca.abeni@unitn.it> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [RFC v3 1/6] Track the active utilisation |
| Date | 2016-12-06 15:10 +0100 |
| Message-ID | <sLoBr-335-3@gated-at.bofh.it> (permalink) |
| References | (3 earlier) <sw6dr-3Ia-17@gated-at.bofh.it> <swaqJ-6ln-21@gated-at.bofh.it> <sESkX-8jW-53@gated-at.bofh.it> <sLa5s-244-23@gated-at.bofh.it> <sLjs5-87p-13@gated-at.bofh.it> |
| Organization | university of trento |
Hi Peter,
On Tue, 6 Dec 2016 09:35:01 +0100
Peter Zijlstra <peterz@infradead.org> 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 <luca.abeni@unitn.it>
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 <luca.abeni@unitn.it>
---
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
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
Re: [RFC v3 1/6] Track the active utilisation luca abeni <luca.abeni@unitn.it> - 2016-12-05 23:40 +0100
Re: [RFC v3 1/6] Track the active utilisation Peter Zijlstra <peterz@infradead.org> - 2016-12-06 09:40 +0100
Re: [RFC v3 1/6] Track the active utilisation luca abeni <luca.abeni@unitn.it> - 2016-12-06 10:00 +0100
Re: [RFC v3 1/6] Track the active utilisation luca abeni <luca.abeni@unitn.it> - 2016-12-06 15:10 +0100
csiph-web