Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 175592
b: refs/heads/master
c: acb4a84
h: refs/heads/master
v: v3
  • Loading branch information
Christian Ehrhardt authored and Ingo Molnar committed Dec 9, 2009
1 parent 27cabfa commit f723e43
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1983a922a1bc843806b9a36cf3a370b242783140
refs/heads/master: acb4a848da821a095ae9e4d8b22ae2d9633ba5cd
12 changes: 10 additions & 2 deletions trunk/kernel/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -1816,6 +1816,7 @@ static void cfs_rq_set_shares(struct cfs_rq *cfs_rq, unsigned long shares)

static void calc_load_account_active(struct rq *this_rq);
static void update_sysctl(void);
static int get_update_sysctl_factor(void);

static inline void __set_task_cpu(struct task_struct *p, unsigned int cpu)
{
Expand Down Expand Up @@ -7030,9 +7031,9 @@ cpumask_var_t nohz_cpu_mask;
*
* This idea comes from the SD scheduler of Con Kolivas:
*/
static void update_sysctl(void)
static int get_update_sysctl_factor(void)
{
unsigned int cpus = min(num_online_cpus(), 8U);
unsigned int cpus = min(num_online_cpus(), 8);
unsigned int factor;

switch (sysctl_sched_tunable_scaling) {
Expand All @@ -7048,6 +7049,13 @@ static void update_sysctl(void)
break;
}

return factor;
}

static void update_sysctl(void)
{
unsigned int factor = get_update_sysctl_factor();

#define SET_SYSCTL(name) \
(sysctl_##name = (factor) * normalized_sysctl_##name)
SET_SYSCTL(sched_min_granularity);
Expand Down
11 changes: 10 additions & 1 deletion trunk/kernel/sched_fair.c
Original file line number Diff line number Diff line change
Expand Up @@ -399,18 +399,27 @@ static struct sched_entity *__pick_last_entity(struct cfs_rq *cfs_rq)
*/

#ifdef CONFIG_SCHED_DEBUG
int sched_nr_latency_handler(struct ctl_table *table, int write,
int sched_proc_update_handler(struct ctl_table *table, int write,
void __user *buffer, size_t *lenp,
loff_t *ppos)
{
int ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
int factor = get_update_sysctl_factor();

if (ret || !write)
return ret;

sched_nr_latency = DIV_ROUND_UP(sysctl_sched_latency,
sysctl_sched_min_granularity);

#define WRT_SYSCTL(name) \
(normalized_sysctl_##name = sysctl_##name / (factor))
WRT_SYSCTL(sched_min_granularity);
WRT_SYSCTL(sched_latency);
WRT_SYSCTL(sched_wakeup_granularity);
WRT_SYSCTL(sched_shares_ratelimit);
#undef WRT_SYSCTL

return 0;
}
#endif
Expand Down
14 changes: 9 additions & 5 deletions trunk/kernel/sysctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,8 @@ static int min_wakeup_granularity_ns; /* 0 usecs */
static int max_wakeup_granularity_ns = NSEC_PER_SEC; /* 1 second */
static int min_sched_tunable_scaling = SCHED_TUNABLESCALING_NONE;
static int max_sched_tunable_scaling = SCHED_TUNABLESCALING_END-1;
static int min_sched_shares_ratelimit = 100000; /* 100 usec */
static int max_sched_shares_ratelimit = NSEC_PER_SEC; /* 1 second */
#endif

static struct ctl_table kern_table[] = {
Expand All @@ -271,7 +273,7 @@ static struct ctl_table kern_table[] = {
.data = &sysctl_sched_min_granularity,
.maxlen = sizeof(unsigned int),
.mode = 0644,
.proc_handler = &sched_nr_latency_handler,
.proc_handler = &sched_proc_update_handler,
.strategy = &sysctl_intvec,
.extra1 = &min_sched_granularity_ns,
.extra2 = &max_sched_granularity_ns,
Expand All @@ -282,7 +284,7 @@ static struct ctl_table kern_table[] = {
.data = &sysctl_sched_latency,
.maxlen = sizeof(unsigned int),
.mode = 0644,
.proc_handler = &sched_nr_latency_handler,
.proc_handler = &sched_proc_update_handler,
.strategy = &sysctl_intvec,
.extra1 = &min_sched_granularity_ns,
.extra2 = &max_sched_granularity_ns,
Expand All @@ -293,7 +295,7 @@ static struct ctl_table kern_table[] = {
.data = &sysctl_sched_wakeup_granularity,
.maxlen = sizeof(unsigned int),
.mode = 0644,
.proc_handler = &proc_dointvec_minmax,
.proc_handler = &sched_proc_update_handler,
.strategy = &sysctl_intvec,
.extra1 = &min_wakeup_granularity_ns,
.extra2 = &max_wakeup_granularity_ns,
Expand All @@ -304,15 +306,17 @@ static struct ctl_table kern_table[] = {
.data = &sysctl_sched_shares_ratelimit,
.maxlen = sizeof(unsigned int),
.mode = 0644,
.proc_handler = &proc_dointvec,
.proc_handler = &sched_proc_update_handler,
.extra1 = &min_sched_shares_ratelimit,
.extra2 = &max_sched_shares_ratelimit,
},
{
.ctl_name = CTL_UNNUMBERED,
.procname = "sched_tunable_scaling",
.data = &sysctl_sched_tunable_scaling,
.maxlen = sizeof(enum sched_tunable_scaling),
.mode = 0644,
.proc_handler = &proc_dointvec_minmax,
.proc_handler = &sched_proc_update_handler,
.strategy = &sysctl_intvec,
.extra1 = &min_sched_tunable_scaling,
.extra2 = &max_sched_tunable_scaling,
Expand Down

0 comments on commit f723e43

Please sign in to comment.