diff options
| author | Roland Dreier <rolandd@cisco.com> | 2005-10-24 13:55:29 -0400 |
|---|---|---|
| committer | Roland Dreier <rolandd@cisco.com> | 2005-10-24 13:55:29 -0400 |
| commit | ec329a135974f1c400214dab02f09584d4beeba9 (patch) | |
| tree | 235be754f76f4e7d51975d2434f226cfc75cdd08 /kernel/posix-cpu-timers.c | |
| parent | bbf207860931b6a033d0fbcd170ae2332c0d8216 (diff) | |
| parent | 5d7edb3c1a01310725d86f0d83fb3be45685dc82 (diff) | |
Manual merge of for-linus to upstream (fix conflicts in drivers/infiniband/core/ucm.c)
Diffstat (limited to 'kernel/posix-cpu-timers.c')
| -rw-r--r-- | kernel/posix-cpu-timers.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/kernel/posix-cpu-timers.c b/kernel/posix-cpu-timers.c index ad85d3f0dcc4..d30b304a3384 100644 --- a/kernel/posix-cpu-timers.c +++ b/kernel/posix-cpu-timers.c | |||
| @@ -424,6 +424,7 @@ static void cleanup_timers(struct list_head *head, | |||
| 424 | cputime_t ptime = cputime_add(utime, stime); | 424 | cputime_t ptime = cputime_add(utime, stime); |
| 425 | 425 | ||
| 426 | list_for_each_entry_safe(timer, next, head, entry) { | 426 | list_for_each_entry_safe(timer, next, head, entry) { |
| 427 | put_task_struct(timer->task); | ||
| 427 | timer->task = NULL; | 428 | timer->task = NULL; |
| 428 | list_del_init(&timer->entry); | 429 | list_del_init(&timer->entry); |
| 429 | if (cputime_lt(timer->expires.cpu, ptime)) { | 430 | if (cputime_lt(timer->expires.cpu, ptime)) { |
| @@ -436,6 +437,7 @@ static void cleanup_timers(struct list_head *head, | |||
| 436 | 437 | ||
| 437 | ++head; | 438 | ++head; |
| 438 | list_for_each_entry_safe(timer, next, head, entry) { | 439 | list_for_each_entry_safe(timer, next, head, entry) { |
| 440 | put_task_struct(timer->task); | ||
| 439 | timer->task = NULL; | 441 | timer->task = NULL; |
| 440 | list_del_init(&timer->entry); | 442 | list_del_init(&timer->entry); |
| 441 | if (cputime_lt(timer->expires.cpu, utime)) { | 443 | if (cputime_lt(timer->expires.cpu, utime)) { |
| @@ -448,6 +450,7 @@ static void cleanup_timers(struct list_head *head, | |||
| 448 | 450 | ||
| 449 | ++head; | 451 | ++head; |
| 450 | list_for_each_entry_safe(timer, next, head, entry) { | 452 | list_for_each_entry_safe(timer, next, head, entry) { |
| 453 | put_task_struct(timer->task); | ||
| 451 | timer->task = NULL; | 454 | timer->task = NULL; |
| 452 | list_del_init(&timer->entry); | 455 | list_del_init(&timer->entry); |
| 453 | if (timer->expires.sched < sched_time) { | 456 | if (timer->expires.sched < sched_time) { |
| @@ -958,14 +961,16 @@ void posix_cpu_timer_get(struct k_itimer *timer, struct itimerspec *itp) | |||
| 958 | static void check_thread_timers(struct task_struct *tsk, | 961 | static void check_thread_timers(struct task_struct *tsk, |
| 959 | struct list_head *firing) | 962 | struct list_head *firing) |
| 960 | { | 963 | { |
| 964 | int maxfire; | ||
| 961 | struct list_head *timers = tsk->cpu_timers; | 965 | struct list_head *timers = tsk->cpu_timers; |
| 962 | 966 | ||
| 967 | maxfire = 20; | ||
| 963 | tsk->it_prof_expires = cputime_zero; | 968 | tsk->it_prof_expires = cputime_zero; |
| 964 | while (!list_empty(timers)) { | 969 | while (!list_empty(timers)) { |
| 965 | struct cpu_timer_list *t = list_entry(timers->next, | 970 | struct cpu_timer_list *t = list_entry(timers->next, |
| 966 | struct cpu_timer_list, | 971 | struct cpu_timer_list, |
| 967 | entry); | 972 | entry); |
| 968 | if (cputime_lt(prof_ticks(tsk), t->expires.cpu)) { | 973 | if (!--maxfire || cputime_lt(prof_ticks(tsk), t->expires.cpu)) { |
| 969 | tsk->it_prof_expires = t->expires.cpu; | 974 | tsk->it_prof_expires = t->expires.cpu; |
| 970 | break; | 975 | break; |
| 971 | } | 976 | } |
| @@ -974,12 +979,13 @@ static void check_thread_timers(struct task_struct *tsk, | |||
| 974 | } | 979 | } |
| 975 | 980 | ||
| 976 | ++timers; | 981 | ++timers; |
| 982 | maxfire = 20; | ||
| 977 | tsk->it_virt_expires = cputime_zero; | 983 | tsk->it_virt_expires = cputime_zero; |
| 978 | while (!list_empty(timers)) { | 984 | while (!list_empty(timers)) { |
| 979 | struct cpu_timer_list *t = list_entry(timers->next, | 985 | struct cpu_timer_list *t = list_entry(timers->next, |
| 980 | struct cpu_timer_list, | 986 | struct cpu_timer_list, |
| 981 | entry); | 987 | entry); |
| 982 | if (cputime_lt(virt_ticks(tsk), t->expires.cpu)) { | 988 | if (!--maxfire || cputime_lt(virt_ticks(tsk), t->expires.cpu)) { |
| 983 | tsk->it_virt_expires = t->expires.cpu; | 989 | tsk->it_virt_expires = t->expires.cpu; |
| 984 | break; | 990 | break; |
| 985 | } | 991 | } |
| @@ -988,12 +994,13 @@ static void check_thread_timers(struct task_struct *tsk, | |||
| 988 | } | 994 | } |
| 989 | 995 | ||
| 990 | ++timers; | 996 | ++timers; |
| 997 | maxfire = 20; | ||
| 991 | tsk->it_sched_expires = 0; | 998 | tsk->it_sched_expires = 0; |
| 992 | while (!list_empty(timers)) { | 999 | while (!list_empty(timers)) { |
| 993 | struct cpu_timer_list *t = list_entry(timers->next, | 1000 | struct cpu_timer_list *t = list_entry(timers->next, |
| 994 | struct cpu_timer_list, | 1001 | struct cpu_timer_list, |
| 995 | entry); | 1002 | entry); |
| 996 | if (tsk->sched_time < t->expires.sched) { | 1003 | if (!--maxfire || tsk->sched_time < t->expires.sched) { |
| 997 | tsk->it_sched_expires = t->expires.sched; | 1004 | tsk->it_sched_expires = t->expires.sched; |
| 998 | break; | 1005 | break; |
| 999 | } | 1006 | } |
| @@ -1010,6 +1017,7 @@ static void check_thread_timers(struct task_struct *tsk, | |||
| 1010 | static void check_process_timers(struct task_struct *tsk, | 1017 | static void check_process_timers(struct task_struct *tsk, |
| 1011 | struct list_head *firing) | 1018 | struct list_head *firing) |
| 1012 | { | 1019 | { |
| 1020 | int maxfire; | ||
| 1013 | struct signal_struct *const sig = tsk->signal; | 1021 | struct signal_struct *const sig = tsk->signal; |
| 1014 | cputime_t utime, stime, ptime, virt_expires, prof_expires; | 1022 | cputime_t utime, stime, ptime, virt_expires, prof_expires; |
| 1015 | unsigned long long sched_time, sched_expires; | 1023 | unsigned long long sched_time, sched_expires; |
| @@ -1042,12 +1050,13 @@ static void check_process_timers(struct task_struct *tsk, | |||
| 1042 | } while (t != tsk); | 1050 | } while (t != tsk); |
| 1043 | ptime = cputime_add(utime, stime); | 1051 | ptime = cputime_add(utime, stime); |
| 1044 | 1052 | ||
| 1053 | maxfire = 20; | ||
| 1045 | prof_expires = cputime_zero; | 1054 | prof_expires = cputime_zero; |
| 1046 | while (!list_empty(timers)) { | 1055 | while (!list_empty(timers)) { |
| 1047 | struct cpu_timer_list *t = list_entry(timers->next, | 1056 | struct cpu_timer_list *t = list_entry(timers->next, |
| 1048 | struct cpu_timer_list, | 1057 | struct cpu_timer_list, |
| 1049 | entry); | 1058 | entry); |
| 1050 | if (cputime_lt(ptime, t->expires.cpu)) { | 1059 | if (!--maxfire || cputime_lt(ptime, t->expires.cpu)) { |
| 1051 | prof_expires = t->expires.cpu; | 1060 | prof_expires = t->expires.cpu; |
| 1052 | break; | 1061 | break; |
| 1053 | } | 1062 | } |
| @@ -1056,12 +1065,13 @@ static void check_process_timers(struct task_struct *tsk, | |||
| 1056 | } | 1065 | } |
| 1057 | 1066 | ||
| 1058 | ++timers; | 1067 | ++timers; |
| 1068 | maxfire = 20; | ||
| 1059 | virt_expires = cputime_zero; | 1069 | virt_expires = cputime_zero; |
| 1060 | while (!list_empty(timers)) { | 1070 | while (!list_empty(timers)) { |
| 1061 | struct cpu_timer_list *t = list_entry(timers->next, | 1071 | struct cpu_timer_list *t = list_entry(timers->next, |
| 1062 | struct cpu_timer_list, | 1072 | struct cpu_timer_list, |
| 1063 | entry); | 1073 | entry); |
| 1064 | if (cputime_lt(utime, t->expires.cpu)) { | 1074 | if (!--maxfire || cputime_lt(utime, t->expires.cpu)) { |
| 1065 | virt_expires = t->expires.cpu; | 1075 | virt_expires = t->expires.cpu; |
| 1066 | break; | 1076 | break; |
| 1067 | } | 1077 | } |
| @@ -1070,12 +1080,13 @@ static void check_process_timers(struct task_struct *tsk, | |||
| 1070 | } | 1080 | } |
| 1071 | 1081 | ||
| 1072 | ++timers; | 1082 | ++timers; |
| 1083 | maxfire = 20; | ||
| 1073 | sched_expires = 0; | 1084 | sched_expires = 0; |
| 1074 | while (!list_empty(timers)) { | 1085 | while (!list_empty(timers)) { |
| 1075 | struct cpu_timer_list *t = list_entry(timers->next, | 1086 | struct cpu_timer_list *t = list_entry(timers->next, |
| 1076 | struct cpu_timer_list, | 1087 | struct cpu_timer_list, |
| 1077 | entry); | 1088 | entry); |
| 1078 | if (sched_time < t->expires.sched) { | 1089 | if (!--maxfire || sched_time < t->expires.sched) { |
| 1079 | sched_expires = t->expires.sched; | 1090 | sched_expires = t->expires.sched; |
| 1080 | break; | 1091 | break; |
| 1081 | } | 1092 | } |
