diff options
Diffstat (limited to 'include/linux/sched.h')
| -rw-r--r-- | include/linux/sched.h | 145 |
1 files changed, 105 insertions, 40 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index 26a2e6122734..6633e83e608a 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
| @@ -25,7 +25,7 @@ struct sched_param { | |||
| 25 | #include <linux/errno.h> | 25 | #include <linux/errno.h> |
| 26 | #include <linux/nodemask.h> | 26 | #include <linux/nodemask.h> |
| 27 | #include <linux/mm_types.h> | 27 | #include <linux/mm_types.h> |
| 28 | #include <linux/preempt_mask.h> | 28 | #include <linux/preempt.h> |
| 29 | 29 | ||
| 30 | #include <asm/page.h> | 30 | #include <asm/page.h> |
| 31 | #include <asm/ptrace.h> | 31 | #include <asm/ptrace.h> |
| @@ -132,6 +132,7 @@ struct fs_struct; | |||
| 132 | struct perf_event_context; | 132 | struct perf_event_context; |
| 133 | struct blk_plug; | 133 | struct blk_plug; |
| 134 | struct filename; | 134 | struct filename; |
| 135 | struct nameidata; | ||
| 135 | 136 | ||
| 136 | #define VMACACHE_BITS 2 | 137 | #define VMACACHE_BITS 2 |
| 137 | #define VMACACHE_SIZE (1U << VMACACHE_BITS) | 138 | #define VMACACHE_SIZE (1U << VMACACHE_BITS) |
| @@ -173,7 +174,12 @@ extern unsigned long nr_iowait_cpu(int cpu); | |||
| 173 | extern void get_iowait_load(unsigned long *nr_waiters, unsigned long *load); | 174 | extern void get_iowait_load(unsigned long *nr_waiters, unsigned long *load); |
| 174 | 175 | ||
| 175 | extern void calc_global_load(unsigned long ticks); | 176 | extern void calc_global_load(unsigned long ticks); |
| 177 | |||
| 178 | #if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ_COMMON) | ||
| 176 | extern void update_cpu_load_nohz(void); | 179 | extern void update_cpu_load_nohz(void); |
| 180 | #else | ||
| 181 | static inline void update_cpu_load_nohz(void) { } | ||
| 182 | #endif | ||
| 177 | 183 | ||
| 178 | extern unsigned long get_parent_ip(unsigned long addr); | 184 | extern unsigned long get_parent_ip(unsigned long addr); |
| 179 | 185 | ||
| @@ -213,9 +219,10 @@ print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq); | |||
| 213 | #define TASK_WAKEKILL 128 | 219 | #define TASK_WAKEKILL 128 |
| 214 | #define TASK_WAKING 256 | 220 | #define TASK_WAKING 256 |
| 215 | #define TASK_PARKED 512 | 221 | #define TASK_PARKED 512 |
| 216 | #define TASK_STATE_MAX 1024 | 222 | #define TASK_NOLOAD 1024 |
| 223 | #define TASK_STATE_MAX 2048 | ||
| 217 | 224 | ||
| 218 | #define TASK_STATE_TO_CHAR_STR "RSDTtXZxKWP" | 225 | #define TASK_STATE_TO_CHAR_STR "RSDTtXZxKWPN" |
| 219 | 226 | ||
| 220 | extern char ___assert_task_state[1 - 2*!!( | 227 | extern char ___assert_task_state[1 - 2*!!( |
| 221 | sizeof(TASK_STATE_TO_CHAR_STR)-1 != ilog2(TASK_STATE_MAX)+1)]; | 228 | sizeof(TASK_STATE_TO_CHAR_STR)-1 != ilog2(TASK_STATE_MAX)+1)]; |
| @@ -225,6 +232,8 @@ extern char ___assert_task_state[1 - 2*!!( | |||
| 225 | #define TASK_STOPPED (TASK_WAKEKILL | __TASK_STOPPED) | 232 | #define TASK_STOPPED (TASK_WAKEKILL | __TASK_STOPPED) |
| 226 | #define TASK_TRACED (TASK_WAKEKILL | __TASK_TRACED) | 233 | #define TASK_TRACED (TASK_WAKEKILL | __TASK_TRACED) |
| 227 | 234 | ||
| 235 | #define TASK_IDLE (TASK_UNINTERRUPTIBLE | TASK_NOLOAD) | ||
| 236 | |||
| 228 | /* Convenience macros for the sake of wake_up */ | 237 | /* Convenience macros for the sake of wake_up */ |
| 229 | #define TASK_NORMAL (TASK_INTERRUPTIBLE | TASK_UNINTERRUPTIBLE) | 238 | #define TASK_NORMAL (TASK_INTERRUPTIBLE | TASK_UNINTERRUPTIBLE) |
| 230 | #define TASK_ALL (TASK_NORMAL | __TASK_STOPPED | __TASK_TRACED) | 239 | #define TASK_ALL (TASK_NORMAL | __TASK_STOPPED | __TASK_TRACED) |
| @@ -240,7 +249,8 @@ extern char ___assert_task_state[1 - 2*!!( | |||
| 240 | ((task->state & (__TASK_STOPPED | __TASK_TRACED)) != 0) | 249 | ((task->state & (__TASK_STOPPED | __TASK_TRACED)) != 0) |
| 241 | #define task_contributes_to_load(task) \ | 250 | #define task_contributes_to_load(task) \ |
| 242 | ((task->state & TASK_UNINTERRUPTIBLE) != 0 && \ | 251 | ((task->state & TASK_UNINTERRUPTIBLE) != 0 && \ |
| 243 | (task->flags & PF_FROZEN) == 0) | 252 | (task->flags & PF_FROZEN) == 0 && \ |
| 253 | (task->state & TASK_NOLOAD) == 0) | ||
| 244 | 254 | ||
| 245 | #ifdef CONFIG_DEBUG_ATOMIC_SLEEP | 255 | #ifdef CONFIG_DEBUG_ATOMIC_SLEEP |
| 246 | 256 | ||
| @@ -252,7 +262,7 @@ extern char ___assert_task_state[1 - 2*!!( | |||
| 252 | #define set_task_state(tsk, state_value) \ | 262 | #define set_task_state(tsk, state_value) \ |
| 253 | do { \ | 263 | do { \ |
| 254 | (tsk)->task_state_change = _THIS_IP_; \ | 264 | (tsk)->task_state_change = _THIS_IP_; \ |
| 255 | set_mb((tsk)->state, (state_value)); \ | 265 | smp_store_mb((tsk)->state, (state_value)); \ |
| 256 | } while (0) | 266 | } while (0) |
| 257 | 267 | ||
| 258 | /* | 268 | /* |
| @@ -274,7 +284,7 @@ extern char ___assert_task_state[1 - 2*!!( | |||
| 274 | #define set_current_state(state_value) \ | 284 | #define set_current_state(state_value) \ |
| 275 | do { \ | 285 | do { \ |
| 276 | current->task_state_change = _THIS_IP_; \ | 286 | current->task_state_change = _THIS_IP_; \ |
| 277 | set_mb(current->state, (state_value)); \ | 287 | smp_store_mb(current->state, (state_value)); \ |
| 278 | } while (0) | 288 | } while (0) |
| 279 | 289 | ||
| 280 | #else | 290 | #else |
| @@ -282,7 +292,7 @@ extern char ___assert_task_state[1 - 2*!!( | |||
| 282 | #define __set_task_state(tsk, state_value) \ | 292 | #define __set_task_state(tsk, state_value) \ |
| 283 | do { (tsk)->state = (state_value); } while (0) | 293 | do { (tsk)->state = (state_value); } while (0) |
| 284 | #define set_task_state(tsk, state_value) \ | 294 | #define set_task_state(tsk, state_value) \ |
| 285 | set_mb((tsk)->state, (state_value)) | 295 | smp_store_mb((tsk)->state, (state_value)) |
| 286 | 296 | ||
| 287 | /* | 297 | /* |
| 288 | * set_current_state() includes a barrier so that the write of current->state | 298 | * set_current_state() includes a barrier so that the write of current->state |
| @@ -298,7 +308,7 @@ extern char ___assert_task_state[1 - 2*!!( | |||
| 298 | #define __set_current_state(state_value) \ | 308 | #define __set_current_state(state_value) \ |
| 299 | do { current->state = (state_value); } while (0) | 309 | do { current->state = (state_value); } while (0) |
| 300 | #define set_current_state(state_value) \ | 310 | #define set_current_state(state_value) \ |
| 301 | set_mb(current->state, (state_value)) | 311 | smp_store_mb(current->state, (state_value)) |
| 302 | 312 | ||
| 303 | #endif | 313 | #endif |
| 304 | 314 | ||
| @@ -335,14 +345,10 @@ extern int runqueue_is_locked(int cpu); | |||
| 335 | #if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ_COMMON) | 345 | #if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ_COMMON) |
| 336 | extern void nohz_balance_enter_idle(int cpu); | 346 | extern void nohz_balance_enter_idle(int cpu); |
| 337 | extern void set_cpu_sd_state_idle(void); | 347 | extern void set_cpu_sd_state_idle(void); |
| 338 | extern int get_nohz_timer_target(int pinned); | 348 | extern int get_nohz_timer_target(void); |
| 339 | #else | 349 | #else |
| 340 | static inline void nohz_balance_enter_idle(int cpu) { } | 350 | static inline void nohz_balance_enter_idle(int cpu) { } |
| 341 | static inline void set_cpu_sd_state_idle(void) { } | 351 | static inline void set_cpu_sd_state_idle(void) { } |
| 342 | static inline int get_nohz_timer_target(int pinned) | ||
| 343 | { | ||
| 344 | return smp_processor_id(); | ||
| 345 | } | ||
| 346 | #endif | 352 | #endif |
| 347 | 353 | ||
| 348 | /* | 354 | /* |
| @@ -567,6 +573,23 @@ struct task_cputime { | |||
| 567 | .sum_exec_runtime = 0, \ | 573 | .sum_exec_runtime = 0, \ |
| 568 | } | 574 | } |
| 569 | 575 | ||
| 576 | /* | ||
| 577 | * This is the atomic variant of task_cputime, which can be used for | ||
| 578 | * storing and updating task_cputime statistics without locking. | ||
| 579 | */ | ||
| 580 | struct task_cputime_atomic { | ||
| 581 | atomic64_t utime; | ||
| 582 | atomic64_t stime; | ||
| 583 | atomic64_t sum_exec_runtime; | ||
| 584 | }; | ||
| 585 | |||
| 586 | #define INIT_CPUTIME_ATOMIC \ | ||
| 587 | (struct task_cputime_atomic) { \ | ||
| 588 | .utime = ATOMIC64_INIT(0), \ | ||
| 589 | .stime = ATOMIC64_INIT(0), \ | ||
| 590 | .sum_exec_runtime = ATOMIC64_INIT(0), \ | ||
| 591 | } | ||
| 592 | |||
| 570 | #ifdef CONFIG_PREEMPT_COUNT | 593 | #ifdef CONFIG_PREEMPT_COUNT |
| 571 | #define PREEMPT_DISABLED (1 + PREEMPT_ENABLED) | 594 | #define PREEMPT_DISABLED (1 + PREEMPT_ENABLED) |
| 572 | #else | 595 | #else |
| @@ -584,18 +607,16 @@ struct task_cputime { | |||
| 584 | 607 | ||
| 585 | /** | 608 | /** |
| 586 | * struct thread_group_cputimer - thread group interval timer counts | 609 | * struct thread_group_cputimer - thread group interval timer counts |
| 587 | * @cputime: thread group interval timers. | 610 | * @cputime_atomic: atomic thread group interval timers. |
| 588 | * @running: non-zero when there are timers running and | 611 | * @running: non-zero when there are timers running and |
| 589 | * @cputime receives updates. | 612 | * @cputime receives updates. |
| 590 | * @lock: lock for fields in this struct. | ||
| 591 | * | 613 | * |
| 592 | * This structure contains the version of task_cputime, above, that is | 614 | * This structure contains the version of task_cputime, above, that is |
| 593 | * used for thread group CPU timer calculations. | 615 | * used for thread group CPU timer calculations. |
| 594 | */ | 616 | */ |
| 595 | struct thread_group_cputimer { | 617 | struct thread_group_cputimer { |
| 596 | struct task_cputime cputime; | 618 | struct task_cputime_atomic cputime_atomic; |
| 597 | int running; | 619 | int running; |
| 598 | raw_spinlock_t lock; | ||
| 599 | }; | 620 | }; |
| 600 | 621 | ||
| 601 | #include <linux/rwsem.h> | 622 | #include <linux/rwsem.h> |
| @@ -900,6 +921,50 @@ enum cpu_idle_type { | |||
| 900 | #define SCHED_CAPACITY_SCALE (1L << SCHED_CAPACITY_SHIFT) | 921 | #define SCHED_CAPACITY_SCALE (1L << SCHED_CAPACITY_SHIFT) |
| 901 | 922 | ||
| 902 | /* | 923 | /* |
| 924 | * Wake-queues are lists of tasks with a pending wakeup, whose | ||
| 925 | * callers have already marked the task as woken internally, | ||
| 926 | * and can thus carry on. A common use case is being able to | ||
| 927 | * do the wakeups once the corresponding user lock as been | ||
| 928 | * released. | ||
| 929 | * | ||
| 930 | * We hold reference to each task in the list across the wakeup, | ||
| 931 | * thus guaranteeing that the memory is still valid by the time | ||
| 932 | * the actual wakeups are performed in wake_up_q(). | ||
| 933 | * | ||
| 934 | * One per task suffices, because there's never a need for a task to be | ||
| 935 | * in two wake queues simultaneously; it is forbidden to abandon a task | ||
| 936 | * in a wake queue (a call to wake_up_q() _must_ follow), so if a task is | ||
| 937 | * already in a wake queue, the wakeup will happen soon and the second | ||
| 938 | * waker can just skip it. | ||
| 939 | * | ||
| 940 | * The WAKE_Q macro declares and initializes the list head. | ||
| 941 | * wake_up_q() does NOT reinitialize the list; it's expected to be | ||
| 942 | * called near the end of a function, where the fact that the queue is | ||
| 943 | * not used again will be easy to see by inspection. | ||
| 944 | * | ||
| 945 | * Note that this can cause spurious wakeups. schedule() callers | ||
| 946 | * must ensure the call is done inside a loop, confirming that the | ||
| 947 | * wakeup condition has in fact occurred. | ||
| 948 | */ | ||
| 949 | struct wake_q_node { | ||
| 950 | struct wake_q_node *next; | ||
| 951 | }; | ||
| 952 | |||
| 953 | struct wake_q_head { | ||
| 954 | struct wake_q_node *first; | ||
| 955 | struct wake_q_node **lastp; | ||
| 956 | }; | ||
| 957 | |||
| 958 | #define WAKE_Q_TAIL ((struct wake_q_node *) 0x01) | ||
| 959 | |||
| 960 | #define WAKE_Q(name) \ | ||
| 961 | struct wake_q_head name = { WAKE_Q_TAIL, &name.first } | ||
| 962 | |||
| 963 | extern void wake_q_add(struct wake_q_head *head, | ||
| 964 | struct task_struct *task); | ||
| 965 | extern void wake_up_q(struct wake_q_head *head); | ||
| 966 | |||
| 967 | /* | ||
| 903 | * sched-domains (multiprocessor balancing) declarations: | 968 | * sched-domains (multiprocessor balancing) declarations: |
| 904 | */ | 969 | */ |
| 905 | #ifdef CONFIG_SMP | 970 | #ifdef CONFIG_SMP |
| @@ -1334,8 +1399,6 @@ struct task_struct { | |||
| 1334 | int rcu_read_lock_nesting; | 1399 | int rcu_read_lock_nesting; |
| 1335 | union rcu_special rcu_read_unlock_special; | 1400 | union rcu_special rcu_read_unlock_special; |
| 1336 | struct list_head rcu_node_entry; | 1401 | struct list_head rcu_node_entry; |
| 1337 | #endif /* #ifdef CONFIG_PREEMPT_RCU */ | ||
| 1338 | #ifdef CONFIG_PREEMPT_RCU | ||
| 1339 | struct rcu_node *rcu_blocked_node; | 1402 | struct rcu_node *rcu_blocked_node; |
| 1340 | #endif /* #ifdef CONFIG_PREEMPT_RCU */ | 1403 | #endif /* #ifdef CONFIG_PREEMPT_RCU */ |
| 1341 | #ifdef CONFIG_TASKS_RCU | 1404 | #ifdef CONFIG_TASKS_RCU |
| @@ -1356,9 +1419,6 @@ struct task_struct { | |||
| 1356 | #endif | 1419 | #endif |
| 1357 | 1420 | ||
| 1358 | struct mm_struct *mm, *active_mm; | 1421 | struct mm_struct *mm, *active_mm; |
| 1359 | #ifdef CONFIG_COMPAT_BRK | ||
| 1360 | unsigned brk_randomized:1; | ||
| 1361 | #endif | ||
| 1362 | /* per-thread vma caching */ | 1422 | /* per-thread vma caching */ |
| 1363 | u32 vmacache_seqnum; | 1423 | u32 vmacache_seqnum; |
| 1364 | struct vm_area_struct *vmacache[VMACACHE_SIZE]; | 1424 | struct vm_area_struct *vmacache[VMACACHE_SIZE]; |
| @@ -1369,7 +1429,7 @@ struct task_struct { | |||
| 1369 | int exit_state; | 1429 | int exit_state; |
| 1370 | int exit_code, exit_signal; | 1430 | int exit_code, exit_signal; |
| 1371 | int pdeath_signal; /* The signal sent when the parent dies */ | 1431 | int pdeath_signal; /* The signal sent when the parent dies */ |
| 1372 | unsigned int jobctl; /* JOBCTL_*, siglock protected */ | 1432 | unsigned long jobctl; /* JOBCTL_*, siglock protected */ |
| 1373 | 1433 | ||
| 1374 | /* Used for emulating ABI behavior of previous Linux versions */ | 1434 | /* Used for emulating ABI behavior of previous Linux versions */ |
| 1375 | unsigned int personality; | 1435 | unsigned int personality; |
| @@ -1381,10 +1441,14 @@ struct task_struct { | |||
| 1381 | /* Revert to default priority/policy when forking */ | 1441 | /* Revert to default priority/policy when forking */ |
| 1382 | unsigned sched_reset_on_fork:1; | 1442 | unsigned sched_reset_on_fork:1; |
| 1383 | unsigned sched_contributes_to_load:1; | 1443 | unsigned sched_contributes_to_load:1; |
| 1444 | unsigned sched_migrated:1; | ||
| 1384 | 1445 | ||
| 1385 | #ifdef CONFIG_MEMCG_KMEM | 1446 | #ifdef CONFIG_MEMCG_KMEM |
| 1386 | unsigned memcg_kmem_skip_account:1; | 1447 | unsigned memcg_kmem_skip_account:1; |
| 1387 | #endif | 1448 | #endif |
| 1449 | #ifdef CONFIG_COMPAT_BRK | ||
| 1450 | unsigned brk_randomized:1; | ||
| 1451 | #endif | ||
| 1388 | 1452 | ||
| 1389 | unsigned long atomic_flags; /* Flags needing atomic access. */ | 1453 | unsigned long atomic_flags; /* Flags needing atomic access. */ |
| 1390 | 1454 | ||
| @@ -1461,7 +1525,7 @@ struct task_struct { | |||
| 1461 | it with task_lock()) | 1525 | it with task_lock()) |
| 1462 | - initialized normally by setup_new_exec */ | 1526 | - initialized normally by setup_new_exec */ |
| 1463 | /* file system info */ | 1527 | /* file system info */ |
| 1464 | int link_count, total_link_count; | 1528 | struct nameidata *nameidata; |
| 1465 | #ifdef CONFIG_SYSVIPC | 1529 | #ifdef CONFIG_SYSVIPC |
| 1466 | /* ipc stuff */ | 1530 | /* ipc stuff */ |
| 1467 | struct sysv_sem sysvsem; | 1531 | struct sysv_sem sysvsem; |
| @@ -1511,6 +1575,8 @@ struct task_struct { | |||
| 1511 | /* Protection of the PI data structures: */ | 1575 | /* Protection of the PI data structures: */ |
| 1512 | raw_spinlock_t pi_lock; | 1576 | raw_spinlock_t pi_lock; |
| 1513 | 1577 | ||
| 1578 | struct wake_q_node wake_q; | ||
| 1579 | |||
| 1514 | #ifdef CONFIG_RT_MUTEXES | 1580 | #ifdef CONFIG_RT_MUTEXES |
| 1515 | /* PI waiters blocked on a rt_mutex held by this task */ | 1581 | /* PI waiters blocked on a rt_mutex held by this task */ |
| 1516 | struct rb_root pi_waiters; | 1582 | struct rb_root pi_waiters; |
| @@ -1724,6 +1790,7 @@ struct task_struct { | |||
| 1724 | #ifdef CONFIG_DEBUG_ATOMIC_SLEEP | 1790 | #ifdef CONFIG_DEBUG_ATOMIC_SLEEP |
| 1725 | unsigned long task_state_change; | 1791 | unsigned long task_state_change; |
| 1726 | #endif | 1792 | #endif |
| 1793 | int pagefault_disabled; | ||
| 1727 | }; | 1794 | }; |
| 1728 | 1795 | ||
| 1729 | /* Future-safe accessor for struct task_struct's cpus_allowed. */ | 1796 | /* Future-safe accessor for struct task_struct's cpus_allowed. */ |
| @@ -2077,22 +2144,22 @@ TASK_PFA_CLEAR(SPREAD_SLAB, spread_slab) | |||
| 2077 | #define JOBCTL_TRAPPING_BIT 21 /* switching to TRACED */ | 2144 | #define JOBCTL_TRAPPING_BIT 21 /* switching to TRACED */ |
| 2078 | #define JOBCTL_LISTENING_BIT 22 /* ptracer is listening for events */ | 2145 | #define JOBCTL_LISTENING_BIT 22 /* ptracer is listening for events */ |
| 2079 | 2146 | ||
| 2080 | #define JOBCTL_STOP_DEQUEUED (1 << JOBCTL_STOP_DEQUEUED_BIT) | 2147 | #define JOBCTL_STOP_DEQUEUED (1UL << JOBCTL_STOP_DEQUEUED_BIT) |
| 2081 | #define JOBCTL_STOP_PENDING (1 << JOBCTL_STOP_PENDING_BIT) | 2148 | #define JOBCTL_STOP_PENDING (1UL << JOBCTL_STOP_PENDING_BIT) |
| 2082 | #define JOBCTL_STOP_CONSUME (1 << JOBCTL_STOP_CONSUME_BIT) | 2149 | #define JOBCTL_STOP_CONSUME (1UL << JOBCTL_STOP_CONSUME_BIT) |
| 2083 | #define JOBCTL_TRAP_STOP (1 << JOBCTL_TRAP_STOP_BIT) | 2150 | #define JOBCTL_TRAP_STOP (1UL << JOBCTL_TRAP_STOP_BIT) |
| 2084 | #define JOBCTL_TRAP_NOTIFY (1 << JOBCTL_TRAP_NOTIFY_BIT) | 2151 | #define JOBCTL_TRAP_NOTIFY (1UL << JOBCTL_TRAP_NOTIFY_BIT) |
| 2085 | #define JOBCTL_TRAPPING (1 << JOBCTL_TRAPPING_BIT) | 2152 | #define JOBCTL_TRAPPING (1UL << JOBCTL_TRAPPING_BIT) |
| 2086 | #define JOBCTL_LISTENING (1 << JOBCTL_LISTENING_BIT) | 2153 | #define JOBCTL_LISTENING (1UL << JOBCTL_LISTENING_BIT) |
| 2087 | 2154 | ||
| 2088 | #define JOBCTL_TRAP_MASK (JOBCTL_TRAP_STOP | JOBCTL_TRAP_NOTIFY) | 2155 | #define JOBCTL_TRAP_MASK (JOBCTL_TRAP_STOP | JOBCTL_TRAP_NOTIFY) |
| 2089 | #define JOBCTL_PENDING_MASK (JOBCTL_STOP_PENDING | JOBCTL_TRAP_MASK) | 2156 | #define JOBCTL_PENDING_MASK (JOBCTL_STOP_PENDING | JOBCTL_TRAP_MASK) |
| 2090 | 2157 | ||
| 2091 | extern bool task_set_jobctl_pending(struct task_struct *task, | 2158 | extern bool task_set_jobctl_pending(struct task_struct *task, |
| 2092 | unsigned int mask); | 2159 | unsigned long mask); |
| 2093 | extern void task_clear_jobctl_trapping(struct task_struct *task); | 2160 | extern void task_clear_jobctl_trapping(struct task_struct *task); |
| 2094 | extern void task_clear_jobctl_pending(struct task_struct *task, | 2161 | extern void task_clear_jobctl_pending(struct task_struct *task, |
| 2095 | unsigned int mask); | 2162 | unsigned long mask); |
| 2096 | 2163 | ||
| 2097 | static inline void rcu_copy_process(struct task_struct *p) | 2164 | static inline void rcu_copy_process(struct task_struct *p) |
| 2098 | { | 2165 | { |
| @@ -2532,6 +2599,9 @@ static inline unsigned long wait_task_inactive(struct task_struct *p, | |||
| 2532 | } | 2599 | } |
| 2533 | #endif | 2600 | #endif |
| 2534 | 2601 | ||
| 2602 | #define tasklist_empty() \ | ||
| 2603 | list_empty(&init_task.tasks) | ||
| 2604 | |||
| 2535 | #define next_task(p) \ | 2605 | #define next_task(p) \ |
| 2536 | list_entry_rcu((p)->tasks.next, struct task_struct, tasks) | 2606 | list_entry_rcu((p)->tasks.next, struct task_struct, tasks) |
| 2537 | 2607 | ||
| @@ -2962,11 +3032,6 @@ static __always_inline bool need_resched(void) | |||
| 2962 | void thread_group_cputime(struct task_struct *tsk, struct task_cputime *times); | 3032 | void thread_group_cputime(struct task_struct *tsk, struct task_cputime *times); |
| 2963 | void thread_group_cputimer(struct task_struct *tsk, struct task_cputime *times); | 3033 | void thread_group_cputimer(struct task_struct *tsk, struct task_cputime *times); |
| 2964 | 3034 | ||
| 2965 | static inline void thread_group_cputime_init(struct signal_struct *sig) | ||
| 2966 | { | ||
| 2967 | raw_spin_lock_init(&sig->cputimer.lock); | ||
| 2968 | } | ||
| 2969 | |||
| 2970 | /* | 3035 | /* |
| 2971 | * Reevaluate whether the task has signals pending delivery. | 3036 | * Reevaluate whether the task has signals pending delivery. |
| 2972 | * Wake the task if so. | 3037 | * Wake the task if so. |
| @@ -3080,13 +3145,13 @@ static inline void mm_update_next_owner(struct mm_struct *mm) | |||
| 3080 | static inline unsigned long task_rlimit(const struct task_struct *tsk, | 3145 | static inline unsigned long task_rlimit(const struct task_struct *tsk, |
| 3081 | unsigned int limit) | 3146 | unsigned int limit) |
| 3082 | { | 3147 | { |
| 3083 | return ACCESS_ONCE(tsk->signal->rlim[limit].rlim_cur); | 3148 | return READ_ONCE(tsk->signal->rlim[limit].rlim_cur); |
| 3084 | } | 3149 | } |
| 3085 | 3150 | ||
| 3086 | static inline unsigned long task_rlimit_max(const struct task_struct *tsk, | 3151 | static inline unsigned long task_rlimit_max(const struct task_struct *tsk, |
| 3087 | unsigned int limit) | 3152 | unsigned int limit) |
| 3088 | { | 3153 | { |
| 3089 | return ACCESS_ONCE(tsk->signal->rlim[limit].rlim_max); | 3154 | return READ_ONCE(tsk->signal->rlim[limit].rlim_max); |
| 3090 | } | 3155 | } |
| 3091 | 3156 | ||
| 3092 | static inline unsigned long rlimit(unsigned int limit) | 3157 | static inline unsigned long rlimit(unsigned int limit) |
