mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-28 06:34:12 +08:00
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 out of scope variable access in sched_slice() sched: Hide runqueues from direct refer at source code level sched: Remove unneeded __ref tag sched, x86: Fix cpufreq + sched_clock() TSC scaling
This commit is contained in:
commit
1eb51c33b2
@ -45,12 +45,16 @@ extern int no_timer_check;
|
||||
*/
|
||||
|
||||
DECLARE_PER_CPU(unsigned long, cyc2ns);
|
||||
DECLARE_PER_CPU(unsigned long long, cyc2ns_offset);
|
||||
|
||||
#define CYC2NS_SCALE_FACTOR 10 /* 2^10, carefully chosen */
|
||||
|
||||
static inline unsigned long long __cycles_2_ns(unsigned long long cyc)
|
||||
{
|
||||
return cyc * per_cpu(cyc2ns, smp_processor_id()) >> CYC2NS_SCALE_FACTOR;
|
||||
int cpu = smp_processor_id();
|
||||
unsigned long long ns = per_cpu(cyc2ns_offset, cpu);
|
||||
ns += cyc * per_cpu(cyc2ns, cpu) >> CYC2NS_SCALE_FACTOR;
|
||||
return ns;
|
||||
}
|
||||
|
||||
static inline unsigned long long cycles_2_ns(unsigned long long cyc)
|
||||
|
@ -590,22 +590,26 @@ EXPORT_SYMBOL(recalibrate_cpu_khz);
|
||||
*/
|
||||
|
||||
DEFINE_PER_CPU(unsigned long, cyc2ns);
|
||||
DEFINE_PER_CPU(unsigned long long, cyc2ns_offset);
|
||||
|
||||
static void set_cyc2ns_scale(unsigned long cpu_khz, int cpu)
|
||||
{
|
||||
unsigned long long tsc_now, ns_now;
|
||||
unsigned long long tsc_now, ns_now, *offset;
|
||||
unsigned long flags, *scale;
|
||||
|
||||
local_irq_save(flags);
|
||||
sched_clock_idle_sleep_event();
|
||||
|
||||
scale = &per_cpu(cyc2ns, cpu);
|
||||
offset = &per_cpu(cyc2ns_offset, cpu);
|
||||
|
||||
rdtscll(tsc_now);
|
||||
ns_now = __cycles_2_ns(tsc_now);
|
||||
|
||||
if (cpu_khz)
|
||||
if (cpu_khz) {
|
||||
*scale = (NSEC_PER_MSEC << CYC2NS_SCALE_FACTOR)/cpu_khz;
|
||||
*offset = ns_now - (tsc_now * *scale >> CYC2NS_SCALE_FACTOR);
|
||||
}
|
||||
|
||||
sched_clock_idle_wakeup_event(0);
|
||||
local_irq_restore(flags);
|
||||
|
@ -7822,7 +7822,7 @@ static void rq_attach_root(struct rq *rq, struct root_domain *rd)
|
||||
free_rootdomain(old_rd);
|
||||
}
|
||||
|
||||
static int __init_refok init_rootdomain(struct root_domain *rd, bool bootmem)
|
||||
static int init_rootdomain(struct root_domain *rd, bool bootmem)
|
||||
{
|
||||
gfp_t gfp = GFP_KERNEL;
|
||||
|
||||
|
@ -152,7 +152,7 @@ void cpupri_set(struct cpupri *cp, int cpu, int newpri)
|
||||
*
|
||||
* Returns: -ENOMEM if memory fails.
|
||||
*/
|
||||
int __init_refok cpupri_init(struct cpupri *cp, bool bootmem)
|
||||
int cpupri_init(struct cpupri *cp, bool bootmem)
|
||||
{
|
||||
gfp_t gfp = GFP_KERNEL;
|
||||
int i;
|
||||
|
@ -162,7 +162,7 @@ void print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq)
|
||||
{
|
||||
s64 MIN_vruntime = -1, min_vruntime, max_vruntime = -1,
|
||||
spread, rq0_min_vruntime, spread0;
|
||||
struct rq *rq = &per_cpu(runqueues, cpu);
|
||||
struct rq *rq = cpu_rq(cpu);
|
||||
struct sched_entity *last;
|
||||
unsigned long flags;
|
||||
|
||||
@ -191,7 +191,7 @@ void print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq)
|
||||
if (last)
|
||||
max_vruntime = last->vruntime;
|
||||
min_vruntime = cfs_rq->min_vruntime;
|
||||
rq0_min_vruntime = per_cpu(runqueues, 0).cfs.min_vruntime;
|
||||
rq0_min_vruntime = cpu_rq(0)->cfs.min_vruntime;
|
||||
spin_unlock_irqrestore(&rq->lock, flags);
|
||||
SEQ_printf(m, " .%-30s: %Ld.%06ld\n", "MIN_vruntime",
|
||||
SPLIT_NS(MIN_vruntime));
|
||||
@ -248,7 +248,7 @@ void print_rt_rq(struct seq_file *m, int cpu, struct rt_rq *rt_rq)
|
||||
|
||||
static void print_cpu(struct seq_file *m, int cpu)
|
||||
{
|
||||
struct rq *rq = &per_cpu(runqueues, cpu);
|
||||
struct rq *rq = cpu_rq(cpu);
|
||||
|
||||
#ifdef CONFIG_X86
|
||||
{
|
||||
|
@ -430,12 +430,13 @@ static u64 sched_slice(struct cfs_rq *cfs_rq, struct sched_entity *se)
|
||||
|
||||
for_each_sched_entity(se) {
|
||||
struct load_weight *load;
|
||||
struct load_weight lw;
|
||||
|
||||
cfs_rq = cfs_rq_of(se);
|
||||
load = &cfs_rq->load;
|
||||
|
||||
if (unlikely(!se->on_rq)) {
|
||||
struct load_weight lw = cfs_rq->load;
|
||||
lw = cfs_rq->load;
|
||||
|
||||
update_load_add(&lw, se->load.weight);
|
||||
load = &lw;
|
||||
|
Loading…
Reference in New Issue
Block a user