Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 131269
b: refs/heads/master
c: 3fccfd6
h: refs/heads/master
i:
  131267: fe6b953
v: v3
  • Loading branch information
Peter Zijlstra authored and Ingo Molnar committed Feb 11, 2009
1 parent d66c570 commit d5cf34d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 29 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: ff08f76d738d0ec0f334b187f61e160caa321d54
refs/heads/master: 3fccfd67df79c6351a156eb25a7a514e5f39c4d9
1 change: 1 addition & 0 deletions trunk/include/linux/sched.h
Original file line number Diff line number Diff line change
Expand Up @@ -2209,6 +2209,7 @@ void thread_group_cputimer(struct task_struct *tsk, struct task_cputime *times)
unsigned long flags;

spin_lock_irqsave(&cputimer->lock, flags);
cputimer->running = 1;
*times = cputimer->cputime;
spin_unlock_irqrestore(&cputimer->lock, flags);
}
Expand Down
42 changes: 14 additions & 28 deletions trunk/kernel/posix-cpu-timers.c
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ void posix_cpu_timers_exit_group(struct task_struct *tsk)
{
struct task_cputime cputime;

thread_group_cputime(tsk, &cputime);
thread_group_cputimer(tsk, &cputime);
cleanup_timers(tsk->signal->cpu_timers,
cputime.utime, cputime.stime, cputime.sum_exec_runtime);
}
Expand All @@ -506,29 +506,6 @@ static void clear_dead_task(struct k_itimer *timer, union cpu_time_count now)
now);
}

/*
* Enable the process wide cpu timer accounting.
*
* serialized using ->sighand->siglock
*/
static void start_process_timers(struct task_struct *tsk)
{
tsk->signal->cputimer.running = 1;
barrier();
}

/*
* Release the process wide timer accounting -- timer stops ticking when
* nobody cares about it.
*
* serialized using ->sighand->siglock
*/
static void stop_process_timers(struct task_struct *tsk)
{
tsk->signal->cputimer.running = 0;
barrier();
}

/*
* Insert the timer on the appropriate list before any timers that
* expire later. This must be called with the tasklist_lock held
Expand All @@ -549,9 +526,6 @@ static void arm_timer(struct k_itimer *timer, union cpu_time_count now)
BUG_ON(!irqs_disabled());
spin_lock(&p->sighand->siglock);

if (!CPUCLOCK_PERTHREAD(timer->it_clock))
start_process_timers(p);

listpos = head;
if (CPUCLOCK_WHICH(timer->it_clock) == CPUCLOCK_SCHED) {
list_for_each_entry(next, head, entry) {
Expand Down Expand Up @@ -1021,6 +995,19 @@ static void check_thread_timers(struct task_struct *tsk,
}
}

static void stop_process_timers(struct task_struct *tsk)
{
struct thread_group_cputimer *cputimer = &tsk->signal->cputimer;
unsigned long flags;

if (!cputimer->running)
return;

spin_lock_irqsave(&cputimer->lock, flags);
cputimer->running = 0;
spin_unlock_irqrestore(&cputimer->lock, flags);
}

/*
* Check for any per-thread CPU timers that have fired and move them
* off the tsk->*_timers list onto the firing list. Per-thread timers
Expand Down Expand Up @@ -1427,7 +1414,6 @@ void set_process_cpu_timer(struct task_struct *tsk, unsigned int clock_idx,
struct list_head *head;

BUG_ON(clock_idx == CPUCLOCK_SCHED);
start_process_timers(tsk);
cpu_timer_sample_group(clock_idx, tsk, &now);

if (oldval) {
Expand Down

0 comments on commit d5cf34d

Please sign in to comment.