mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-24 23:52:40 +00:00
sched: Move cputime code to its own file
Extract cputime code from the giant sched/core.c and put it in its own file. This make it easier to deal with this particular area and de-bloat a bit more core.c Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com> Acked-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Cc: Tony Luck <tony.luck@intel.com> Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Heiko Carstens <heiko.carstens@de.ibm.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Peter Zijlstra <peterz@infradead.org>
This commit is contained in:
parent
b952741c80
commit
73fbec6044
4 changed files with 570 additions and 556 deletions
|
@ -891,6 +891,9 @@ struct cpuacct {
|
|||
struct kernel_cpustat __percpu *cpustat;
|
||||
};
|
||||
|
||||
extern struct cgroup_subsys cpuacct_subsys;
|
||||
extern struct cpuacct root_cpuacct;
|
||||
|
||||
/* return cpu accounting group corresponding to this container */
|
||||
static inline struct cpuacct *cgroup_ca(struct cgroup *cgrp)
|
||||
{
|
||||
|
@ -917,6 +920,16 @@ extern void cpuacct_charge(struct task_struct *tsk, u64 cputime);
|
|||
static inline void cpuacct_charge(struct task_struct *tsk, u64 cputime) {}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PARAVIRT
|
||||
static inline u64 steal_ticks(u64 steal)
|
||||
{
|
||||
if (unlikely(steal > NSEC_PER_SEC))
|
||||
return div_u64(steal, TICK_NSEC);
|
||||
|
||||
return __iter_div_u64_rem(steal, TICK_NSEC, &steal);
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline void inc_nr_running(struct rq *rq)
|
||||
{
|
||||
rq->nr_running++;
|
||||
|
@ -1157,3 +1170,53 @@ enum rq_nohz_flag_bits {
|
|||
|
||||
#define nohz_flags(cpu) (&cpu_rq(cpu)->nohz_flags)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_IRQ_TIME_ACCOUNTING
|
||||
|
||||
DECLARE_PER_CPU(u64, cpu_hardirq_time);
|
||||
DECLARE_PER_CPU(u64, cpu_softirq_time);
|
||||
|
||||
#ifndef CONFIG_64BIT
|
||||
DECLARE_PER_CPU(seqcount_t, irq_time_seq);
|
||||
|
||||
static inline void irq_time_write_begin(void)
|
||||
{
|
||||
__this_cpu_inc(irq_time_seq.sequence);
|
||||
smp_wmb();
|
||||
}
|
||||
|
||||
static inline void irq_time_write_end(void)
|
||||
{
|
||||
smp_wmb();
|
||||
__this_cpu_inc(irq_time_seq.sequence);
|
||||
}
|
||||
|
||||
static inline u64 irq_time_read(int cpu)
|
||||
{
|
||||
u64 irq_time;
|
||||
unsigned seq;
|
||||
|
||||
do {
|
||||
seq = read_seqcount_begin(&per_cpu(irq_time_seq, cpu));
|
||||
irq_time = per_cpu(cpu_softirq_time, cpu) +
|
||||
per_cpu(cpu_hardirq_time, cpu);
|
||||
} while (read_seqcount_retry(&per_cpu(irq_time_seq, cpu), seq));
|
||||
|
||||
return irq_time;
|
||||
}
|
||||
#else /* CONFIG_64BIT */
|
||||
static inline void irq_time_write_begin(void)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void irq_time_write_end(void)
|
||||
{
|
||||
}
|
||||
|
||||
static inline u64 irq_time_read(int cpu)
|
||||
{
|
||||
return per_cpu(cpu_softirq_time, cpu) + per_cpu(cpu_hardirq_time, cpu);
|
||||
}
|
||||
#endif /* CONFIG_64BIT */
|
||||
#endif /* CONFIG_IRQ_TIME_ACCOUNTING */
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue