提交 cfa97f99 编写于 作者: L Linus Torvalds

Merge branch 'sched-fixes-for-linus' of...

Merge branch 'sched-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip

* 'sched-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  sched: fix section mismatch
  sched: fix double kfree in failure path
  sched: clean up arch_reinit_sched_domains()
  sched: mark sched_create_sysfs_power_savings_entries() as __init
  getrusage: RUSAGE_THREAD should return ru_utime and ru_stime
  sched: fix sched_slice()
  sched_clock: prevent scd->clock from moving backwards, take #2
  sched: sched.c declare variables before they get used
...@@ -915,7 +915,6 @@ static inline struct cpumask *sched_domain_span(struct sched_domain *sd) ...@@ -915,7 +915,6 @@ static inline struct cpumask *sched_domain_span(struct sched_domain *sd)
extern void partition_sched_domains(int ndoms_new, struct cpumask *doms_new, extern void partition_sched_domains(int ndoms_new, struct cpumask *doms_new,
struct sched_domain_attr *dattr_new); struct sched_domain_attr *dattr_new);
extern int arch_reinit_sched_domains(void);
/* Test a flag in parent sched domain */ /* Test a flag in parent sched domain */
static inline int test_sd_parent(struct sched_domain *sd, int flag) static inline int test_sd_parent(struct sched_domain *sd, int flag)
...@@ -1707,16 +1706,16 @@ extern void wake_up_idle_cpu(int cpu); ...@@ -1707,16 +1706,16 @@ extern void wake_up_idle_cpu(int cpu);
static inline void wake_up_idle_cpu(int cpu) { } static inline void wake_up_idle_cpu(int cpu) { }
#endif #endif
#ifdef CONFIG_SCHED_DEBUG
extern unsigned int sysctl_sched_latency; extern unsigned int sysctl_sched_latency;
extern unsigned int sysctl_sched_min_granularity; extern unsigned int sysctl_sched_min_granularity;
extern unsigned int sysctl_sched_wakeup_granularity; extern unsigned int sysctl_sched_wakeup_granularity;
extern unsigned int sysctl_sched_shares_ratelimit;
extern unsigned int sysctl_sched_shares_thresh;
#ifdef CONFIG_SCHED_DEBUG
extern unsigned int sysctl_sched_child_runs_first; extern unsigned int sysctl_sched_child_runs_first;
extern unsigned int sysctl_sched_features; extern unsigned int sysctl_sched_features;
extern unsigned int sysctl_sched_migration_cost; extern unsigned int sysctl_sched_migration_cost;
extern unsigned int sysctl_sched_nr_migrate; extern unsigned int sysctl_sched_nr_migrate;
extern unsigned int sysctl_sched_shares_ratelimit;
extern unsigned int sysctl_sched_shares_thresh;
int sched_nr_latency_handler(struct ctl_table *table, int write, int sched_nr_latency_handler(struct ctl_table *table, int write,
struct file *file, void __user *buffer, size_t *length, struct file *file, void __user *buffer, size_t *length,
......
...@@ -105,6 +105,7 @@ extern unsigned long read_persistent_clock(void); ...@@ -105,6 +105,7 @@ extern unsigned long read_persistent_clock(void);
extern int update_persistent_clock(struct timespec now); extern int update_persistent_clock(struct timespec now);
extern int no_sync_cmos_clock __read_mostly; extern int no_sync_cmos_clock __read_mostly;
void timekeeping_init(void); void timekeeping_init(void);
extern int timekeeping_suspended;
unsigned long get_seconds(void); unsigned long get_seconds(void);
struct timespec current_kernel_time(void); struct timespec current_kernel_time(void);
......
...@@ -6957,7 +6957,7 @@ static void rq_attach_root(struct rq *rq, struct root_domain *rd) ...@@ -6957,7 +6957,7 @@ static void rq_attach_root(struct rq *rq, struct root_domain *rd)
spin_unlock_irqrestore(&rq->lock, flags); spin_unlock_irqrestore(&rq->lock, flags);
} }
static int init_rootdomain(struct root_domain *rd, bool bootmem) static int __init_refok init_rootdomain(struct root_domain *rd, bool bootmem)
{ {
memset(rd, 0, sizeof(*rd)); memset(rd, 0, sizeof(*rd));
...@@ -6970,7 +6970,7 @@ static int init_rootdomain(struct root_domain *rd, bool bootmem) ...@@ -6970,7 +6970,7 @@ static int init_rootdomain(struct root_domain *rd, bool bootmem)
} }
if (!alloc_cpumask_var(&rd->span, GFP_KERNEL)) if (!alloc_cpumask_var(&rd->span, GFP_KERNEL))
goto free_rd; goto out;
if (!alloc_cpumask_var(&rd->online, GFP_KERNEL)) if (!alloc_cpumask_var(&rd->online, GFP_KERNEL))
goto free_span; goto free_span;
if (!alloc_cpumask_var(&rd->rto_mask, GFP_KERNEL)) if (!alloc_cpumask_var(&rd->rto_mask, GFP_KERNEL))
...@@ -6986,8 +6986,7 @@ static int init_rootdomain(struct root_domain *rd, bool bootmem) ...@@ -6986,8 +6986,7 @@ static int init_rootdomain(struct root_domain *rd, bool bootmem)
free_cpumask_var(rd->online); free_cpumask_var(rd->online);
free_span: free_span:
free_cpumask_var(rd->span); free_cpumask_var(rd->span);
free_rd: out:
kfree(rd);
return -ENOMEM; return -ENOMEM;
} }
...@@ -7987,7 +7986,7 @@ void partition_sched_domains(int ndoms_new, struct cpumask *doms_new, ...@@ -7987,7 +7986,7 @@ void partition_sched_domains(int ndoms_new, struct cpumask *doms_new,
} }
#if defined(CONFIG_SCHED_MC) || defined(CONFIG_SCHED_SMT) #if defined(CONFIG_SCHED_MC) || defined(CONFIG_SCHED_SMT)
int arch_reinit_sched_domains(void) static void arch_reinit_sched_domains(void)
{ {
get_online_cpus(); get_online_cpus();
...@@ -7996,13 +7995,10 @@ int arch_reinit_sched_domains(void) ...@@ -7996,13 +7995,10 @@ int arch_reinit_sched_domains(void)
rebuild_sched_domains(); rebuild_sched_domains();
put_online_cpus(); put_online_cpus();
return 0;
} }
static ssize_t sched_power_savings_store(const char *buf, size_t count, int smt) static ssize_t sched_power_savings_store(const char *buf, size_t count, int smt)
{ {
int ret;
unsigned int level = 0; unsigned int level = 0;
if (sscanf(buf, "%u", &level) != 1) if (sscanf(buf, "%u", &level) != 1)
...@@ -8023,9 +8019,9 @@ static ssize_t sched_power_savings_store(const char *buf, size_t count, int smt) ...@@ -8023,9 +8019,9 @@ static ssize_t sched_power_savings_store(const char *buf, size_t count, int smt)
else else
sched_mc_power_savings = level; sched_mc_power_savings = level;
ret = arch_reinit_sched_domains(); arch_reinit_sched_domains();
return ret ? ret : count; return count;
} }
#ifdef CONFIG_SCHED_MC #ifdef CONFIG_SCHED_MC
...@@ -8060,7 +8056,7 @@ static SYSDEV_CLASS_ATTR(sched_smt_power_savings, 0644, ...@@ -8060,7 +8056,7 @@ static SYSDEV_CLASS_ATTR(sched_smt_power_savings, 0644,
sched_smt_power_savings_store); sched_smt_power_savings_store);
#endif #endif
int sched_create_sysfs_power_savings_entries(struct sysdev_class *cls) int __init sched_create_sysfs_power_savings_entries(struct sysdev_class *cls)
{ {
int err = 0; int err = 0;
......
...@@ -124,7 +124,7 @@ static u64 __update_sched_clock(struct sched_clock_data *scd, u64 now) ...@@ -124,7 +124,7 @@ static u64 __update_sched_clock(struct sched_clock_data *scd, u64 now)
clock = scd->tick_gtod + delta; clock = scd->tick_gtod + delta;
min_clock = wrap_max(scd->tick_gtod, scd->clock); min_clock = wrap_max(scd->tick_gtod, scd->clock);
max_clock = scd->tick_gtod + TICK_NSEC; max_clock = wrap_max(scd->clock, scd->tick_gtod + TICK_NSEC);
clock = wrap_max(clock, min_clock); clock = wrap_max(clock, min_clock);
clock = wrap_min(clock, max_clock); clock = wrap_min(clock, max_clock);
...@@ -227,6 +227,9 @@ EXPORT_SYMBOL_GPL(sched_clock_idle_sleep_event); ...@@ -227,6 +227,9 @@ EXPORT_SYMBOL_GPL(sched_clock_idle_sleep_event);
*/ */
void sched_clock_idle_wakeup_event(u64 delta_ns) void sched_clock_idle_wakeup_event(u64 delta_ns)
{ {
if (timekeeping_suspended)
return;
sched_clock_tick(); sched_clock_tick();
touch_softlockup_watchdog(); touch_softlockup_watchdog();
} }
......
...@@ -151,7 +151,7 @@ void cpupri_set(struct cpupri *cp, int cpu, int newpri) ...@@ -151,7 +151,7 @@ void cpupri_set(struct cpupri *cp, int cpu, int newpri)
* *
* Returns: -ENOMEM if memory fails. * Returns: -ENOMEM if memory fails.
*/ */
int cpupri_init(struct cpupri *cp, bool bootmem) int __init_refok cpupri_init(struct cpupri *cp, bool bootmem)
{ {
int i; int i;
......
...@@ -385,20 +385,6 @@ int sched_nr_latency_handler(struct ctl_table *table, int write, ...@@ -385,20 +385,6 @@ int sched_nr_latency_handler(struct ctl_table *table, int write,
} }
#endif #endif
/*
* delta *= P[w / rw]
*/
static inline unsigned long
calc_delta_weight(unsigned long delta, struct sched_entity *se)
{
for_each_sched_entity(se) {
delta = calc_delta_mine(delta,
se->load.weight, &cfs_rq_of(se)->load);
}
return delta;
}
/* /*
* delta /= w * delta /= w
*/ */
...@@ -440,12 +426,20 @@ static u64 __sched_period(unsigned long nr_running) ...@@ -440,12 +426,20 @@ static u64 __sched_period(unsigned long nr_running)
*/ */
static u64 sched_slice(struct cfs_rq *cfs_rq, struct sched_entity *se) static u64 sched_slice(struct cfs_rq *cfs_rq, struct sched_entity *se)
{ {
unsigned long nr_running = cfs_rq->nr_running; u64 slice = __sched_period(cfs_rq->nr_running + !se->on_rq);
if (unlikely(!se->on_rq)) for_each_sched_entity(se) {
nr_running++; struct load_weight *load = &cfs_rq->load;
return calc_delta_weight(__sched_period(nr_running), se); if (unlikely(!se->on_rq)) {
struct load_weight lw = cfs_rq->load;
update_load_add(&lw, se->load.weight);
load = &lw;
}
slice = calc_delta_mine(slice, se->load.weight, load);
}
return slice;
} }
/* /*
......
...@@ -1629,6 +1629,8 @@ static void k_getrusage(struct task_struct *p, int who, struct rusage *r) ...@@ -1629,6 +1629,8 @@ static void k_getrusage(struct task_struct *p, int who, struct rusage *r)
utime = stime = cputime_zero; utime = stime = cputime_zero;
if (who == RUSAGE_THREAD) { if (who == RUSAGE_THREAD) {
utime = task_utime(current);
stime = task_stime(current);
accumulate_thread_rusage(p, r); accumulate_thread_rusage(p, r);
goto out; goto out;
} }
......
...@@ -46,6 +46,9 @@ struct timespec xtime __attribute__ ((aligned (16))); ...@@ -46,6 +46,9 @@ struct timespec xtime __attribute__ ((aligned (16)));
struct timespec wall_to_monotonic __attribute__ ((aligned (16))); struct timespec wall_to_monotonic __attribute__ ((aligned (16)));
static unsigned long total_sleep_time; /* seconds */ static unsigned long total_sleep_time; /* seconds */
/* flag for if timekeeping is suspended */
int __read_mostly timekeeping_suspended;
static struct timespec xtime_cache __attribute__ ((aligned (16))); static struct timespec xtime_cache __attribute__ ((aligned (16)));
void update_xtime_cache(u64 nsec) void update_xtime_cache(u64 nsec)
{ {
...@@ -92,6 +95,8 @@ void getnstimeofday(struct timespec *ts) ...@@ -92,6 +95,8 @@ void getnstimeofday(struct timespec *ts)
unsigned long seq; unsigned long seq;
s64 nsecs; s64 nsecs;
WARN_ON(timekeeping_suspended);
do { do {
seq = read_seqbegin(&xtime_lock); seq = read_seqbegin(&xtime_lock);
...@@ -299,8 +304,6 @@ void __init timekeeping_init(void) ...@@ -299,8 +304,6 @@ void __init timekeeping_init(void)
write_sequnlock_irqrestore(&xtime_lock, flags); write_sequnlock_irqrestore(&xtime_lock, flags);
} }
/* flag for if timekeeping is suspended */
static int timekeeping_suspended;
/* time in seconds when suspend began */ /* time in seconds when suspend began */
static unsigned long timekeeping_suspend_time; static unsigned long timekeeping_suspend_time;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册