public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sched: fix an unused function "node_cpu" warning
@ 2019-09-17 14:34 Qian Cai
  2019-09-18  8:59 ` Mel Gorman
  2019-09-18 10:43 ` [tip: sched/urgent] sched/core: Convert vcpu_is_preempted() from macro to an inline function tip-bot2 for Qian Cai
  0 siblings, 2 replies; 3+ messages in thread
From: Qian Cai @ 2019-09-17 14:34 UTC (permalink / raw)
  To: mingo, peterz
  Cc: juri.lelli, vincent.guittot, dietmar.eggemann, rostedt, bsegall,
	mgorman, linux-kernel, Qian Cai

Clang reports a warning,

kernel/locking/osq_lock.c:25:19: warning: unused function 'node_cpu'
[-Wunused-function]

due to osq_lock() calls vcpu_is_preempted(node_cpu(node->prev))), but
vcpu_is_preempted() is compiled away. Fix it by converting the dummy
vcpu_is_preempted() from a macro to a proper static inline function.

Signed-off-by: Qian Cai <cai@lca.pw>
---
 include/linux/sched.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index f0edee94834a..e2e91960d79f 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1856,7 +1856,10 @@ static inline void set_task_cpu(struct task_struct *p, unsigned int cpu)
  * running or not.
  */
 #ifndef vcpu_is_preempted
-# define vcpu_is_preempted(cpu)	false
+static inline bool vcpu_is_preempted(int cpu)
+{
+	return false;
+}
 #endif
 
 extern long sched_setaffinity(pid_t pid, const struct cpumask *new_mask);
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] sched: fix an unused function "node_cpu" warning
  2019-09-17 14:34 [PATCH] sched: fix an unused function "node_cpu" warning Qian Cai
@ 2019-09-18  8:59 ` Mel Gorman
  2019-09-18 10:43 ` [tip: sched/urgent] sched/core: Convert vcpu_is_preempted() from macro to an inline function tip-bot2 for Qian Cai
  1 sibling, 0 replies; 3+ messages in thread
From: Mel Gorman @ 2019-09-18  8:59 UTC (permalink / raw)
  To: Qian Cai
  Cc: mingo, peterz, juri.lelli, vincent.guittot, dietmar.eggemann,
	rostedt, bsegall, linux-kernel

On Tue, Sep 17, 2019 at 10:34:54AM -0400, Qian Cai wrote:
> Clang reports a warning,
> 
> kernel/locking/osq_lock.c:25:19: warning: unused function 'node_cpu'
> [-Wunused-function]
> 
> due to osq_lock() calls vcpu_is_preempted(node_cpu(node->prev))), but
> vcpu_is_preempted() is compiled away. Fix it by converting the dummy
> vcpu_is_preempted() from a macro to a proper static inline function.
> 
> Signed-off-by: Qian Cai <cai@lca.pw>

Acked-by: Mel Gorman <mgorman@suse.de>

-- 
Mel Gorman
SUSE Labs

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [tip: sched/urgent] sched/core: Convert vcpu_is_preempted() from macro to an inline function
  2019-09-17 14:34 [PATCH] sched: fix an unused function "node_cpu" warning Qian Cai
  2019-09-18  8:59 ` Mel Gorman
@ 2019-09-18 10:43 ` tip-bot2 for Qian Cai
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot2 for Qian Cai @ 2019-09-18 10:43 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Qian Cai, Mel Gorman, Linus Torvalds, Peter Zijlstra,
	Thomas Gleixner, bsegall, dietmar.eggemann, juri.lelli, rostedt,
	vincent.guittot, Ingo Molnar, Borislav Petkov, linux-kernel

The following commit has been merged into the sched/urgent branch of tip:

Commit-ID:     42fd8baab31f53bed2952485fcf0e92f244c5e55
Gitweb:        https://git.kernel.org/tip/42fd8baab31f53bed2952485fcf0e92f244c5e55
Author:        Qian Cai <cai@lca.pw>
AuthorDate:    Tue, 17 Sep 2019 10:34:54 -04:00
Committer:     Ingo Molnar <mingo@kernel.org>
CommitterDate: Wed, 18 Sep 2019 12:38:17 +02:00

sched/core: Convert vcpu_is_preempted() from macro to an inline function

Clang reports this warning:

  kernel/locking/osq_lock.c:25:19: warning: unused function 'node_cpu' [-Wunused-function]

due to osq_lock() calling vcpu_is_preempted(node_cpu(node->prev))), but
vcpu_is_preempted() is compiled away. Fix it by converting the dummy
vcpu_is_preempted() from a macro to a proper static inline function.

Signed-off-by: Qian Cai <cai@lca.pw>
Acked-by: Mel Gorman <mgorman@suse.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: bsegall@google.com
Cc: dietmar.eggemann@arm.com
Cc: juri.lelli@redhat.com
Cc: rostedt@goodmis.org
Cc: vincent.guittot@linaro.org
Link: https://lkml.kernel.org/r/1568730894-10483-1-git-send-email-cai@lca.pw
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 include/linux/sched.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index f0edee9..e2e9196 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1856,7 +1856,10 @@ static inline void set_task_cpu(struct task_struct *p, unsigned int cpu)
  * running or not.
  */
 #ifndef vcpu_is_preempted
-# define vcpu_is_preempted(cpu)	false
+static inline bool vcpu_is_preempted(int cpu)
+{
+	return false;
+}
 #endif
 
 extern long sched_setaffinity(pid_t pid, const struct cpumask *new_mask);

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-09-18 10:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-09-17 14:34 [PATCH] sched: fix an unused function "node_cpu" warning Qian Cai
2019-09-18  8:59 ` Mel Gorman
2019-09-18 10:43 ` [tip: sched/urgent] sched/core: Convert vcpu_is_preempted() from macro to an inline function tip-bot2 for Qian Cai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox