aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/fork.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/fork.c')
-rw-r--r--kernel/fork.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/kernel/fork.c b/kernel/fork.c
index ea33f8adc032..ff82e24573b6 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1306,6 +1306,7 @@ void __cleanup_sighand(struct sighand_struct *sighand)
1306 } 1306 }
1307} 1307}
1308 1308
1309#ifdef CONFIG_POSIX_TIMERS
1309/* 1310/*
1310 * Initialize POSIX timer handling for a thread group. 1311 * Initialize POSIX timer handling for a thread group.
1311 */ 1312 */
@@ -1315,7 +1316,7 @@ static void posix_cpu_timers_init_group(struct signal_struct *sig)
1315 1316
1316 cpu_limit = READ_ONCE(sig->rlim[RLIMIT_CPU].rlim_cur); 1317 cpu_limit = READ_ONCE(sig->rlim[RLIMIT_CPU].rlim_cur);
1317 if (cpu_limit != RLIM_INFINITY) { 1318 if (cpu_limit != RLIM_INFINITY) {
1318 sig->cputime_expires.prof_exp = secs_to_cputime(cpu_limit); 1319 sig->cputime_expires.prof_exp = cpu_limit * NSEC_PER_SEC;
1319 sig->cputimer.running = true; 1320 sig->cputimer.running = true;
1320 } 1321 }
1321 1322
@@ -1324,6 +1325,9 @@ static void posix_cpu_timers_init_group(struct signal_struct *sig)
1324 INIT_LIST_HEAD(&sig->cpu_timers[1]); 1325 INIT_LIST_HEAD(&sig->cpu_timers[1]);
1325 INIT_LIST_HEAD(&sig->cpu_timers[2]); 1326 INIT_LIST_HEAD(&sig->cpu_timers[2]);
1326} 1327}
1328#else
1329static inline void posix_cpu_timers_init_group(struct signal_struct *sig) { }
1330#endif
1327 1331
1328static int copy_signal(unsigned long clone_flags, struct task_struct *tsk) 1332static int copy_signal(unsigned long clone_flags, struct task_struct *tsk)
1329{ 1333{
@@ -1348,11 +1352,11 @@ static int copy_signal(unsigned long clone_flags, struct task_struct *tsk)
1348 init_waitqueue_head(&sig->wait_chldexit); 1352 init_waitqueue_head(&sig->wait_chldexit);
1349 sig->curr_target = tsk; 1353 sig->curr_target = tsk;
1350 init_sigpending(&sig->shared_pending); 1354 init_sigpending(&sig->shared_pending);
1351 INIT_LIST_HEAD(&sig->posix_timers);
1352 seqlock_init(&sig->stats_lock); 1355 seqlock_init(&sig->stats_lock);
1353 prev_cputime_init(&sig->prev_cputime); 1356 prev_cputime_init(&sig->prev_cputime);
1354 1357
1355#ifdef CONFIG_POSIX_TIMERS 1358#ifdef CONFIG_POSIX_TIMERS
1359 INIT_LIST_HEAD(&sig->posix_timers);
1356 hrtimer_init(&sig->real_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); 1360 hrtimer_init(&sig->real_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
1357 sig->real_timer.function = it_real_fn; 1361 sig->real_timer.function = it_real_fn;
1358#endif 1362#endif
@@ -1427,6 +1431,7 @@ static void rt_mutex_init_task(struct task_struct *p)
1427#endif 1431#endif
1428} 1432}
1429 1433
1434#ifdef CONFIG_POSIX_TIMERS
1430/* 1435/*
1431 * Initialize POSIX timer handling for a single task. 1436 * Initialize POSIX timer handling for a single task.
1432 */ 1437 */
@@ -1439,6 +1444,9 @@ static void posix_cpu_timers_init(struct task_struct *tsk)
1439 INIT_LIST_HEAD(&tsk->cpu_timers[1]); 1444 INIT_LIST_HEAD(&tsk->cpu_timers[1]);
1440 INIT_LIST_HEAD(&tsk->cpu_timers[2]); 1445 INIT_LIST_HEAD(&tsk->cpu_timers[2]);
1441} 1446}
1447#else
1448static inline void posix_cpu_timers_init(struct task_struct *tsk) { }
1449#endif
1442 1450
1443static inline void 1451static inline void
1444init_task_pid(struct task_struct *task, enum pid_type type, struct pid *pid) 1452init_task_pid(struct task_struct *task, enum pid_type type, struct pid *pid)