* [PATCH 1/2] sched: move scheduler sysctl bits into dedicated header file
@ 2013-01-28 20:31 Clark Williams
2013-01-29 1:12 ` Li Zefan
2013-01-29 6:05 ` Namhyung Kim
0 siblings, 2 replies; 7+ messages in thread
From: Clark Williams @ 2013-01-28 20:31 UTC (permalink / raw)
To: Ingo Molnar
Cc: Peter Zijlstra, Thomas Gleixner, Ingo Molnar, Steven Rostedt,
LKML
[-- Attachment #1: Type: text/plain, Size: 9891 bytes --]
Move all the scheduler sysctl-related bits out of include/linux/sched.h
into a new file include/linux/sched_sysctl.h.
Signed-off-by: Clark Williams <williams@redhat.com>
---
include/linux/sched.h | 102 +-----------------------------------
include/linux/sched_sysctl.h | 121 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 122 insertions(+), 101 deletions(-)
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 924e42a..12e689e 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -51,6 +51,7 @@ struct sched_param {
#include <linux/cred.h>
#include <linux/llist.h>
#include <linux/uidgid.h>
+#include <linux/sched_sysctl.h>
#include <asm/processor.h>
@@ -304,19 +305,6 @@ static inline void lockup_detector_init(void)
}
#endif
-#ifdef CONFIG_DETECT_HUNG_TASK
-extern unsigned int sysctl_hung_task_panic;
-extern unsigned long sysctl_hung_task_check_count;
-extern unsigned long sysctl_hung_task_timeout_secs;
-extern unsigned long sysctl_hung_task_warnings;
-extern int proc_dohung_task_timeout_secs(struct ctl_table *table, int write,
- void __user *buffer,
- size_t *lenp, loff_t *ppos);
-#else
-/* Avoid need for ifdefs elsewhere in the code */
-enum { sysctl_hung_task_timeout_secs = 0 };
-#endif
-
/* Attach to any functions which should be ignored in wchan output. */
#define __sched __attribute__((__section__(".sched.text")))
@@ -338,23 +326,6 @@ extern int mutex_spin_on_owner(struct mutex *lock, struct task_struct *owner);
struct nsproxy;
struct user_namespace;
-/*
- * Default maximum number of active map areas, this limits the number of vmas
- * per mm struct. Users can overwrite this number by sysctl but there is a
- * problem.
- *
- * When a program's coredump is generated as ELF format, a section is created
- * per a vma. In ELF, the number of sections is represented in unsigned short.
- * This means the number of sections should be smaller than 65535 at coredump.
- * Because the kernel adds some informative sections to a image of program at
- * generating coredump, we need some margin. The number of extra sections is
- * 1-3 now and depends on arch. We use "5" as safe margin, here.
- */
-#define MAPCOUNT_ELF_CORE_MARGIN (5)
-#define DEFAULT_MAX_MAP_COUNT (USHRT_MAX - MAPCOUNT_ELF_CORE_MARGIN)
-
-extern int sysctl_max_map_count;
-
#include <linux/aio.h>
#ifdef CONFIG_MMU
@@ -2034,77 +2005,6 @@ extern void wake_up_idle_cpu(int cpu);
static inline void wake_up_idle_cpu(int cpu) { }
#endif
-extern unsigned int sysctl_sched_latency;
-extern unsigned int sysctl_sched_min_granularity;
-extern unsigned int sysctl_sched_wakeup_granularity;
-extern unsigned int sysctl_sched_child_runs_first;
-
-enum sched_tunable_scaling {
- SCHED_TUNABLESCALING_NONE,
- SCHED_TUNABLESCALING_LOG,
- SCHED_TUNABLESCALING_LINEAR,
- SCHED_TUNABLESCALING_END,
-};
-extern enum sched_tunable_scaling sysctl_sched_tunable_scaling;
-
-extern unsigned int sysctl_numa_balancing_scan_delay;
-extern unsigned int sysctl_numa_balancing_scan_period_min;
-extern unsigned int sysctl_numa_balancing_scan_period_max;
-extern unsigned int sysctl_numa_balancing_scan_period_reset;
-extern unsigned int sysctl_numa_balancing_scan_size;
-extern unsigned int sysctl_numa_balancing_settle_count;
-
-#ifdef CONFIG_SCHED_DEBUG
-extern unsigned int sysctl_sched_migration_cost;
-extern unsigned int sysctl_sched_nr_migrate;
-extern unsigned int sysctl_sched_time_avg;
-extern unsigned int sysctl_timer_migration;
-extern unsigned int sysctl_sched_shares_window;
-
-int sched_proc_update_handler(struct ctl_table *table, int write,
- void __user *buffer, size_t *length,
- loff_t *ppos);
-#endif
-#ifdef CONFIG_SCHED_DEBUG
-static inline unsigned int get_sysctl_timer_migration(void)
-{
- return sysctl_timer_migration;
-}
-#else
-static inline unsigned int get_sysctl_timer_migration(void)
-{
- return 1;
-}
-#endif
-extern unsigned int sysctl_sched_rt_period;
-extern int sysctl_sched_rt_runtime;
-
-int sched_rt_handler(struct ctl_table *table, int write,
- void __user *buffer, size_t *lenp,
- loff_t *ppos);
-
-#ifdef CONFIG_SCHED_AUTOGROUP
-extern unsigned int sysctl_sched_autogroup_enabled;
-
-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);
-#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) { }
-#endif
-
-#ifdef CONFIG_CFS_BANDWIDTH
-extern unsigned int sysctl_sched_cfs_bandwidth_slice;
-#endif
-
#ifdef CONFIG_RT_MUTEXES
extern int rt_mutex_getprio(struct task_struct *p);
extern void rt_mutex_setprio(struct task_struct *p, int prio);
diff --git a/include/linux/sched_sysctl.h b/include/linux/sched_sysctl.h
new file mode 100644
index 0000000..912adab
--- /dev/null
+++ b/include/linux/sched_sysctl.h
@@ -0,0 +1,121 @@
+#ifndef _SCHED_SYSCTL_H
+#define _SCHED_SYSCTL_H
+
+
+/* provide a home for sysctl scheduler tuning knobs */
+
+/*
+ * default timeslice is 100 msecs (used only for SCHED_RR tasks).
+ * Timeslices get refilled after they expire.
+ */
+#define RR_TIMESLICE (100 * HZ / 1000)
+
+/*
+ * control realtime throttling:
+ *
+ * /proc/sys/kernel/sched_rt_period_us
+ * /proc/sys/kernel/sched_rt_runtime_us
+ */
+extern unsigned int sysctl_sched_rt_period;
+extern int sysctl_sched_rt_runtime;
+
+extern int sched_rt_handler(struct ctl_table *table, int write,
+ void __user *buffer, size_t *lenp,
+ loff_t *ppos);
+
+extern unsigned int sysctl_sched_latency;
+extern unsigned int sysctl_sched_min_granularity;
+extern unsigned int sysctl_sched_wakeup_granularity;
+extern unsigned int sysctl_sched_child_runs_first;
+
+enum sched_tunable_scaling {
+ SCHED_TUNABLESCALING_NONE,
+ SCHED_TUNABLESCALING_LOG,
+ SCHED_TUNABLESCALING_LINEAR,
+ SCHED_TUNABLESCALING_END,
+};
+extern enum sched_tunable_scaling sysctl_sched_tunable_scaling;
+
+extern unsigned int sysctl_numa_balancing_scan_delay;
+extern unsigned int sysctl_numa_balancing_scan_period_min;
+extern unsigned int sysctl_numa_balancing_scan_period_max;
+extern unsigned int sysctl_numa_balancing_scan_period_reset;
+extern unsigned int sysctl_numa_balancing_scan_size;
+extern unsigned int sysctl_numa_balancing_settle_count;
+
+#ifdef CONFIG_SCHED_DEBUG
+extern unsigned int sysctl_sched_migration_cost;
+extern unsigned int sysctl_sched_nr_migrate;
+extern unsigned int sysctl_sched_time_avg;
+extern unsigned int sysctl_timer_migration;
+extern unsigned int sysctl_sched_shares_window;
+
+int sched_proc_update_handler(struct ctl_table *table, int write,
+ void __user *buffer, size_t *length,
+ loff_t *ppos);
+#endif
+#ifdef CONFIG_SCHED_DEBUG
+static inline unsigned int get_sysctl_timer_migration(void)
+{
+ return sysctl_timer_migration;
+}
+#else
+static inline unsigned int get_sysctl_timer_migration(void)
+{
+ return 1;
+}
+#endif
+
+#ifdef CONFIG_CFS_BANDWIDTH
+extern unsigned int sysctl_sched_cfs_bandwidth_slice;
+#endif
+
+#ifdef CONFIG_DETECT_HUNG_TASK
+extern unsigned int sysctl_hung_task_panic;
+extern unsigned long sysctl_hung_task_check_count;
+extern unsigned long sysctl_hung_task_timeout_secs;
+extern unsigned long sysctl_hung_task_warnings;
+extern int proc_dohung_task_timeout_secs(struct ctl_table *table, int write,
+ void __user *buffer,
+ size_t *lenp, loff_t *ppos);
+#else
+/* Avoid need for ifdefs elsewhere in the code */
+enum { sysctl_hung_task_timeout_secs = 0 };
+#endif
+
+/*
+ * Default maximum number of active map areas, this limits the number of vmas
+ * per mm struct. Users can overwrite this number by sysctl but there is a
+ * problem.
+ *
+ * When a program's coredump is generated as ELF format, a section is created
+ * per a vma. In ELF, the number of sections is represented in unsigned short.
+ * This means the number of sections should be smaller than 65535 at coredump.
+ * Because the kernel adds some informative sections to a image of program at
+ * generating coredump, we need some margin. The number of extra sections is
+ * 1-3 now and depends on arch. We use "5" as safe margin, here.
+ */
+#define MAPCOUNT_ELF_CORE_MARGIN (5)
+#define DEFAULT_MAX_MAP_COUNT (USHRT_MAX - MAPCOUNT_ELF_CORE_MARGIN)
+
+extern int sysctl_max_map_count;
+
+#ifdef CONFIG_SCHED_AUTOGROUP
+extern unsigned int sysctl_sched_autogroup_enabled;
+
+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);
+#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) { }
+#endif
+
+#endif /* _SCHED_SYSCTL_H */
--
1.7.11.7
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] sched: move scheduler sysctl bits into dedicated header file
2013-01-28 20:31 [PATCH 1/2] sched: move scheduler sysctl bits into dedicated header file Clark Williams
@ 2013-01-29 1:12 ` Li Zefan
2013-01-29 17:55 ` Clark Williams
2013-01-29 6:05 ` Namhyung Kim
1 sibling, 1 reply; 7+ messages in thread
From: Li Zefan @ 2013-01-29 1:12 UTC (permalink / raw)
To: Clark Williams
Cc: Ingo Molnar, Peter Zijlstra, Thomas Gleixner, Ingo Molnar,
Steven Rostedt, LKML
> -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);
> -#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) { }
> -#endif
but those function declarations have nothing to do with sysctl..
> -
> -#ifdef CONFIG_CFS_BANDWIDTH
> -extern unsigned int sysctl_sched_cfs_bandwidth_slice;
> -#endif
> -
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] sched: move scheduler sysctl bits into dedicated header file
2013-01-28 20:31 [PATCH 1/2] sched: move scheduler sysctl bits into dedicated header file Clark Williams
2013-01-29 1:12 ` Li Zefan
@ 2013-01-29 6:05 ` Namhyung Kim
2013-01-29 17:57 ` Clark Williams
1 sibling, 1 reply; 7+ messages in thread
From: Namhyung Kim @ 2013-01-29 6:05 UTC (permalink / raw)
To: Clark Williams
Cc: Ingo Molnar, Peter Zijlstra, Thomas Gleixner, Ingo Molnar,
Steven Rostedt, LKML
Hi Clark,
On Mon, 28 Jan 2013 14:31:20 -0600, Clark Williams wrote:
> Move all the scheduler sysctl-related bits out of include/linux/sched.h
> into a new file include/linux/sched_sysctl.h.
>
> Signed-off-by: Clark Williams <williams@redhat.com>
> ---
[snip]
> diff --git a/include/linux/sched_sysctl.h b/include/linux/sched_sysctl.h
> new file mode 100644
> index 0000000..912adab
> --- /dev/null
> +++ b/include/linux/sched_sysctl.h
> @@ -0,0 +1,121 @@
> +#ifndef _SCHED_SYSCTL_H
> +#define _SCHED_SYSCTL_H
> +
> +
> +/* provide a home for sysctl scheduler tuning knobs */
> +
> +/*
> + * default timeslice is 100 msecs (used only for SCHED_RR tasks).
> + * Timeslices get refilled after they expire.
> + */
> +#define RR_TIMESLICE (100 * HZ / 1000)
It seems this line came from sched.h but I can't find that part
deleted.
Thanks
Namhyung
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] sched: move scheduler sysctl bits into dedicated header file
2013-01-29 1:12 ` Li Zefan
@ 2013-01-29 17:55 ` Clark Williams
0 siblings, 0 replies; 7+ messages in thread
From: Clark Williams @ 2013-01-29 17:55 UTC (permalink / raw)
To: Li Zefan
Cc: Ingo Molnar, Peter Zijlstra, Thomas Gleixner, Ingo Molnar,
Steven Rostedt, LKML
[-- Attachment #1: Type: text/plain, Size: 1458 bytes --]
On Tue, 29 Jan 2013 09:12:45 +0800
Li Zefan <lizefan@huawei.com> wrote:
> > -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);
> > -#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) { }
> > -#endif
>
> but those function declarations have nothing to do with sysctl..
>
> > -
> > -#ifdef CONFIG_CFS_BANDWIDTH
> > -extern unsigned int sysctl_sched_cfs_bandwidth_slice;
> > -#endif
> > -
>
True, but they're all under the SCHED_AUTOGROUP config variable along
with:
extern unsigned int sysctl_sched_autogroup_enabled;
So I thought I'd keep them all grouped together.
I can move the prototypes back into sched.h but the whole reason for
doing this is to reduce the size of sched.
Guess I'll let Ingo make the call here.
Clark
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] sched: move scheduler sysctl bits into dedicated header file
2013-01-29 6:05 ` Namhyung Kim
@ 2013-01-29 17:57 ` Clark Williams
2013-01-29 18:05 ` Steven Rostedt
2013-01-31 11:25 ` Ingo Molnar
0 siblings, 2 replies; 7+ messages in thread
From: Clark Williams @ 2013-01-29 17:57 UTC (permalink / raw)
To: Namhyung Kim
Cc: Ingo Molnar, Peter Zijlstra, Thomas Gleixner, Ingo Molnar,
Steven Rostedt, LKML
[-- Attachment #1: Type: text/plain, Size: 1198 bytes --]
On Tue, 29 Jan 2013 15:05:43 +0900
Namhyung Kim <namhyung@kernel.org> wrote:
> Hi Clark,
>
> On Mon, 28 Jan 2013 14:31:20 -0600, Clark Williams wrote:
> > Move all the scheduler sysctl-related bits out of include/linux/sched.h
> > into a new file include/linux/sched_sysctl.h.
> >
> > Signed-off-by: Clark Williams <williams@redhat.com>
> > ---
> [snip]
> > diff --git a/include/linux/sched_sysctl.h b/include/linux/sched_sysctl.h
> > new file mode 100644
> > index 0000000..912adab
> > --- /dev/null
> > +++ b/include/linux/sched_sysctl.h
> > @@ -0,0 +1,121 @@
> > +#ifndef _SCHED_SYSCTL_H
> > +#define _SCHED_SYSCTL_H
> > +
> > +
> > +/* provide a home for sysctl scheduler tuning knobs */
> > +
> > +/*
> > + * default timeslice is 100 msecs (used only for SCHED_RR tasks).
> > + * Timeslices get refilled after they expire.
> > + */
> > +#define RR_TIMESLICE (100 * HZ / 1000)
>
> It seems this line came from sched.h but I can't find that part
> deleted.
>
Arggghh! I reorganized the commits and didn't remove RR_TIMESLICE when
I moved it. I'm surprised it compiled.
I can generate a new patchset or let Ingo just remove it from sched.h.
Clark
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] sched: move scheduler sysctl bits into dedicated header file
2013-01-29 17:57 ` Clark Williams
@ 2013-01-29 18:05 ` Steven Rostedt
2013-01-31 11:25 ` Ingo Molnar
1 sibling, 0 replies; 7+ messages in thread
From: Steven Rostedt @ 2013-01-29 18:05 UTC (permalink / raw)
To: Clark Williams
Cc: Namhyung Kim, Ingo Molnar, Peter Zijlstra, Thomas Gleixner,
Ingo Molnar, LKML
On Tue, 2013-01-29 at 11:57 -0600, Clark Williams wrote:
> > > +/* provide a home for sysctl scheduler tuning knobs */
> > > +
> > > +/*
> > > + * default timeslice is 100 msecs (used only for SCHED_RR tasks).
> > > + * Timeslices get refilled after they expire.
> > > + */
> > > +#define RR_TIMESLICE (100 * HZ / 1000)
> >
> > It seems this line came from sched.h but I can't find that part
> > deleted.
> >
>
> Arggghh! I reorganized the commits and didn't remove RR_TIMESLICE when
> I moved it. I'm surprised it compiled.
>
> I can generate a new patchset or let Ingo just remove it from sched.h.
gcc won't warn if you define a macro to what it is already defined to.
#define foo bar
#define foo bar
won't warn
#define foo bar
#define foo cat
will.
-- Steve
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] sched: move scheduler sysctl bits into dedicated header file
2013-01-29 17:57 ` Clark Williams
2013-01-29 18:05 ` Steven Rostedt
@ 2013-01-31 11:25 ` Ingo Molnar
1 sibling, 0 replies; 7+ messages in thread
From: Ingo Molnar @ 2013-01-31 11:25 UTC (permalink / raw)
To: Clark Williams
Cc: Namhyung Kim, Peter Zijlstra, Thomas Gleixner, Ingo Molnar,
Steven Rostedt, LKML
* Clark Williams <williams@redhat.com> wrote:
> On Tue, 29 Jan 2013 15:05:43 +0900
> Namhyung Kim <namhyung@kernel.org> wrote:
>
> > Hi Clark,
> >
> > On Mon, 28 Jan 2013 14:31:20 -0600, Clark Williams wrote:
> > > Move all the scheduler sysctl-related bits out of include/linux/sched.h
> > > into a new file include/linux/sched_sysctl.h.
> > >
> > > Signed-off-by: Clark Williams <williams@redhat.com>
> > > ---
> > [snip]
> > > diff --git a/include/linux/sched_sysctl.h b/include/linux/sched_sysctl.h
> > > new file mode 100644
> > > index 0000000..912adab
> > > --- /dev/null
> > > +++ b/include/linux/sched_sysctl.h
> > > @@ -0,0 +1,121 @@
> > > +#ifndef _SCHED_SYSCTL_H
> > > +#define _SCHED_SYSCTL_H
> > > +
> > > +
> > > +/* provide a home for sysctl scheduler tuning knobs */
> > > +
> > > +/*
> > > + * default timeslice is 100 msecs (used only for SCHED_RR tasks).
> > > + * Timeslices get refilled after they expire.
> > > + */
> > > +#define RR_TIMESLICE (100 * HZ / 1000)
> >
> > It seems this line came from sched.h but I can't find that part
> > deleted.
> >
>
> Arggghh! I reorganized the commits and didn't remove
> RR_TIMESLICE when I moved it. I'm surprised it compiled.
>
> I can generate a new patchset or let Ingo just remove it from
> sched.h.
Please generate a new patch-set.
Mind also changing the placement of the new file a bit? Could
you create a new include/linux/sched/ directory, and put a new
sysctl.h into it?
That way further sched.h splitups will populate
include/linux/sched/ nicely.
Agreed?
Thanks,
Ingo
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2013-01-31 11:25 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-28 20:31 [PATCH 1/2] sched: move scheduler sysctl bits into dedicated header file Clark Williams
2013-01-29 1:12 ` Li Zefan
2013-01-29 17:55 ` Clark Williams
2013-01-29 6:05 ` Namhyung Kim
2013-01-29 17:57 ` Clark Williams
2013-01-29 18:05 ` Steven Rostedt
2013-01-31 11:25 ` Ingo Molnar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox