diff options
-rw-r--r-- | fs/exec.c | 2 | ||||
-rw-r--r-- | include/linux/hrtimer.h | 5 | ||||
-rw-r--r-- | include/linux/sched.h | 1 | ||||
-rw-r--r-- | include/linux/timer.h | 3 | ||||
-rw-r--r-- | kernel/fork.c | 2 | ||||
-rw-r--r-- | kernel/hrtimer.c | 12 | ||||
-rw-r--r-- | kernel/itimer.c | 15 | ||||
-rw-r--r-- | kernel/posix-timers.c | 9 |
8 files changed, 22 insertions, 27 deletions
@@ -632,7 +632,7 @@ static int de_thread(struct task_struct *tsk) | |||
632 | * synchronize with any firing (by calling del_timer_sync) | 632 | * synchronize with any firing (by calling del_timer_sync) |
633 | * before we can safely let the old group leader die. | 633 | * before we can safely let the old group leader die. |
634 | */ | 634 | */ |
635 | sig->real_timer.data = current; | 635 | sig->tsk = current; |
636 | spin_unlock_irq(lock); | 636 | spin_unlock_irq(lock); |
637 | if (hrtimer_cancel(&sig->real_timer)) | 637 | if (hrtimer_cancel(&sig->real_timer)) |
638 | hrtimer_restart(&sig->real_timer); | 638 | hrtimer_restart(&sig->real_timer); |
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h index f57cc7bd7008..93830158348e 100644 --- a/include/linux/hrtimer.h +++ b/include/linux/hrtimer.h | |||
@@ -45,9 +45,7 @@ struct hrtimer_base; | |||
45 | * @expires: the absolute expiry time in the hrtimers internal | 45 | * @expires: the absolute expiry time in the hrtimers internal |
46 | * representation. The time is related to the clock on | 46 | * representation. The time is related to the clock on |
47 | * which the timer is based. | 47 | * which the timer is based. |
48 | * @state: state of the timer | ||
49 | * @function: timer expiry callback function | 48 | * @function: timer expiry callback function |
50 | * @data: argument for the callback function | ||
51 | * @base: pointer to the timer base (per cpu and per clock) | 49 | * @base: pointer to the timer base (per cpu and per clock) |
52 | * | 50 | * |
53 | * The hrtimer structure must be initialized by init_hrtimer_#CLOCKTYPE() | 51 | * The hrtimer structure must be initialized by init_hrtimer_#CLOCKTYPE() |
@@ -55,8 +53,7 @@ struct hrtimer_base; | |||
55 | struct hrtimer { | 53 | struct hrtimer { |
56 | struct rb_node node; | 54 | struct rb_node node; |
57 | ktime_t expires; | 55 | ktime_t expires; |
58 | int (*function)(void *); | 56 | int (*function)(struct hrtimer *); |
59 | void *data; | ||
60 | struct hrtimer_base *base; | 57 | struct hrtimer_base *base; |
61 | }; | 58 | }; |
62 | 59 | ||
diff --git a/include/linux/sched.h b/include/linux/sched.h index e0054c1b9a09..036d14d2bf90 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -402,6 +402,7 @@ struct signal_struct { | |||
402 | 402 | ||
403 | /* ITIMER_REAL timer for the process */ | 403 | /* ITIMER_REAL timer for the process */ |
404 | struct hrtimer real_timer; | 404 | struct hrtimer real_timer; |
405 | struct task_struct *tsk; | ||
405 | ktime_t it_real_incr; | 406 | ktime_t it_real_incr; |
406 | 407 | ||
407 | /* ITIMER_PROF and ITIMER_VIRTUAL timers for the process */ | 408 | /* ITIMER_PROF and ITIMER_VIRTUAL timers for the process */ |
diff --git a/include/linux/timer.h b/include/linux/timer.h index ee5a09e806e8..b5caabca553c 100644 --- a/include/linux/timer.h +++ b/include/linux/timer.h | |||
@@ -96,6 +96,7 @@ static inline void add_timer(struct timer_list *timer) | |||
96 | 96 | ||
97 | extern void init_timers(void); | 97 | extern void init_timers(void); |
98 | extern void run_local_timers(void); | 98 | extern void run_local_timers(void); |
99 | extern int it_real_fn(void *); | 99 | struct hrtimer; |
100 | extern int it_real_fn(struct hrtimer *); | ||
100 | 101 | ||
101 | #endif | 102 | #endif |
diff --git a/kernel/fork.c b/kernel/fork.c index a02063903aaa..4bd6486aa67d 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -848,7 +848,7 @@ static inline int copy_signal(unsigned long clone_flags, struct task_struct * ts | |||
848 | hrtimer_init(&sig->real_timer, CLOCK_MONOTONIC, HRTIMER_REL); | 848 | hrtimer_init(&sig->real_timer, CLOCK_MONOTONIC, HRTIMER_REL); |
849 | sig->it_real_incr.tv64 = 0; | 849 | sig->it_real_incr.tv64 = 0; |
850 | sig->real_timer.function = it_real_fn; | 850 | sig->real_timer.function = it_real_fn; |
851 | sig->real_timer.data = tsk; | 851 | sig->tsk = tsk; |
852 | 852 | ||
853 | sig->it_virt_expires = cputime_zero; | 853 | sig->it_virt_expires = cputime_zero; |
854 | sig->it_virt_incr = cputime_zero; | 854 | sig->it_virt_incr = cputime_zero; |
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c index 44108de4f028..0237a556eb1f 100644 --- a/kernel/hrtimer.c +++ b/kernel/hrtimer.c | |||
@@ -613,21 +613,19 @@ static inline void run_hrtimer_queue(struct hrtimer_base *base) | |||
613 | 613 | ||
614 | while ((node = base->first)) { | 614 | while ((node = base->first)) { |
615 | struct hrtimer *timer; | 615 | struct hrtimer *timer; |
616 | int (*fn)(void *); | 616 | int (*fn)(struct hrtimer *); |
617 | int restart; | 617 | int restart; |
618 | void *data; | ||
619 | 618 | ||
620 | timer = rb_entry(node, struct hrtimer, node); | 619 | timer = rb_entry(node, struct hrtimer, node); |
621 | if (base->softirq_time.tv64 <= timer->expires.tv64) | 620 | if (base->softirq_time.tv64 <= timer->expires.tv64) |
622 | break; | 621 | break; |
623 | 622 | ||
624 | fn = timer->function; | 623 | fn = timer->function; |
625 | data = timer->data; | ||
626 | set_curr_timer(base, timer); | 624 | set_curr_timer(base, timer); |
627 | __remove_hrtimer(timer, base); | 625 | __remove_hrtimer(timer, base); |
628 | spin_unlock_irq(&base->lock); | 626 | spin_unlock_irq(&base->lock); |
629 | 627 | ||
630 | restart = fn(data); | 628 | restart = fn(timer); |
631 | 629 | ||
632 | spin_lock_irq(&base->lock); | 630 | spin_lock_irq(&base->lock); |
633 | 631 | ||
@@ -664,9 +662,10 @@ struct sleep_hrtimer { | |||
664 | int expired; | 662 | int expired; |
665 | }; | 663 | }; |
666 | 664 | ||
667 | static int nanosleep_wakeup(void *data) | 665 | static int nanosleep_wakeup(struct hrtimer *timer) |
668 | { | 666 | { |
669 | struct sleep_hrtimer *t = data; | 667 | struct sleep_hrtimer *t = |
668 | container_of(timer, struct sleep_hrtimer, timer); | ||
670 | 669 | ||
671 | t->expired = 1; | 670 | t->expired = 1; |
672 | wake_up_process(t->task); | 671 | wake_up_process(t->task); |
@@ -677,7 +676,6 @@ static int nanosleep_wakeup(void *data) | |||
677 | static int __sched do_nanosleep(struct sleep_hrtimer *t, enum hrtimer_mode mode) | 676 | static int __sched do_nanosleep(struct sleep_hrtimer *t, enum hrtimer_mode mode) |
678 | { | 677 | { |
679 | t->timer.function = nanosleep_wakeup; | 678 | t->timer.function = nanosleep_wakeup; |
680 | t->timer.data = t; | ||
681 | t->task = current; | 679 | t->task = current; |
682 | t->expired = 0; | 680 | t->expired = 0; |
683 | 681 | ||
diff --git a/kernel/itimer.c b/kernel/itimer.c index af2ec6b4392c..204ed7939e75 100644 --- a/kernel/itimer.c +++ b/kernel/itimer.c | |||
@@ -128,17 +128,16 @@ asmlinkage long sys_getitimer(int which, struct itimerval __user *value) | |||
128 | /* | 128 | /* |
129 | * The timer is automagically restarted, when interval != 0 | 129 | * The timer is automagically restarted, when interval != 0 |
130 | */ | 130 | */ |
131 | int it_real_fn(void *data) | 131 | int it_real_fn(struct hrtimer *timer) |
132 | { | 132 | { |
133 | struct task_struct *tsk = (struct task_struct *) data; | 133 | struct signal_struct *sig = |
134 | container_of(timer, struct signal_struct, real_timer); | ||
134 | 135 | ||
135 | send_group_sig_info(SIGALRM, SEND_SIG_PRIV, tsk); | 136 | send_group_sig_info(SIGALRM, SEND_SIG_PRIV, sig->tsk); |
136 | |||
137 | if (tsk->signal->it_real_incr.tv64 != 0) { | ||
138 | hrtimer_forward(&tsk->signal->real_timer, | ||
139 | tsk->signal->real_timer.base->softirq_time, | ||
140 | tsk->signal->it_real_incr); | ||
141 | 137 | ||
138 | if (sig->it_real_incr.tv64 != 0) { | ||
139 | hrtimer_forward(timer, timer->base->softirq_time, | ||
140 | sig->it_real_incr); | ||
142 | return HRTIMER_RESTART; | 141 | return HRTIMER_RESTART; |
143 | } | 142 | } |
144 | return HRTIMER_NORESTART; | 143 | return HRTIMER_NORESTART; |
diff --git a/kernel/posix-timers.c b/kernel/posix-timers.c index 7c5f44787c8c..ac6dc8744429 100644 --- a/kernel/posix-timers.c +++ b/kernel/posix-timers.c | |||
@@ -145,7 +145,7 @@ static int common_timer_set(struct k_itimer *, int, | |||
145 | struct itimerspec *, struct itimerspec *); | 145 | struct itimerspec *, struct itimerspec *); |
146 | static int common_timer_del(struct k_itimer *timer); | 146 | static int common_timer_del(struct k_itimer *timer); |
147 | 147 | ||
148 | static int posix_timer_fn(void *data); | 148 | static int posix_timer_fn(struct hrtimer *data); |
149 | 149 | ||
150 | static struct k_itimer *lock_timer(timer_t timer_id, unsigned long *flags); | 150 | static struct k_itimer *lock_timer(timer_t timer_id, unsigned long *flags); |
151 | 151 | ||
@@ -334,14 +334,14 @@ EXPORT_SYMBOL_GPL(posix_timer_event); | |||
334 | 334 | ||
335 | * This code is for CLOCK_REALTIME* and CLOCK_MONOTONIC* timers. | 335 | * This code is for CLOCK_REALTIME* and CLOCK_MONOTONIC* timers. |
336 | */ | 336 | */ |
337 | static int posix_timer_fn(void *data) | 337 | static int posix_timer_fn(struct hrtimer *timer) |
338 | { | 338 | { |
339 | struct k_itimer *timr = data; | 339 | struct k_itimer *timr; |
340 | struct hrtimer *timer = &timr->it.real.timer; | ||
341 | unsigned long flags; | 340 | unsigned long flags; |
342 | int si_private = 0; | 341 | int si_private = 0; |
343 | int ret = HRTIMER_NORESTART; | 342 | int ret = HRTIMER_NORESTART; |
344 | 343 | ||
344 | timr = container_of(timer, struct k_itimer, it.real.timer); | ||
345 | spin_lock_irqsave(&timr->it_lock, flags); | 345 | spin_lock_irqsave(&timr->it_lock, flags); |
346 | 346 | ||
347 | if (timr->it.real.interval.tv64 != 0) | 347 | if (timr->it.real.interval.tv64 != 0) |
@@ -725,7 +725,6 @@ common_timer_set(struct k_itimer *timr, int flags, | |||
725 | 725 | ||
726 | mode = flags & TIMER_ABSTIME ? HRTIMER_ABS : HRTIMER_REL; | 726 | mode = flags & TIMER_ABSTIME ? HRTIMER_ABS : HRTIMER_REL; |
727 | hrtimer_init(&timr->it.real.timer, timr->it_clock, mode); | 727 | hrtimer_init(&timr->it.real.timer, timr->it_clock, mode); |
728 | timr->it.real.timer.data = timr; | ||
729 | timr->it.real.timer.function = posix_timer_fn; | 728 | timr->it.real.timer.function = posix_timer_fn; |
730 | 729 | ||
731 | timer->expires = timespec_to_ktime(new_setting->it_value); | 730 | timer->expires = timespec_to_ktime(new_setting->it_value); |