Merge branch 'timers-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'timers-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: timers: fix TIMER_ABSTIME for process wide cpu timers timers: split process wide cpu clocks/timers, fix x86: clean up hpet timer reinit timers: split process wide cpu clocks/timers, remove spurious warning timers: split process wide cpu clocks/timers signal: re-add dead task accumulation stats. x86: fix hpet timer reinit for x86_64 sched: fix nohz load balancer on cpu offline
This commit is contained in:
commit
94dba89533
10 changed files with 209 additions and 75 deletions
|
|
@ -48,12 +48,11 @@ extern struct fs_struct init_fs;
|
|||
.posix_timers = LIST_HEAD_INIT(sig.posix_timers), \
|
||||
.cpu_timers = INIT_CPU_TIMERS(sig.cpu_timers), \
|
||||
.rlim = INIT_RLIMITS, \
|
||||
.cputime = { .totals = { \
|
||||
.utime = cputime_zero, \
|
||||
.stime = cputime_zero, \
|
||||
.sum_exec_runtime = 0, \
|
||||
.lock = __SPIN_LOCK_UNLOCKED(sig.cputime.totals.lock), \
|
||||
}, }, \
|
||||
.cputimer = { \
|
||||
.cputime = INIT_CPUTIME, \
|
||||
.running = 0, \
|
||||
.lock = __SPIN_LOCK_UNLOCKED(sig.cputimer.lock), \
|
||||
}, \
|
||||
}
|
||||
|
||||
extern struct nsproxy init_nsproxy;
|
||||
|
|
|
|||
|
|
@ -443,7 +443,6 @@ struct pacct_struct {
|
|||
* @utime: time spent in user mode, in &cputime_t units
|
||||
* @stime: time spent in kernel mode, in &cputime_t units
|
||||
* @sum_exec_runtime: total time spent on the CPU, in nanoseconds
|
||||
* @lock: lock for fields in this struct
|
||||
*
|
||||
* This structure groups together three kinds of CPU time that are
|
||||
* tracked for threads and thread groups. Most things considering
|
||||
|
|
@ -454,23 +453,33 @@ struct task_cputime {
|
|||
cputime_t utime;
|
||||
cputime_t stime;
|
||||
unsigned long long sum_exec_runtime;
|
||||
spinlock_t lock;
|
||||
};
|
||||
/* Alternate field names when used to cache expirations. */
|
||||
#define prof_exp stime
|
||||
#define virt_exp utime
|
||||
#define sched_exp sum_exec_runtime
|
||||
|
||||
#define INIT_CPUTIME \
|
||||
(struct task_cputime) { \
|
||||
.utime = cputime_zero, \
|
||||
.stime = cputime_zero, \
|
||||
.sum_exec_runtime = 0, \
|
||||
}
|
||||
|
||||
/**
|
||||
* struct thread_group_cputime - thread group interval timer counts
|
||||
* @totals: thread group interval timers; substructure for
|
||||
* uniprocessor kernel, per-cpu for SMP kernel.
|
||||
* struct thread_group_cputimer - thread group interval timer counts
|
||||
* @cputime: thread group interval timers.
|
||||
* @running: non-zero when there are timers running and
|
||||
* @cputime receives updates.
|
||||
* @lock: lock for fields in this struct.
|
||||
*
|
||||
* This structure contains the version of task_cputime, above, that is
|
||||
* used for thread group CPU clock calculations.
|
||||
* used for thread group CPU timer calculations.
|
||||
*/
|
||||
struct thread_group_cputime {
|
||||
struct task_cputime totals;
|
||||
struct thread_group_cputimer {
|
||||
struct task_cputime cputime;
|
||||
int running;
|
||||
spinlock_t lock;
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
@ -519,10 +528,10 @@ struct signal_struct {
|
|||
cputime_t it_prof_incr, it_virt_incr;
|
||||
|
||||
/*
|
||||
* Thread group totals for process CPU clocks.
|
||||
* See thread_group_cputime(), et al, for details.
|
||||
* Thread group totals for process CPU timers.
|
||||
* See thread_group_cputimer(), et al, for details.
|
||||
*/
|
||||
struct thread_group_cputime cputime;
|
||||
struct thread_group_cputimer cputimer;
|
||||
|
||||
/* Earliest-expiration cache. */
|
||||
struct task_cputime cputime_expires;
|
||||
|
|
@ -559,7 +568,7 @@ struct signal_struct {
|
|||
* Live threads maintain their own counters and add to these
|
||||
* in __exit_signal, except for the group leader.
|
||||
*/
|
||||
cputime_t cutime, cstime;
|
||||
cputime_t utime, stime, cutime, cstime;
|
||||
cputime_t gtime;
|
||||
cputime_t cgtime;
|
||||
unsigned long nvcsw, nivcsw, cnvcsw, cnivcsw;
|
||||
|
|
@ -567,6 +576,14 @@ struct signal_struct {
|
|||
unsigned long inblock, oublock, cinblock, coublock;
|
||||
struct task_io_accounting ioac;
|
||||
|
||||
/*
|
||||
* Cumulative ns of schedule CPU time fo dead threads in the
|
||||
* group, not including a zombie group leader, (This only differs
|
||||
* from jiffies_to_ns(utime + stime) if sched_clock uses something
|
||||
* other than jiffies.)
|
||||
*/
|
||||
unsigned long long sum_sched_runtime;
|
||||
|
||||
/*
|
||||
* We don't bother to synchronize most readers of this at all,
|
||||
* because there is no reader checking a limit that actually needs
|
||||
|
|
@ -2183,27 +2200,14 @@ static inline int spin_needbreak(spinlock_t *lock)
|
|||
/*
|
||||
* Thread group CPU time accounting.
|
||||
*/
|
||||
|
||||
static inline
|
||||
void thread_group_cputime(struct task_struct *tsk, struct task_cputime *times)
|
||||
{
|
||||
struct task_cputime *totals = &tsk->signal->cputime.totals;
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&totals->lock, flags);
|
||||
*times = *totals;
|
||||
spin_unlock_irqrestore(&totals->lock, flags);
|
||||
}
|
||||
void thread_group_cputime(struct task_struct *tsk, struct task_cputime *times);
|
||||
void thread_group_cputimer(struct task_struct *tsk, struct task_cputime *times);
|
||||
|
||||
static inline void thread_group_cputime_init(struct signal_struct *sig)
|
||||
{
|
||||
sig->cputime.totals = (struct task_cputime){
|
||||
.utime = cputime_zero,
|
||||
.stime = cputime_zero,
|
||||
.sum_exec_runtime = 0,
|
||||
};
|
||||
|
||||
spin_lock_init(&sig->cputime.totals.lock);
|
||||
sig->cputimer.cputime = INIT_CPUTIME;
|
||||
spin_lock_init(&sig->cputimer.lock);
|
||||
sig->cputimer.running = 0;
|
||||
}
|
||||
|
||||
static inline void thread_group_cputime_free(struct signal_struct *sig)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue