Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 10083
b: refs/heads/master
c: 108150e
h: refs/heads/master
i:
  10081: adcc0d6
  10079: 727f3db
v: v3
  • Loading branch information
Oleg Nesterov authored and Linus Torvalds committed Oct 24, 2005
1 parent 4da7162 commit 295d6ad
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 20 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: ba9e358fd04190a59e605c2963a15e014139a707
refs/heads/master: 108150ea78003044e41150c75259447b2c0953b6
29 changes: 10 additions & 19 deletions trunk/kernel/posix-cpu-timers.c
Original file line number Diff line number Diff line change
Expand Up @@ -380,14 +380,9 @@ int posix_cpu_timer_create(struct k_itimer *new_timer)
int posix_cpu_timer_del(struct k_itimer *timer)
{
struct task_struct *p = timer->it.cpu.task;
int ret = 0;

if (timer->it.cpu.firing)
return TIMER_RETRY;

if (unlikely(p == NULL))
return 0;

if (!list_empty(&timer->it.cpu.entry)) {
if (likely(p != NULL)) {
read_lock(&tasklist_lock);
if (unlikely(p->signal == NULL)) {
/*
Expand All @@ -396,18 +391,20 @@ int posix_cpu_timer_del(struct k_itimer *timer)
*/
BUG_ON(!list_empty(&timer->it.cpu.entry));
} else {
/*
* Take us off the task's timer list.
*/
spin_lock(&p->sighand->siglock);
list_del(&timer->it.cpu.entry);
if (timer->it.cpu.firing)
ret = TIMER_RETRY;
else
list_del(&timer->it.cpu.entry);
spin_unlock(&p->sighand->siglock);
}
read_unlock(&tasklist_lock);

if (!ret)
put_task_struct(p);
}
put_task_struct(p);

return 0;
return ret;
}

/*
Expand All @@ -424,8 +421,6 @@ static void cleanup_timers(struct list_head *head,
cputime_t ptime = cputime_add(utime, stime);

list_for_each_entry_safe(timer, next, head, entry) {
put_task_struct(timer->task);
timer->task = NULL;
list_del_init(&timer->entry);
if (cputime_lt(timer->expires.cpu, ptime)) {
timer->expires.cpu = cputime_zero;
Expand All @@ -437,8 +432,6 @@ static void cleanup_timers(struct list_head *head,

++head;
list_for_each_entry_safe(timer, next, head, entry) {
put_task_struct(timer->task);
timer->task = NULL;
list_del_init(&timer->entry);
if (cputime_lt(timer->expires.cpu, utime)) {
timer->expires.cpu = cputime_zero;
Expand All @@ -450,8 +443,6 @@ static void cleanup_timers(struct list_head *head,

++head;
list_for_each_entry_safe(timer, next, head, entry) {
put_task_struct(timer->task);
timer->task = NULL;
list_del_init(&timer->entry);
if (timer->expires.sched < sched_time) {
timer->expires.sched = 0;
Expand Down

0 comments on commit 295d6ad

Please sign in to comment.