aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/fork.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/fork.c')
-rw-r--r--kernel/fork.c34
1 files changed, 3 insertions, 31 deletions
diff --git a/kernel/fork.c b/kernel/fork.c
index 1d1cd06edbc1..53e780748fe3 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1519,28 +1519,17 @@ void __cleanup_sighand(struct sighand_struct *sighand)
1519 } 1519 }
1520} 1520}
1521 1521
1522#ifdef CONFIG_POSIX_TIMERS
1523/* 1522/*
1524 * Initialize POSIX timer handling for a thread group. 1523 * Initialize POSIX timer handling for a thread group.
1525 */ 1524 */
1526static void posix_cpu_timers_init_group(struct signal_struct *sig) 1525static void posix_cpu_timers_init_group(struct signal_struct *sig)
1527{ 1526{
1527 struct posix_cputimers *pct = &sig->posix_cputimers;
1528 unsigned long cpu_limit; 1528 unsigned long cpu_limit;
1529 1529
1530 cpu_limit = READ_ONCE(sig->rlim[RLIMIT_CPU].rlim_cur); 1530 cpu_limit = READ_ONCE(sig->rlim[RLIMIT_CPU].rlim_cur);
1531 if (cpu_limit != RLIM_INFINITY) { 1531 posix_cputimers_group_init(pct, cpu_limit);
1532 sig->cputime_expires.prof_exp = cpu_limit * NSEC_PER_SEC;
1533 sig->cputimer.running = true;
1534 }
1535
1536 /* The timer lists. */
1537 INIT_LIST_HEAD(&sig->cpu_timers[0]);
1538 INIT_LIST_HEAD(&sig->cpu_timers[1]);
1539 INIT_LIST_HEAD(&sig->cpu_timers[2]);
1540} 1532}
1541#else
1542static inline void posix_cpu_timers_init_group(struct signal_struct *sig) { }
1543#endif
1544 1533
1545static int copy_signal(unsigned long clone_flags, struct task_struct *tsk) 1534static int copy_signal(unsigned long clone_flags, struct task_struct *tsk)
1546{ 1535{
@@ -1642,23 +1631,6 @@ static void rt_mutex_init_task(struct task_struct *p)
1642#endif 1631#endif
1643} 1632}
1644 1633
1645#ifdef CONFIG_POSIX_TIMERS
1646/*
1647 * Initialize POSIX timer handling for a single task.
1648 */
1649static void posix_cpu_timers_init(struct task_struct *tsk)
1650{
1651 tsk->cputime_expires.prof_exp = 0;
1652 tsk->cputime_expires.virt_exp = 0;
1653 tsk->cputime_expires.sched_exp = 0;
1654 INIT_LIST_HEAD(&tsk->cpu_timers[0]);
1655 INIT_LIST_HEAD(&tsk->cpu_timers[1]);
1656 INIT_LIST_HEAD(&tsk->cpu_timers[2]);
1657}
1658#else
1659static inline void posix_cpu_timers_init(struct task_struct *tsk) { }
1660#endif
1661
1662static inline void init_task_pid_links(struct task_struct *task) 1634static inline void init_task_pid_links(struct task_struct *task)
1663{ 1635{
1664 enum pid_type type; 1636 enum pid_type type;
@@ -1945,7 +1917,7 @@ static __latent_entropy struct task_struct *copy_process(
1945 task_io_accounting_init(&p->ioac); 1917 task_io_accounting_init(&p->ioac);
1946 acct_clear_integrals(p); 1918 acct_clear_integrals(p);
1947 1919
1948 posix_cpu_timers_init(p); 1920 posix_cputimers_init(&p->posix_cputimers);
1949 1921
1950 p->io_context = NULL; 1922 p->io_context = NULL;
1951 audit_set_context(p, NULL); 1923 audit_set_context(p, NULL);