aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/sched.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/sched.h')
-rw-r--r--include/linux/sched.h52
1 files changed, 22 insertions, 30 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 43731fe51c97..977cb57d7bc9 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -167,8 +167,8 @@ struct task_group;
167 * need_sleep = false; 167 * need_sleep = false;
168 * wake_up_state(p, TASK_UNINTERRUPTIBLE); 168 * wake_up_state(p, TASK_UNINTERRUPTIBLE);
169 * 169 *
170 * Where wake_up_state() (and all other wakeup primitives) imply enough 170 * where wake_up_state() executes a full memory barrier before accessing the
171 * barriers to order the store of the variable against wakeup. 171 * task state.
172 * 172 *
173 * Wakeup will do: if (@state & p->state) p->state = TASK_RUNNING, that is, 173 * Wakeup will do: if (@state & p->state) p->state = TASK_RUNNING, that is,
174 * once it observes the TASK_UNINTERRUPTIBLE store the waking CPU can issue a 174 * once it observes the TASK_UNINTERRUPTIBLE store the waking CPU can issue a
@@ -722,8 +722,8 @@ struct task_struct {
722 unsigned restore_sigmask:1; 722 unsigned restore_sigmask:1;
723#endif 723#endif
724#ifdef CONFIG_MEMCG 724#ifdef CONFIG_MEMCG
725 unsigned memcg_may_oom:1; 725 unsigned in_user_fault:1;
726#ifndef CONFIG_SLOB 726#ifdef CONFIG_MEMCG_KMEM
727 unsigned memcg_kmem_skip_account:1; 727 unsigned memcg_kmem_skip_account:1;
728#endif 728#endif
729#endif 729#endif
@@ -734,6 +734,10 @@ struct task_struct {
734 /* disallow userland-initiated cgroup migration */ 734 /* disallow userland-initiated cgroup migration */
735 unsigned no_cgroup_migration:1; 735 unsigned no_cgroup_migration:1;
736#endif 736#endif
737#ifdef CONFIG_BLK_CGROUP
738 /* to be used once the psi infrastructure lands upstream. */
739 unsigned use_memdelay:1;
740#endif
737 741
738 unsigned long atomic_flags; /* Flags requiring atomic access. */ 742 unsigned long atomic_flags; /* Flags requiring atomic access. */
739 743
@@ -775,7 +779,8 @@ struct task_struct {
775 struct list_head ptrace_entry; 779 struct list_head ptrace_entry;
776 780
777 /* PID/PID hash table linkage. */ 781 /* PID/PID hash table linkage. */
778 struct pid_link pids[PIDTYPE_MAX]; 782 struct pid *thread_pid;
783 struct hlist_node pid_links[PIDTYPE_MAX];
779 struct list_head thread_group; 784 struct list_head thread_group;
780 struct list_head thread_node; 785 struct list_head thread_node;
781 786
@@ -849,6 +854,7 @@ struct task_struct {
849#endif 854#endif
850#ifdef CONFIG_DETECT_HUNG_TASK 855#ifdef CONFIG_DETECT_HUNG_TASK
851 unsigned long last_switch_count; 856 unsigned long last_switch_count;
857 unsigned long last_switch_time;
852#endif 858#endif
853 /* Filesystem information: */ 859 /* Filesystem information: */
854 struct fs_struct *fs; 860 struct fs_struct *fs;
@@ -1017,7 +1023,6 @@ struct task_struct {
1017 u64 last_sum_exec_runtime; 1023 u64 last_sum_exec_runtime;
1018 struct callback_head numa_work; 1024 struct callback_head numa_work;
1019 1025
1020 struct list_head numa_entry;
1021 struct numa_group *numa_group; 1026 struct numa_group *numa_group;
1022 1027
1023 /* 1028 /*
@@ -1149,6 +1154,13 @@ struct task_struct {
1149 1154
1150 /* Number of pages to reclaim on returning to userland: */ 1155 /* Number of pages to reclaim on returning to userland: */
1151 unsigned int memcg_nr_pages_over_high; 1156 unsigned int memcg_nr_pages_over_high;
1157
1158 /* Used by memcontrol for targeted memcg charge: */
1159 struct mem_cgroup *active_memcg;
1160#endif
1161
1162#ifdef CONFIG_BLK_CGROUP
1163 struct request_queue *throttle_queue;
1152#endif 1164#endif
1153 1165
1154#ifdef CONFIG_UPROBES 1166#ifdef CONFIG_UPROBES
@@ -1199,27 +1211,7 @@ struct task_struct {
1199 1211
1200static inline struct pid *task_pid(struct task_struct *task) 1212static inline struct pid *task_pid(struct task_struct *task)
1201{ 1213{
1202 return task->pids[PIDTYPE_PID].pid; 1214 return task->thread_pid;
1203}
1204
1205static inline struct pid *task_tgid(struct task_struct *task)
1206{
1207 return task->group_leader->pids[PIDTYPE_PID].pid;
1208}
1209
1210/*
1211 * Without tasklist or RCU lock it is not safe to dereference
1212 * the result of task_pgrp/task_session even if task == current,
1213 * we can race with another thread doing sys_setsid/sys_setpgid.
1214 */
1215static inline struct pid *task_pgrp(struct task_struct *task)
1216{
1217 return task->group_leader->pids[PIDTYPE_PGID].pid;
1218}
1219
1220static inline struct pid *task_session(struct task_struct *task)
1221{
1222 return task->group_leader->pids[PIDTYPE_SID].pid;
1223} 1215}
1224 1216
1225/* 1217/*
@@ -1268,7 +1260,7 @@ static inline pid_t task_tgid_nr(struct task_struct *tsk)
1268 */ 1260 */
1269static inline int pid_alive(const struct task_struct *p) 1261static inline int pid_alive(const struct task_struct *p)
1270{ 1262{
1271 return p->pids[PIDTYPE_PID].pid != NULL; 1263 return p->thread_pid != NULL;
1272} 1264}
1273 1265
1274static inline pid_t task_pgrp_nr_ns(struct task_struct *tsk, struct pid_namespace *ns) 1266static inline pid_t task_pgrp_nr_ns(struct task_struct *tsk, struct pid_namespace *ns)
@@ -1294,12 +1286,12 @@ static inline pid_t task_session_vnr(struct task_struct *tsk)
1294 1286
1295static inline pid_t task_tgid_nr_ns(struct task_struct *tsk, struct pid_namespace *ns) 1287static inline pid_t task_tgid_nr_ns(struct task_struct *tsk, struct pid_namespace *ns)
1296{ 1288{
1297 return __task_pid_nr_ns(tsk, __PIDTYPE_TGID, ns); 1289 return __task_pid_nr_ns(tsk, PIDTYPE_TGID, ns);
1298} 1290}
1299 1291
1300static inline pid_t task_tgid_vnr(struct task_struct *tsk) 1292static inline pid_t task_tgid_vnr(struct task_struct *tsk)
1301{ 1293{
1302 return __task_pid_nr_ns(tsk, __PIDTYPE_TGID, NULL); 1294 return __task_pid_nr_ns(tsk, PIDTYPE_TGID, NULL);
1303} 1295}
1304 1296
1305static inline pid_t task_ppid_nr_ns(const struct task_struct *tsk, struct pid_namespace *ns) 1297static inline pid_t task_ppid_nr_ns(const struct task_struct *tsk, struct pid_namespace *ns)