aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/ia64/kernel/asm-offsets.c2
-rw-r--r--arch/ia64/kernel/fsys.S4
-rw-r--r--arch/s390/kernel/perf_cpum_sf.c2
-rw-r--r--fs/exec.c1
-rw-r--r--include/linux/pid.h3
-rw-r--r--include/linux/sched.h4
-rw-r--r--include/linux/sched/signal.h5
-rw-r--r--init/init_task.c2
-rw-r--r--kernel/events/core.c2
-rw-r--r--kernel/exit.c1
-rw-r--r--kernel/fork.c3
-rw-r--r--kernel/pid.c2
-rw-r--r--kernel/time/itimer.c5
-rw-r--r--kernel/time/posix-cpu-timers.c2
14 files changed, 19 insertions, 19 deletions
diff --git a/arch/ia64/kernel/asm-offsets.c b/arch/ia64/kernel/asm-offsets.c
index c1f8a57855af..00e8e2a1eb19 100644
--- a/arch/ia64/kernel/asm-offsets.c
+++ b/arch/ia64/kernel/asm-offsets.c
@@ -67,7 +67,7 @@ void foo(void)
67 DEFINE(IA64_SIGNAL_GROUP_STOP_COUNT_OFFSET,offsetof (struct signal_struct, 67 DEFINE(IA64_SIGNAL_GROUP_STOP_COUNT_OFFSET,offsetof (struct signal_struct,
68 group_stop_count)); 68 group_stop_count));
69 DEFINE(IA64_SIGNAL_SHARED_PENDING_OFFSET,offsetof (struct signal_struct, shared_pending)); 69 DEFINE(IA64_SIGNAL_SHARED_PENDING_OFFSET,offsetof (struct signal_struct, shared_pending));
70 DEFINE(IA64_SIGNAL_LEADER_PID_OFFSET, offsetof (struct signal_struct, leader_pid)); 70 DEFINE(IA64_SIGNAL_PIDS_TGID_OFFSET, offsetof (struct signal_struct, pids[PIDTYPE_TGID]));
71 71
72 BLANK(); 72 BLANK();
73 73
diff --git a/arch/ia64/kernel/fsys.S b/arch/ia64/kernel/fsys.S
index e85ebdac678b..d80c99a5f55d 100644
--- a/arch/ia64/kernel/fsys.S
+++ b/arch/ia64/kernel/fsys.S
@@ -68,10 +68,10 @@ ENTRY(fsys_getpid)
68 add r9=TI_FLAGS+IA64_TASK_SIZE,r16 68 add r9=TI_FLAGS+IA64_TASK_SIZE,r16
69 ;; 69 ;;
70 ld4 r9=[r9] 70 ld4 r9=[r9]
71 add r17=IA64_SIGNAL_LEADER_PID_OFFSET,r17 71 add r17=IA64_SIGNAL_PIDS_TGID_OFFSET,r17
72 ;; 72 ;;
73 and r9=TIF_ALLWORK_MASK,r9 73 and r9=TIF_ALLWORK_MASK,r9
74 ld8 r17=[r17] // r17 = current->signal->leader_pid 74 ld8 r17=[r17] // r17 = current->signal->pids[PIDTYPE_TGID]
75 ;; 75 ;;
76 add r8=IA64_PID_LEVEL_OFFSET,r17 76 add r8=IA64_PID_LEVEL_OFFSET,r17
77 ;; 77 ;;
diff --git a/arch/s390/kernel/perf_cpum_sf.c b/arch/s390/kernel/perf_cpum_sf.c
index 0292d68e7dde..ca0b7ae894bb 100644
--- a/arch/s390/kernel/perf_cpum_sf.c
+++ b/arch/s390/kernel/perf_cpum_sf.c
@@ -665,7 +665,7 @@ static void cpumsf_output_event_pid(struct perf_event *event,
665 goto out; 665 goto out;
666 666
667 /* Update the process ID (see also kernel/events/core.c) */ 667 /* Update the process ID (see also kernel/events/core.c) */
668 data->tid_entry.pid = cpumsf_pid_type(event, pid, __PIDTYPE_TGID); 668 data->tid_entry.pid = cpumsf_pid_type(event, pid, PIDTYPE_TGID);
669 data->tid_entry.tid = cpumsf_pid_type(event, pid, PIDTYPE_PID); 669 data->tid_entry.tid = cpumsf_pid_type(event, pid, PIDTYPE_PID);
670 670
671 perf_output_sample(&handle, &header, data, event); 671 perf_output_sample(&handle, &header, data, event);
diff --git a/fs/exec.c b/fs/exec.c
index 2d4e0075bd24..79a11fbded7a 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1146,6 +1146,7 @@ static int de_thread(struct task_struct *tsk)
1146 */ 1146 */
1147 tsk->pid = leader->pid; 1147 tsk->pid = leader->pid;
1148 change_pid(tsk, PIDTYPE_PID, task_pid(leader)); 1148 change_pid(tsk, PIDTYPE_PID, task_pid(leader));
1149 transfer_pid(leader, tsk, PIDTYPE_TGID);
1149 transfer_pid(leader, tsk, PIDTYPE_PGID); 1150 transfer_pid(leader, tsk, PIDTYPE_PGID);
1150 transfer_pid(leader, tsk, PIDTYPE_SID); 1151 transfer_pid(leader, tsk, PIDTYPE_SID);
1151 1152
diff --git a/include/linux/pid.h b/include/linux/pid.h
index 3d4c504dcc8c..14a9a39da9c7 100644
--- a/include/linux/pid.h
+++ b/include/linux/pid.h
@@ -7,11 +7,10 @@
7enum pid_type 7enum pid_type
8{ 8{
9 PIDTYPE_PID, 9 PIDTYPE_PID,
10 PIDTYPE_TGID,
10 PIDTYPE_PGID, 11 PIDTYPE_PGID,
11 PIDTYPE_SID, 12 PIDTYPE_SID,
12 PIDTYPE_MAX, 13 PIDTYPE_MAX,
13 /* only valid to __task_pid_nr_ns() */
14 __PIDTYPE_TGID
15}; 14};
16 15
17/* 16/*
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 445bdf5b1f64..06b4e3bda93a 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1275,12 +1275,12 @@ static inline pid_t task_session_vnr(struct task_struct *tsk)
1275 1275
1276static inline pid_t task_tgid_nr_ns(struct task_struct *tsk, struct pid_namespace *ns) 1276static inline pid_t task_tgid_nr_ns(struct task_struct *tsk, struct pid_namespace *ns)
1277{ 1277{
1278 return __task_pid_nr_ns(tsk, __PIDTYPE_TGID, ns); 1278 return __task_pid_nr_ns(tsk, PIDTYPE_TGID, ns);
1279} 1279}
1280 1280
1281static inline pid_t task_tgid_vnr(struct task_struct *tsk) 1281static inline pid_t task_tgid_vnr(struct task_struct *tsk)
1282{ 1282{
1283 return __task_pid_nr_ns(tsk, __PIDTYPE_TGID, NULL); 1283 return __task_pid_nr_ns(tsk, PIDTYPE_TGID, NULL);
1284} 1284}
1285 1285
1286static inline pid_t task_ppid_nr_ns(const struct task_struct *tsk, struct pid_namespace *ns) 1286static inline pid_t task_ppid_nr_ns(const struct task_struct *tsk, struct pid_namespace *ns)
diff --git a/include/linux/sched/signal.h b/include/linux/sched/signal.h
index 2dcded16eb1e..ee30a5ba475f 100644
--- a/include/linux/sched/signal.h
+++ b/include/linux/sched/signal.h
@@ -147,7 +147,6 @@ struct signal_struct {
147#endif 147#endif
148 148
149 /* PID/PID hash table linkage. */ 149 /* PID/PID hash table linkage. */
150 struct pid *leader_pid;
151 struct pid *pids[PIDTYPE_MAX]; 150 struct pid *pids[PIDTYPE_MAX];
152 151
153#ifdef CONFIG_NO_HZ_FULL 152#ifdef CONFIG_NO_HZ_FULL
@@ -571,7 +570,7 @@ struct pid *task_pid_type(struct task_struct *task, enum pid_type type)
571 570
572static inline struct pid *task_tgid(struct task_struct *task) 571static inline struct pid *task_tgid(struct task_struct *task)
573{ 572{
574 return task->signal->leader_pid; 573 return task->signal->pids[PIDTYPE_TGID];
575} 574}
576 575
577/* 576/*
@@ -607,7 +606,7 @@ static inline bool thread_group_leader(struct task_struct *p)
607 */ 606 */
608static inline bool has_group_leader_pid(struct task_struct *p) 607static inline bool has_group_leader_pid(struct task_struct *p)
609{ 608{
610 return task_pid(p) == p->signal->leader_pid; 609 return task_pid(p) == task_tgid(p);
611} 610}
612 611
613static inline 612static inline
diff --git a/init/init_task.c b/init/init_task.c
index db12a61259f1..4f97846256d7 100644
--- a/init/init_task.c
+++ b/init/init_task.c
@@ -33,9 +33,9 @@ static struct signal_struct init_signals = {
33 }, 33 },
34#endif 34#endif
35 INIT_CPU_TIMERS(init_signals) 35 INIT_CPU_TIMERS(init_signals)
36 .leader_pid = &init_struct_pid,
37 .pids = { 36 .pids = {
38 [PIDTYPE_PID] = &init_struct_pid, 37 [PIDTYPE_PID] = &init_struct_pid,
38 [PIDTYPE_TGID] = &init_struct_pid,
39 [PIDTYPE_PGID] = &init_struct_pid, 39 [PIDTYPE_PGID] = &init_struct_pid,
40 [PIDTYPE_SID] = &init_struct_pid, 40 [PIDTYPE_SID] = &init_struct_pid,
41 }, 41 },
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 80cca2b30c4f..9025b1796ca8 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -1334,7 +1334,7 @@ static u32 perf_event_pid_type(struct perf_event *event, struct task_struct *p,
1334 1334
1335static u32 perf_event_pid(struct perf_event *event, struct task_struct *p) 1335static u32 perf_event_pid(struct perf_event *event, struct task_struct *p)
1336{ 1336{
1337 return perf_event_pid_type(event, p, __PIDTYPE_TGID); 1337 return perf_event_pid_type(event, p, PIDTYPE_TGID);
1338} 1338}
1339 1339
1340static u32 perf_event_tid(struct perf_event *event, struct task_struct *p) 1340static u32 perf_event_tid(struct perf_event *event, struct task_struct *p)
diff --git a/kernel/exit.c b/kernel/exit.c
index 16432428fc6c..25582b442955 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -73,6 +73,7 @@ static void __unhash_process(struct task_struct *p, bool group_dead)
73 nr_threads--; 73 nr_threads--;
74 detach_pid(p, PIDTYPE_PID); 74 detach_pid(p, PIDTYPE_PID);
75 if (group_dead) { 75 if (group_dead) {
76 detach_pid(p, PIDTYPE_TGID);
76 detach_pid(p, PIDTYPE_PGID); 77 detach_pid(p, PIDTYPE_PGID);
77 detach_pid(p, PIDTYPE_SID); 78 detach_pid(p, PIDTYPE_SID);
78 79
diff --git a/kernel/fork.c b/kernel/fork.c
index d2952162399b..cc5be0d01ce6 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1946,6 +1946,7 @@ static __latent_entropy struct task_struct *copy_process(
1946 1946
1947 init_task_pid(p, PIDTYPE_PID, pid); 1947 init_task_pid(p, PIDTYPE_PID, pid);
1948 if (thread_group_leader(p)) { 1948 if (thread_group_leader(p)) {
1949 init_task_pid(p, PIDTYPE_TGID, pid);
1949 init_task_pid(p, PIDTYPE_PGID, task_pgrp(current)); 1950 init_task_pid(p, PIDTYPE_PGID, task_pgrp(current));
1950 init_task_pid(p, PIDTYPE_SID, task_session(current)); 1951 init_task_pid(p, PIDTYPE_SID, task_session(current));
1951 1952
@@ -1954,7 +1955,6 @@ static __latent_entropy struct task_struct *copy_process(
1954 p->signal->flags |= SIGNAL_UNKILLABLE; 1955 p->signal->flags |= SIGNAL_UNKILLABLE;
1955 } 1956 }
1956 1957
1957 p->signal->leader_pid = pid;
1958 p->signal->tty = tty_kref_get(current->signal->tty); 1958 p->signal->tty = tty_kref_get(current->signal->tty);
1959 /* 1959 /*
1960 * Inherit has_child_subreaper flag under the same 1960 * Inherit has_child_subreaper flag under the same
@@ -1965,6 +1965,7 @@ static __latent_entropy struct task_struct *copy_process(
1965 p->real_parent->signal->is_child_subreaper; 1965 p->real_parent->signal->is_child_subreaper;
1966 list_add_tail(&p->sibling, &p->real_parent->children); 1966 list_add_tail(&p->sibling, &p->real_parent->children);
1967 list_add_tail_rcu(&p->tasks, &init_task.tasks); 1967 list_add_tail_rcu(&p->tasks, &init_task.tasks);
1968 attach_pid(p, PIDTYPE_TGID);
1968 attach_pid(p, PIDTYPE_PGID); 1969 attach_pid(p, PIDTYPE_PGID);
1969 attach_pid(p, PIDTYPE_SID); 1970 attach_pid(p, PIDTYPE_SID);
1970 __this_cpu_inc(process_counts); 1971 __this_cpu_inc(process_counts);
diff --git a/kernel/pid.c b/kernel/pid.c
index f8486d2e2346..de1cfc4f75a2 100644
--- a/kernel/pid.c
+++ b/kernel/pid.c
@@ -269,8 +269,6 @@ static struct pid **task_pid_ptr(struct task_struct *task, enum pid_type type)
269{ 269{
270 return (type == PIDTYPE_PID) ? 270 return (type == PIDTYPE_PID) ?
271 &task->thread_pid : 271 &task->thread_pid :
272 (type == __PIDTYPE_TGID) ?
273 &task->signal->leader_pid :
274 &task->signal->pids[type]; 272 &task->signal->pids[type];
275} 273}
276 274
diff --git a/kernel/time/itimer.c b/kernel/time/itimer.c
index f26acef5d7b4..9a65713c8309 100644
--- a/kernel/time/itimer.c
+++ b/kernel/time/itimer.c
@@ -139,9 +139,10 @@ enum hrtimer_restart it_real_fn(struct hrtimer *timer)
139{ 139{
140 struct signal_struct *sig = 140 struct signal_struct *sig =
141 container_of(timer, struct signal_struct, real_timer); 141 container_of(timer, struct signal_struct, real_timer);
142 struct pid *leader_pid = sig->pids[PIDTYPE_TGID];
142 143
143 trace_itimer_expire(ITIMER_REAL, sig->leader_pid, 0); 144 trace_itimer_expire(ITIMER_REAL, leader_pid, 0);
144 kill_pid_info(SIGALRM, SEND_SIG_PRIV, sig->leader_pid); 145 kill_pid_info(SIGALRM, SEND_SIG_PRIV, leader_pid);
145 146
146 return HRTIMER_NORESTART; 147 return HRTIMER_NORESTART;
147} 148}
diff --git a/kernel/time/posix-cpu-timers.c b/kernel/time/posix-cpu-timers.c
index 5a6251ac6f7a..40e6fae46cec 100644
--- a/kernel/time/posix-cpu-timers.c
+++ b/kernel/time/posix-cpu-timers.c
@@ -895,7 +895,7 @@ static void check_cpu_itimer(struct task_struct *tsk, struct cpu_itimer *it,
895 895
896 trace_itimer_expire(signo == SIGPROF ? 896 trace_itimer_expire(signo == SIGPROF ?
897 ITIMER_PROF : ITIMER_VIRTUAL, 897 ITIMER_PROF : ITIMER_VIRTUAL,
898 tsk->signal->leader_pid, cur_time); 898 task_tgid(tsk), cur_time);
899 __group_send_sig_info(signo, SEND_SIG_PRIV, tsk); 899 __group_send_sig_info(signo, SEND_SIG_PRIV, tsk);
900 } 900 }
901 901