[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1353302917-13995-58-git-send-email-josh@joshtriplett.org>
Date: Sun, 18 Nov 2012 21:28:36 -0800
From: Josh Triplett <josh@...htriplett.org>
To: Linus Torvalds <torvalds@...ux-foundation.org>,
Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
linux-kernel@...r.kernel.org
Cc: Josh Triplett <josh@...htriplett.org>
Subject: [PATCH 57/58] sched: Move stubs for CONFIG_FAIR_GROUP_SCHED=n to sched.h
kernel/sched/fair.c defines stub versions of free_fair_sched_group,
alloc_fair_sched_group, and unregister_fair_sched_group, for use when
CONFIG_FAIR_GROUP_SCHED=n. However, sched.h only declares the
prototypes of those functions when CONFIG_CGROUP_SCHED=y, since the
scheduler core only calls those functions when CONFIG_CGROUP_SCHED=y.
Rather than complicating the ifdef logic around the stub functions to
only define them in that case, move the empty stubs to sched.h as static
inlines, only defined when needed. That allows the compiler to throw
away the calls entirely rather than calling empty stubs, and also
satisfies GCC (-Wmissing-prototypes) and Sparse (-Wdecl).
kernel/sched/fair.c:5277:6: warning: no previous prototype for ‘free_fair_sched_group’ [-Wmissing-prototypes]
kernel/sched/fair.c:5279:5: warning: no previous prototype for ‘alloc_fair_sched_group’ [-Wmissing-prototypes]
kernel/sched/fair.c:5284:6: warning: no previous prototype for ‘unregister_fair_sched_group’ [-Wmissing-prototypes]
Signed-off-by: Josh Triplett <josh@...htriplett.org>
---
kernel/sched/fair.c | 11 -----------
kernel/sched/sched.h | 13 +++++++++++++
2 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 0f03bf1..971657f 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -5272,17 +5272,6 @@ done:
mutex_unlock(&shares_mutex);
return 0;
}
-#else /* CONFIG_FAIR_GROUP_SCHED */
-
-void free_fair_sched_group(struct task_group *tg) { }
-
-int alloc_fair_sched_group(struct task_group *tg, struct task_group *parent)
-{
- return 1;
-}
-
-void unregister_fair_sched_group(struct task_group *tg, int cpu) { }
-
#endif /* CONFIG_FAIR_GROUP_SCHED */
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index 7a7db09..fc5b8b8 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -173,9 +173,22 @@ static inline int walk_tg_tree(tg_visitor down, tg_visitor up, void *data)
extern int tg_nop(struct task_group *tg, void *data);
+#ifdef CONFIG_FAIR_GROUP_SCHED
extern void free_fair_sched_group(struct task_group *tg);
extern int alloc_fair_sched_group(struct task_group *tg, struct task_group *parent);
extern void unregister_fair_sched_group(struct task_group *tg, int cpu);
+#else
+static inline void free_fair_sched_group(struct task_group *tg) { }
+
+static inline int alloc_fair_sched_group(struct task_group *tg,
+ struct task_group *parent)
+{
+ return 1;
+}
+
+static inline void unregister_fair_sched_group(struct task_group *tg, int cpu) { }
+#endif
+
extern void init_tg_cfs_entry(struct task_group *tg, struct cfs_rq *cfs_rq,
struct sched_entity *se, int cpu,
struct sched_entity *parent);
--
1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists