itimers: Merge ITIMER_VIRT and ITIMER_PROF
Both cpu itimers have same data flow in the few places, this patch make unification of code related with VIRT and PROF itimers. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Acked-by: Thomas Gleixner <tglx@linutronix.de> Cc: Oleg Nesterov <oleg@redhat.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> LKML-Reference: <1248862529-6063-2-git-send-email-sgruszka@redhat.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
		
					parent
					
						
							
								ed680c4ad4
							
						
					
				
			
			
				commit
				
					
						42c4ab41a1
					
				
			
		
					 4 changed files with 130 additions and 137 deletions
				
			
		|  | @ -470,6 +470,11 @@ struct pacct_struct { | ||||||
| 	unsigned long		ac_minflt, ac_majflt; | 	unsigned long		ac_minflt, ac_majflt; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
|  | struct cpu_itimer { | ||||||
|  | 	cputime_t expires; | ||||||
|  | 	cputime_t incr; | ||||||
|  | }; | ||||||
|  | 
 | ||||||
| /**
 | /**
 | ||||||
|  * struct task_cputime - collected CPU time counts |  * struct task_cputime - collected CPU time counts | ||||||
|  * @utime:		time spent in user mode, in &cputime_t units |  * @utime:		time spent in user mode, in &cputime_t units | ||||||
|  | @ -564,9 +569,12 @@ struct signal_struct { | ||||||
| 	struct pid *leader_pid; | 	struct pid *leader_pid; | ||||||
| 	ktime_t it_real_incr; | 	ktime_t it_real_incr; | ||||||
| 
 | 
 | ||||||
| 	/* ITIMER_PROF and ITIMER_VIRTUAL timers for the process */ | 	/*
 | ||||||
| 	cputime_t it_prof_expires, it_virt_expires; | 	 * ITIMER_PROF and ITIMER_VIRTUAL timers for the process, we use | ||||||
| 	cputime_t it_prof_incr, it_virt_incr; | 	 * CPUCLOCK_PROF and CPUCLOCK_VIRT for indexing array as these | ||||||
|  | 	 * values are defined to 0 and 1 respectively | ||||||
|  | 	 */ | ||||||
|  | 	struct cpu_itimer it[2]; | ||||||
| 
 | 
 | ||||||
| 	/*
 | 	/*
 | ||||||
| 	 * Thread group totals for process CPU timers. | 	 * Thread group totals for process CPU timers. | ||||||
|  |  | ||||||
|  | @ -62,6 +62,7 @@ | ||||||
| #include <linux/fs_struct.h> | #include <linux/fs_struct.h> | ||||||
| #include <linux/magic.h> | #include <linux/magic.h> | ||||||
| #include <linux/perf_counter.h> | #include <linux/perf_counter.h> | ||||||
|  | #include <linux/posix-timers.h> | ||||||
| 
 | 
 | ||||||
| #include <asm/pgtable.h> | #include <asm/pgtable.h> | ||||||
| #include <asm/pgalloc.h> | #include <asm/pgalloc.h> | ||||||
|  | @ -790,10 +791,10 @@ static void posix_cpu_timers_init_group(struct signal_struct *sig) | ||||||
| 	thread_group_cputime_init(sig); | 	thread_group_cputime_init(sig); | ||||||
| 
 | 
 | ||||||
| 	/* Expiration times and increments. */ | 	/* Expiration times and increments. */ | ||||||
| 	sig->it_virt_expires = cputime_zero; | 	sig->it[CPUCLOCK_PROF].expires = cputime_zero; | ||||||
| 	sig->it_virt_incr = cputime_zero; | 	sig->it[CPUCLOCK_PROF].incr = cputime_zero; | ||||||
| 	sig->it_prof_expires = cputime_zero; | 	sig->it[CPUCLOCK_VIRT].expires = cputime_zero; | ||||||
| 	sig->it_prof_incr = cputime_zero; | 	sig->it[CPUCLOCK_VIRT].incr = cputime_zero; | ||||||
| 
 | 
 | ||||||
| 	/* Cached expiration times. */ | 	/* Cached expiration times. */ | ||||||
| 	sig->cputime_expires.prof_exp = cputime_zero; | 	sig->cputime_expires.prof_exp = cputime_zero; | ||||||
|  |  | ||||||
							
								
								
									
										146
									
								
								kernel/itimer.c
									
										
									
									
									
								
							
							
						
						
									
										146
									
								
								kernel/itimer.c
									
										
									
									
									
								
							|  | @ -41,10 +41,43 @@ static struct timeval itimer_get_remtime(struct hrtimer *timer) | ||||||
| 	return ktime_to_timeval(rem); | 	return ktime_to_timeval(rem); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | static void get_cpu_itimer(struct task_struct *tsk, unsigned int clock_id, | ||||||
|  | 			   struct itimerval *value) | ||||||
|  | { | ||||||
|  | 	cputime_t cval, cinterval; | ||||||
|  | 	struct cpu_itimer *it = &tsk->signal->it[clock_id]; | ||||||
|  | 
 | ||||||
|  | 	spin_lock_irq(&tsk->sighand->siglock); | ||||||
|  | 
 | ||||||
|  | 	cval = it->expires; | ||||||
|  | 	cinterval = it->incr; | ||||||
|  | 	if (!cputime_eq(cval, cputime_zero)) { | ||||||
|  | 		struct task_cputime cputime; | ||||||
|  | 		cputime_t t; | ||||||
|  | 
 | ||||||
|  | 		thread_group_cputimer(tsk, &cputime); | ||||||
|  | 		if (clock_id == CPUCLOCK_PROF) | ||||||
|  | 			t = cputime_add(cputime.utime, cputime.stime); | ||||||
|  | 		else | ||||||
|  | 			/* CPUCLOCK_VIRT */ | ||||||
|  | 			t = cputime.utime; | ||||||
|  | 
 | ||||||
|  | 		if (cputime_le(cval, t)) | ||||||
|  | 			/* about to fire */ | ||||||
|  | 			cval = jiffies_to_cputime(1); | ||||||
|  | 		else | ||||||
|  | 			cval = cputime_sub(cval, t); | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	spin_unlock_irq(&tsk->sighand->siglock); | ||||||
|  | 
 | ||||||
|  | 	cputime_to_timeval(cval, &value->it_value); | ||||||
|  | 	cputime_to_timeval(cinterval, &value->it_interval); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| int do_getitimer(int which, struct itimerval *value) | int do_getitimer(int which, struct itimerval *value) | ||||||
| { | { | ||||||
| 	struct task_struct *tsk = current; | 	struct task_struct *tsk = current; | ||||||
| 	cputime_t cinterval, cval; |  | ||||||
| 
 | 
 | ||||||
| 	switch (which) { | 	switch (which) { | ||||||
| 	case ITIMER_REAL: | 	case ITIMER_REAL: | ||||||
|  | @ -55,44 +88,10 @@ int do_getitimer(int which, struct itimerval *value) | ||||||
| 		spin_unlock_irq(&tsk->sighand->siglock); | 		spin_unlock_irq(&tsk->sighand->siglock); | ||||||
| 		break; | 		break; | ||||||
| 	case ITIMER_VIRTUAL: | 	case ITIMER_VIRTUAL: | ||||||
| 		spin_lock_irq(&tsk->sighand->siglock); | 		get_cpu_itimer(tsk, CPUCLOCK_VIRT, value); | ||||||
| 		cval = tsk->signal->it_virt_expires; |  | ||||||
| 		cinterval = tsk->signal->it_virt_incr; |  | ||||||
| 		if (!cputime_eq(cval, cputime_zero)) { |  | ||||||
| 			struct task_cputime cputime; |  | ||||||
| 			cputime_t utime; |  | ||||||
| 
 |  | ||||||
| 			thread_group_cputimer(tsk, &cputime); |  | ||||||
| 			utime = cputime.utime; |  | ||||||
| 			if (cputime_le(cval, utime)) { /* about to fire */ |  | ||||||
| 				cval = jiffies_to_cputime(1); |  | ||||||
| 			} else { |  | ||||||
| 				cval = cputime_sub(cval, utime); |  | ||||||
| 			} |  | ||||||
| 		} |  | ||||||
| 		spin_unlock_irq(&tsk->sighand->siglock); |  | ||||||
| 		cputime_to_timeval(cval, &value->it_value); |  | ||||||
| 		cputime_to_timeval(cinterval, &value->it_interval); |  | ||||||
| 		break; | 		break; | ||||||
| 	case ITIMER_PROF: | 	case ITIMER_PROF: | ||||||
| 		spin_lock_irq(&tsk->sighand->siglock); | 		get_cpu_itimer(tsk, CPUCLOCK_PROF, value); | ||||||
| 		cval = tsk->signal->it_prof_expires; |  | ||||||
| 		cinterval = tsk->signal->it_prof_incr; |  | ||||||
| 		if (!cputime_eq(cval, cputime_zero)) { |  | ||||||
| 			struct task_cputime times; |  | ||||||
| 			cputime_t ptime; |  | ||||||
| 
 |  | ||||||
| 			thread_group_cputimer(tsk, ×); |  | ||||||
| 			ptime = cputime_add(times.utime, times.stime); |  | ||||||
| 			if (cputime_le(cval, ptime)) { /* about to fire */ |  | ||||||
| 				cval = jiffies_to_cputime(1); |  | ||||||
| 			} else { |  | ||||||
| 				cval = cputime_sub(cval, ptime); |  | ||||||
| 			} |  | ||||||
| 		} |  | ||||||
| 		spin_unlock_irq(&tsk->sighand->siglock); |  | ||||||
| 		cputime_to_timeval(cval, &value->it_value); |  | ||||||
| 		cputime_to_timeval(cinterval, &value->it_interval); |  | ||||||
| 		break; | 		break; | ||||||
| 	default: | 	default: | ||||||
| 		return(-EINVAL); | 		return(-EINVAL); | ||||||
|  | @ -128,6 +127,36 @@ enum hrtimer_restart it_real_fn(struct hrtimer *timer) | ||||||
| 	return HRTIMER_NORESTART; | 	return HRTIMER_NORESTART; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | static void set_cpu_itimer(struct task_struct *tsk, unsigned int clock_id, | ||||||
|  | 			   struct itimerval *value, struct itimerval *ovalue) | ||||||
|  | { | ||||||
|  | 	cputime_t cval, cinterval, nval, ninterval; | ||||||
|  | 	struct cpu_itimer *it = &tsk->signal->it[clock_id]; | ||||||
|  | 
 | ||||||
|  | 	nval = timeval_to_cputime(&value->it_value); | ||||||
|  | 	ninterval = timeval_to_cputime(&value->it_interval); | ||||||
|  | 
 | ||||||
|  | 	spin_lock_irq(&tsk->sighand->siglock); | ||||||
|  | 
 | ||||||
|  | 	cval = it->expires; | ||||||
|  | 	cinterval = it->incr; | ||||||
|  | 	if (!cputime_eq(cval, cputime_zero) || | ||||||
|  | 	    !cputime_eq(nval, cputime_zero)) { | ||||||
|  | 		if (cputime_gt(nval, cputime_zero)) | ||||||
|  | 			nval = cputime_add(nval, jiffies_to_cputime(1)); | ||||||
|  | 		set_process_cpu_timer(tsk, clock_id, &nval, &cval); | ||||||
|  | 	} | ||||||
|  | 	it->expires = nval; | ||||||
|  | 	it->incr = ninterval; | ||||||
|  | 
 | ||||||
|  | 	spin_unlock_irq(&tsk->sighand->siglock); | ||||||
|  | 
 | ||||||
|  | 	if (ovalue) { | ||||||
|  | 		cputime_to_timeval(cval, &ovalue->it_value); | ||||||
|  | 		cputime_to_timeval(cinterval, &ovalue->it_interval); | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  | 
 | ||||||
| /*
 | /*
 | ||||||
|  * Returns true if the timeval is in canonical form |  * Returns true if the timeval is in canonical form | ||||||
|  */ |  */ | ||||||
|  | @ -139,7 +168,6 @@ int do_setitimer(int which, struct itimerval *value, struct itimerval *ovalue) | ||||||
| 	struct task_struct *tsk = current; | 	struct task_struct *tsk = current; | ||||||
| 	struct hrtimer *timer; | 	struct hrtimer *timer; | ||||||
| 	ktime_t expires; | 	ktime_t expires; | ||||||
| 	cputime_t cval, cinterval, nval, ninterval; |  | ||||||
| 
 | 
 | ||||||
| 	/*
 | 	/*
 | ||||||
| 	 * Validate the timevals in value. | 	 * Validate the timevals in value. | ||||||
|  | @ -174,48 +202,10 @@ again: | ||||||
| 		spin_unlock_irq(&tsk->sighand->siglock); | 		spin_unlock_irq(&tsk->sighand->siglock); | ||||||
| 		break; | 		break; | ||||||
| 	case ITIMER_VIRTUAL: | 	case ITIMER_VIRTUAL: | ||||||
| 		nval = timeval_to_cputime(&value->it_value); | 		set_cpu_itimer(tsk, CPUCLOCK_VIRT, value, ovalue); | ||||||
| 		ninterval = timeval_to_cputime(&value->it_interval); |  | ||||||
| 		spin_lock_irq(&tsk->sighand->siglock); |  | ||||||
| 		cval = tsk->signal->it_virt_expires; |  | ||||||
| 		cinterval = tsk->signal->it_virt_incr; |  | ||||||
| 		if (!cputime_eq(cval, cputime_zero) || |  | ||||||
| 		    !cputime_eq(nval, cputime_zero)) { |  | ||||||
| 			if (cputime_gt(nval, cputime_zero)) |  | ||||||
| 				nval = cputime_add(nval, |  | ||||||
| 						   jiffies_to_cputime(1)); |  | ||||||
| 			set_process_cpu_timer(tsk, CPUCLOCK_VIRT, |  | ||||||
| 					      &nval, &cval); |  | ||||||
| 		} |  | ||||||
| 		tsk->signal->it_virt_expires = nval; |  | ||||||
| 		tsk->signal->it_virt_incr = ninterval; |  | ||||||
| 		spin_unlock_irq(&tsk->sighand->siglock); |  | ||||||
| 		if (ovalue) { |  | ||||||
| 			cputime_to_timeval(cval, &ovalue->it_value); |  | ||||||
| 			cputime_to_timeval(cinterval, &ovalue->it_interval); |  | ||||||
| 		} |  | ||||||
| 		break; | 		break; | ||||||
| 	case ITIMER_PROF: | 	case ITIMER_PROF: | ||||||
| 		nval = timeval_to_cputime(&value->it_value); | 		set_cpu_itimer(tsk, CPUCLOCK_PROF, value, ovalue); | ||||||
| 		ninterval = timeval_to_cputime(&value->it_interval); |  | ||||||
| 		spin_lock_irq(&tsk->sighand->siglock); |  | ||||||
| 		cval = tsk->signal->it_prof_expires; |  | ||||||
| 		cinterval = tsk->signal->it_prof_incr; |  | ||||||
| 		if (!cputime_eq(cval, cputime_zero) || |  | ||||||
| 		    !cputime_eq(nval, cputime_zero)) { |  | ||||||
| 			if (cputime_gt(nval, cputime_zero)) |  | ||||||
| 				nval = cputime_add(nval, |  | ||||||
| 						   jiffies_to_cputime(1)); |  | ||||||
| 			set_process_cpu_timer(tsk, CPUCLOCK_PROF, |  | ||||||
| 					      &nval, &cval); |  | ||||||
| 		} |  | ||||||
| 		tsk->signal->it_prof_expires = nval; |  | ||||||
| 		tsk->signal->it_prof_incr = ninterval; |  | ||||||
| 		spin_unlock_irq(&tsk->sighand->siglock); |  | ||||||
| 		if (ovalue) { |  | ||||||
| 			cputime_to_timeval(cval, &ovalue->it_value); |  | ||||||
| 			cputime_to_timeval(cinterval, &ovalue->it_interval); |  | ||||||
| 		} |  | ||||||
| 		break; | 		break; | ||||||
| 	default: | 	default: | ||||||
| 		return -EINVAL; | 		return -EINVAL; | ||||||
|  |  | ||||||
|  | @ -14,11 +14,11 @@ | ||||||
|  */ |  */ | ||||||
| void update_rlimit_cpu(unsigned long rlim_new) | void update_rlimit_cpu(unsigned long rlim_new) | ||||||
| { | { | ||||||
| 	cputime_t cputime; | 	cputime_t cputime = secs_to_cputime(rlim_new); | ||||||
|  | 	struct signal_struct *const sig = current->signal; | ||||||
| 
 | 
 | ||||||
| 	cputime = secs_to_cputime(rlim_new); | 	if (cputime_eq(sig->it[CPUCLOCK_PROF].expires, cputime_zero) || | ||||||
| 	if (cputime_eq(current->signal->it_prof_expires, cputime_zero) || | 	    cputime_gt(sig->it[CPUCLOCK_PROF].expires, cputime)) { | ||||||
| 	    cputime_gt(current->signal->it_prof_expires, cputime)) { |  | ||||||
| 		spin_lock_irq(¤t->sighand->siglock); | 		spin_lock_irq(¤t->sighand->siglock); | ||||||
| 		set_process_cpu_timer(current, CPUCLOCK_PROF, &cputime, NULL); | 		set_process_cpu_timer(current, CPUCLOCK_PROF, &cputime, NULL); | ||||||
| 		spin_unlock_irq(¤t->sighand->siglock); | 		spin_unlock_irq(¤t->sighand->siglock); | ||||||
|  | @ -613,6 +613,9 @@ static void arm_timer(struct k_itimer *timer, union cpu_time_count now) | ||||||
| 				break; | 				break; | ||||||
| 			} | 			} | ||||||
| 		} else { | 		} else { | ||||||
|  | 			struct signal_struct *const sig = p->signal; | ||||||
|  | 			union cpu_time_count *exp = &timer->it.cpu.expires; | ||||||
|  | 
 | ||||||
| 			/*
 | 			/*
 | ||||||
| 			 * For a process timer, set the cached expiration time. | 			 * For a process timer, set the cached expiration time. | ||||||
| 			 */ | 			 */ | ||||||
|  | @ -620,30 +623,27 @@ static void arm_timer(struct k_itimer *timer, union cpu_time_count now) | ||||||
| 			default: | 			default: | ||||||
| 				BUG(); | 				BUG(); | ||||||
| 			case CPUCLOCK_VIRT: | 			case CPUCLOCK_VIRT: | ||||||
| 				if (!cputime_eq(p->signal->it_virt_expires, | 				if (!cputime_eq(sig->it[CPUCLOCK_VIRT].expires, | ||||||
| 						cputime_zero) && | 						cputime_zero) && | ||||||
| 				    cputime_lt(p->signal->it_virt_expires, | 				    cputime_lt(sig->it[CPUCLOCK_VIRT].expires, | ||||||
| 					       timer->it.cpu.expires.cpu)) | 					       exp->cpu)) | ||||||
| 					break; | 					break; | ||||||
| 				p->signal->cputime_expires.virt_exp = | 				sig->cputime_expires.virt_exp = exp->cpu; | ||||||
| 					timer->it.cpu.expires.cpu; |  | ||||||
| 				break; | 				break; | ||||||
| 			case CPUCLOCK_PROF: | 			case CPUCLOCK_PROF: | ||||||
| 				if (!cputime_eq(p->signal->it_prof_expires, | 				if (!cputime_eq(sig->it[CPUCLOCK_PROF].expires, | ||||||
| 						cputime_zero) && | 						cputime_zero) && | ||||||
| 				    cputime_lt(p->signal->it_prof_expires, | 				    cputime_lt(sig->it[CPUCLOCK_PROF].expires, | ||||||
| 					       timer->it.cpu.expires.cpu)) | 					       exp->cpu)) | ||||||
| 					break; | 					break; | ||||||
| 				i = p->signal->rlim[RLIMIT_CPU].rlim_cur; | 				i = sig->rlim[RLIMIT_CPU].rlim_cur; | ||||||
| 				if (i != RLIM_INFINITY && | 				if (i != RLIM_INFINITY && | ||||||
| 				    i <= cputime_to_secs(timer->it.cpu.expires.cpu)) | 				    i <= cputime_to_secs(exp->cpu)) | ||||||
| 					break; | 					break; | ||||||
| 				p->signal->cputime_expires.prof_exp = | 				sig->cputime_expires.prof_exp = exp->cpu; | ||||||
| 					timer->it.cpu.expires.cpu; |  | ||||||
| 				break; | 				break; | ||||||
| 			case CPUCLOCK_SCHED: | 			case CPUCLOCK_SCHED: | ||||||
| 				p->signal->cputime_expires.sched_exp = | 				sig->cputime_expires.sched_exp = exp->sched; | ||||||
| 					timer->it.cpu.expires.sched; |  | ||||||
| 				break; | 				break; | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
|  | @ -1070,6 +1070,27 @@ static void stop_process_timers(struct task_struct *tsk) | ||||||
| 	spin_unlock_irqrestore(&cputimer->lock, flags); | 	spin_unlock_irqrestore(&cputimer->lock, flags); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | static void check_cpu_itimer(struct task_struct *tsk, struct cpu_itimer *it, | ||||||
|  | 			     cputime_t *expires, cputime_t cur_time, int signo) | ||||||
|  | { | ||||||
|  | 	if (cputime_eq(it->expires, cputime_zero)) | ||||||
|  | 		return; | ||||||
|  | 
 | ||||||
|  | 	if (cputime_ge(cur_time, it->expires)) { | ||||||
|  | 		it->expires = it->incr; | ||||||
|  | 		if (!cputime_eq(it->expires, cputime_zero)) | ||||||
|  | 			it->expires = cputime_add(it->expires, cur_time); | ||||||
|  | 
 | ||||||
|  | 		__group_send_sig_info(signo, SEND_SIG_PRIV, tsk); | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	if (!cputime_eq(it->expires, cputime_zero) && | ||||||
|  | 	    (cputime_eq(*expires, cputime_zero) || | ||||||
|  | 	     cputime_lt(it->expires, *expires))) { | ||||||
|  | 		*expires = it->expires; | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  | 
 | ||||||
| /*
 | /*
 | ||||||
|  * Check for any per-thread CPU timers that have fired and move them |  * 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 |  * off the tsk->*_timers list onto the firing list.  Per-thread timers | ||||||
|  | @ -1089,10 +1110,10 @@ static void check_process_timers(struct task_struct *tsk, | ||||||
| 	 * Don't sample the current process CPU clocks if there are no timers. | 	 * Don't sample the current process CPU clocks if there are no timers. | ||||||
| 	 */ | 	 */ | ||||||
| 	if (list_empty(&timers[CPUCLOCK_PROF]) && | 	if (list_empty(&timers[CPUCLOCK_PROF]) && | ||||||
| 	    cputime_eq(sig->it_prof_expires, cputime_zero) && | 	    cputime_eq(sig->it[CPUCLOCK_PROF].expires, cputime_zero) && | ||||||
| 	    sig->rlim[RLIMIT_CPU].rlim_cur == RLIM_INFINITY && | 	    sig->rlim[RLIMIT_CPU].rlim_cur == RLIM_INFINITY && | ||||||
| 	    list_empty(&timers[CPUCLOCK_VIRT]) && | 	    list_empty(&timers[CPUCLOCK_VIRT]) && | ||||||
| 	    cputime_eq(sig->it_virt_expires, cputime_zero) && | 	    cputime_eq(sig->it[CPUCLOCK_VIRT].expires, cputime_zero) && | ||||||
| 	    list_empty(&timers[CPUCLOCK_SCHED])) { | 	    list_empty(&timers[CPUCLOCK_SCHED])) { | ||||||
| 		stop_process_timers(tsk); | 		stop_process_timers(tsk); | ||||||
| 		return; | 		return; | ||||||
|  | @ -1152,38 +1173,11 @@ static void check_process_timers(struct task_struct *tsk, | ||||||
| 	/*
 | 	/*
 | ||||||
| 	 * Check for the special case process timers. | 	 * Check for the special case process timers. | ||||||
| 	 */ | 	 */ | ||||||
| 	if (!cputime_eq(sig->it_prof_expires, cputime_zero)) { | 	check_cpu_itimer(tsk, &sig->it[CPUCLOCK_PROF], &prof_expires, ptime, | ||||||
| 		if (cputime_ge(ptime, sig->it_prof_expires)) { | 			 SIGPROF); | ||||||
| 			/* ITIMER_PROF fires and reloads.  */ | 	check_cpu_itimer(tsk, &sig->it[CPUCLOCK_VIRT], &virt_expires, utime, | ||||||
| 			sig->it_prof_expires = sig->it_prof_incr; | 			 SIGVTALRM); | ||||||
| 			if (!cputime_eq(sig->it_prof_expires, cputime_zero)) { | 
 | ||||||
| 				sig->it_prof_expires = cputime_add( |  | ||||||
| 					sig->it_prof_expires, ptime); |  | ||||||
| 			} |  | ||||||
| 			__group_send_sig_info(SIGPROF, SEND_SIG_PRIV, tsk); |  | ||||||
| 		} |  | ||||||
| 		if (!cputime_eq(sig->it_prof_expires, cputime_zero) && |  | ||||||
| 		    (cputime_eq(prof_expires, cputime_zero) || |  | ||||||
| 		     cputime_lt(sig->it_prof_expires, prof_expires))) { |  | ||||||
| 			prof_expires = sig->it_prof_expires; |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| 	if (!cputime_eq(sig->it_virt_expires, cputime_zero)) { |  | ||||||
| 		if (cputime_ge(utime, sig->it_virt_expires)) { |  | ||||||
| 			/* ITIMER_VIRTUAL fires and reloads.  */ |  | ||||||
| 			sig->it_virt_expires = sig->it_virt_incr; |  | ||||||
| 			if (!cputime_eq(sig->it_virt_expires, cputime_zero)) { |  | ||||||
| 				sig->it_virt_expires = cputime_add( |  | ||||||
| 					sig->it_virt_expires, utime); |  | ||||||
| 			} |  | ||||||
| 			__group_send_sig_info(SIGVTALRM, SEND_SIG_PRIV, tsk); |  | ||||||
| 		} |  | ||||||
| 		if (!cputime_eq(sig->it_virt_expires, cputime_zero) && |  | ||||||
| 		    (cputime_eq(virt_expires, cputime_zero) || |  | ||||||
| 		     cputime_lt(sig->it_virt_expires, virt_expires))) { |  | ||||||
| 			virt_expires = sig->it_virt_expires; |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| 	if (sig->rlim[RLIMIT_CPU].rlim_cur != RLIM_INFINITY) { | 	if (sig->rlim[RLIMIT_CPU].rlim_cur != RLIM_INFINITY) { | ||||||
| 		unsigned long psecs = cputime_to_secs(ptime); | 		unsigned long psecs = cputime_to_secs(ptime); | ||||||
| 		cputime_t x; | 		cputime_t x; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Stanislaw Gruszka
				Stanislaw Gruszka