[PATCH 14/89] sched/autogroup: Collect extern APIs into

Ingo Molnar
2017-02-06T13:56:03Z

Further reduce the size of sched.h.

Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
fs/proc/base.c | 1 +
include/linux/sched.h | 18 ------------------
include/linux/sched/autogroup.h | 25 +++++++++++++++++++++++++
kernel/exit.c | 1 +
kernel/fork.c | 1 +
kernel/sched/auto_group.h | 1 +
kernel/sys.c | 1 +
7 files changed, 30 insertions(+), 18 deletions(-)

diff --git a/fs/proc/base.c b/fs/proc/base.c
index b1f7d30e96c2..c5277d3cdacd 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -85,6 +85,7 @@
#include <linux/user_namespace.h>
#include <linux/fs_struct.h>
#include <linux/slab.h>
+#include <linux/sched/autogroup.h>
#include <linux/flex_array.h>
#include <linux/posix-timers.h>
#ifdef CONFIG_HARDWALL
diff --git a/include/linux/sched.h b/include/linux/sched.h
index c5c10a7ddbf1..3842a0d822a9 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -2101,24 +2101,6 @@ static inline void wake_up_nohz_cpu(int cpu) { }
extern u64 scheduler_tick_max_deferment(void);
#endif

-#ifdef CONFIG_SCHED_AUTOGROUP
-extern void sched_autogroup_create_attach(struct task_struct *p);
-extern void sched_autogroup_detach(struct task_struct *p);
-extern void sched_autogroup_fork(struct signal_struct *sig);
-extern void sched_autogroup_exit(struct signal_struct *sig);
-extern void sched_autogroup_exit_task(struct task_struct *p);
-#ifdef CONFIG_PROC_FS
-extern void proc_sched_autogroup_show_task(struct task_struct *p, struct seq_file *m);
-extern int proc_sched_autogroup_set_nice(struct task_struct *p, int nice);
-#endif
-#else
-static inline void sched_autogroup_create_attach(struct task_struct *p) { }
-static inline void sched_autogroup_detach(struct task_struct *p) { }
-static inline void sched_autogroup_fork(struct signal_struct *sig) { }
-static inline void sched_autogroup_exit(struct signal_struct *sig) { }
-static inline void sched_autogroup_exit_task(struct task_struct *p) { }
-#endif
-
extern int yield_to(struct task_struct *p, bool preempt);
extern void set_user_nice(struct task_struct *p, long nice);
extern int task_prio(const struct task_struct *p);
diff --git a/include/linux/sched/autogroup.h b/include/linux/sched/autogroup.h
new file mode 100644
index 000000000000..d4dc91da7479
--- /dev/null
+++ b/include/linux/sched/autogroup.h
@@ -0,0 +1,25 @@
+#ifndef _LINUX_SCHED_AUTOGROUP_H
+#define _LINUX_SCHED_AUTOGROUP_H
+
+struct signal_struct;
+struct seq_file;
+
+#ifdef CONFIG_SCHED_AUTOGROUP
+extern void sched_autogroup_create_attach(struct task_struct *p);
+extern void sched_autogroup_detach(struct task_struct *p);
+extern void sched_autogroup_fork(struct signal_struct *sig);
+extern void sched_autogroup_exit(struct signal_struct *sig);
+extern void sched_autogroup_exit_task(struct task_struct *p);
+#ifdef CONFIG_PROC_FS
+extern void proc_sched_autogroup_show_task(struct task_struct *p, struct seq_file *m);
+extern int proc_sched_autogroup_set_nice(struct task_struct *p, int nice);
+#endif
+#else
+static inline void sched_autogroup_create_attach(struct task_struct *p) { }
+static inline void sched_autogroup_detach(struct task_struct *p) { }
+static inline void sched_autogroup_fork(struct signal_struct *sig) { }
+static inline void sched_autogroup_exit(struct signal_struct *sig) { }
+static inline void sched_autogroup_exit_task(struct task_struct *p) { }
+#endif
+
+#endif /* _LINUX_SCHED_AUTOGROUP_H */
diff --git a/kernel/exit.c b/kernel/exit.c
index b67c57faa705..4c9bc6e90a45 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -6,6 +6,7 @@

#include <linux/mm.h>
#include <linux/slab.h>
+#include <linux/sched/autogroup.h>
#include <linux/interrupt.h>
#include <linux/module.h>
#include <linux/capability.h>
diff --git a/kernel/fork.c b/kernel/fork.c
index 9aa2ca28a76c..56f281adaa0e 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -12,6 +12,7 @@
*/

#include <linux/slab.h>
+#include <linux/sched/autogroup.h>
#include <linux/init.h>
#include <linux/unistd.h>
#include <linux/module.h>
diff --git a/kernel/sched/auto_group.h b/kernel/sched/auto_group.h
index 890c95f2587a..ce40c810cd5c 100644
--- a/kernel/sched/auto_group.h
+++ b/kernel/sched/auto_group.h
@@ -2,6 +2,7 @@

#include <linux/kref.h>
#include <linux/rwsem.h>
+#include <linux/sched/autogroup.h>

struct autogroup {
/*
diff --git a/kernel/sys.c b/kernel/sys.c
index 47151c604f0a..b548eb9c4d1a 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -49,6 +49,7 @@
#include <linux/binfmts.h>

#include <linux/sched.h>
+#include <linux/sched/autogroup.h>
#include <linux/sched/loadavg.h>
#include <linux/rcupdate.h>
#include <linux/uidgid.h>
--
2.7.4