| .. | .. |
|---|
| 18 | 18 | #include <linux/mutex.h> |
|---|
| 19 | 19 | #include <linux/plist.h> |
|---|
| 20 | 20 | #include <linux/hrtimer.h> |
|---|
| 21 | +#include <linux/irqflags.h> |
|---|
| 21 | 22 | #include <linux/seccomp.h> |
|---|
| 22 | 23 | #include <linux/nodemask.h> |
|---|
| 23 | 24 | #include <linux/rcupdate.h> |
|---|
| 25 | +#include <linux/refcount.h> |
|---|
| 24 | 26 | #include <linux/resource.h> |
|---|
| 25 | 27 | #include <linux/latencytop.h> |
|---|
| 26 | 28 | #include <linux/sched/prio.h> |
|---|
| 29 | +#include <linux/sched/types.h> |
|---|
| 27 | 30 | #include <linux/signal_types.h> |
|---|
| 28 | 31 | #include <linux/mm_types_task.h> |
|---|
| 29 | | -#include <linux/mm_event.h> |
|---|
| 30 | 32 | #include <linux/task_io_accounting.h> |
|---|
| 33 | +#include <linux/posix-timers.h> |
|---|
| 31 | 34 | #include <linux/rseq.h> |
|---|
| 35 | +#include <linux/seqlock.h> |
|---|
| 36 | +#include <linux/kcsan.h> |
|---|
| 37 | +#include <linux/android_vendor.h> |
|---|
| 32 | 38 | #include <linux/android_kabi.h> |
|---|
| 33 | | -#include <asm/kmap_types.h> |
|---|
| 34 | 39 | |
|---|
| 35 | 40 | /* task_struct member predeclarations (sorted alphabetically): */ |
|---|
| 36 | 41 | struct audit_context; |
|---|
| 37 | 42 | struct backing_dev_info; |
|---|
| 38 | 43 | struct bio_list; |
|---|
| 39 | 44 | struct blk_plug; |
|---|
| 45 | +struct capture_control; |
|---|
| 40 | 46 | struct cfs_rq; |
|---|
| 41 | 47 | struct fs_struct; |
|---|
| 42 | 48 | struct futex_pi_state; |
|---|
| .. | .. |
|---|
| 50 | 56 | struct rcu_node; |
|---|
| 51 | 57 | struct reclaim_state; |
|---|
| 52 | 58 | struct robust_list_head; |
|---|
| 59 | +struct root_domain; |
|---|
| 60 | +struct rq; |
|---|
| 53 | 61 | struct sched_attr; |
|---|
| 54 | 62 | struct sched_param; |
|---|
| 55 | 63 | struct seq_file; |
|---|
| .. | .. |
|---|
| 57 | 65 | struct signal_struct; |
|---|
| 58 | 66 | struct task_delay_info; |
|---|
| 59 | 67 | struct task_group; |
|---|
| 68 | +struct io_uring_task; |
|---|
| 60 | 69 | |
|---|
| 61 | 70 | /* |
|---|
| 62 | 71 | * Task state bitmask. NOTE! These bits are also |
|---|
| .. | .. |
|---|
| 106 | 115 | |
|---|
| 107 | 116 | #define task_is_stopped(task) ((task->state & __TASK_STOPPED) != 0) |
|---|
| 108 | 117 | |
|---|
| 109 | | -#define task_contributes_to_load(task) ((task->state & TASK_UNINTERRUPTIBLE) != 0 && \ |
|---|
| 110 | | - (task->flags & PF_FROZEN) == 0 && \ |
|---|
| 111 | | - (task->state & TASK_NOLOAD) == 0) |
|---|
| 112 | | - |
|---|
| 113 | 118 | #ifdef CONFIG_DEBUG_ATOMIC_SLEEP |
|---|
| 114 | 119 | |
|---|
| 115 | 120 | /* |
|---|
| .. | .. |
|---|
| 145 | 150 | current->state = (state_value); \ |
|---|
| 146 | 151 | raw_spin_unlock_irqrestore(¤t->pi_lock, flags); \ |
|---|
| 147 | 152 | } while (0) |
|---|
| 148 | | - |
|---|
| 149 | 153 | #else |
|---|
| 150 | 154 | /* |
|---|
| 151 | 155 | * set_current_state() includes a barrier so that the write of current->state |
|---|
| .. | .. |
|---|
| 154 | 158 | * |
|---|
| 155 | 159 | * for (;;) { |
|---|
| 156 | 160 | * set_current_state(TASK_UNINTERRUPTIBLE); |
|---|
| 157 | | - * if (!need_sleep) |
|---|
| 158 | | - * break; |
|---|
| 161 | + * if (CONDITION) |
|---|
| 162 | + * break; |
|---|
| 159 | 163 | * |
|---|
| 160 | 164 | * schedule(); |
|---|
| 161 | 165 | * } |
|---|
| 162 | 166 | * __set_current_state(TASK_RUNNING); |
|---|
| 163 | 167 | * |
|---|
| 164 | 168 | * If the caller does not need such serialisation (because, for instance, the |
|---|
| 165 | | - * condition test and condition change and wakeup are under the same lock) then |
|---|
| 169 | + * CONDITION test and condition change and wakeup are under the same lock) then |
|---|
| 166 | 170 | * use __set_current_state(). |
|---|
| 167 | 171 | * |
|---|
| 168 | 172 | * The above is typically ordered against the wakeup, which does: |
|---|
| 169 | 173 | * |
|---|
| 170 | | - * need_sleep = false; |
|---|
| 174 | + * CONDITION = 1; |
|---|
| 171 | 175 | * wake_up_state(p, TASK_UNINTERRUPTIBLE); |
|---|
| 172 | 176 | * |
|---|
| 173 | | - * where wake_up_state() executes a full memory barrier before accessing the |
|---|
| 174 | | - * task state. |
|---|
| 177 | + * where wake_up_state()/try_to_wake_up() executes a full memory barrier before |
|---|
| 178 | + * accessing p->state. |
|---|
| 175 | 179 | * |
|---|
| 176 | 180 | * Wakeup will do: if (@state & p->state) p->state = TASK_RUNNING, that is, |
|---|
| 177 | 181 | * once it observes the TASK_UNINTERRUPTIBLE store the waking CPU can issue a |
|---|
| 178 | 182 | * TASK_RUNNING store which can collide with __set_current_state(TASK_RUNNING). |
|---|
| 179 | 183 | * |
|---|
| 180 | 184 | * However, with slightly different timing the wakeup TASK_RUNNING store can |
|---|
| 181 | | - * also collide with the TASK_UNINTERRUPTIBLE store. Loosing that store is not |
|---|
| 185 | + * also collide with the TASK_UNINTERRUPTIBLE store. Losing that store is not |
|---|
| 182 | 186 | * a problem either because that will result in one extra go around the loop |
|---|
| 183 | 187 | * and our @cond test will save the day. |
|---|
| 184 | 188 | * |
|---|
| .. | .. |
|---|
| 223 | 227 | extern long schedule_timeout_idle(long timeout); |
|---|
| 224 | 228 | asmlinkage void schedule(void); |
|---|
| 225 | 229 | extern void schedule_preempt_disabled(void); |
|---|
| 230 | +asmlinkage void preempt_schedule_irq(void); |
|---|
| 226 | 231 | |
|---|
| 227 | 232 | extern int __must_check io_schedule_prepare(void); |
|---|
| 228 | 233 | extern void io_schedule_finish(int token); |
|---|
| 229 | 234 | extern long io_schedule_timeout(long timeout); |
|---|
| 230 | 235 | extern void io_schedule(void); |
|---|
| 231 | | - |
|---|
| 232 | | -int cpu_nr_pinned(int cpu); |
|---|
| 233 | 236 | |
|---|
| 234 | 237 | /** |
|---|
| 235 | 238 | * struct prev_cputime - snapshot of system and user cputime |
|---|
| .. | .. |
|---|
| 248 | 251 | #endif |
|---|
| 249 | 252 | }; |
|---|
| 250 | 253 | |
|---|
| 251 | | -/** |
|---|
| 252 | | - * struct task_cputime - collected CPU time counts |
|---|
| 253 | | - * @utime: time spent in user mode, in nanoseconds |
|---|
| 254 | | - * @stime: time spent in kernel mode, in nanoseconds |
|---|
| 255 | | - * @sum_exec_runtime: total time spent on the CPU, in nanoseconds |
|---|
| 256 | | - * |
|---|
| 257 | | - * This structure groups together three kinds of CPU time that are tracked for |
|---|
| 258 | | - * threads and thread groups. Most things considering CPU time want to group |
|---|
| 259 | | - * these counts together and treat all three of them in parallel. |
|---|
| 260 | | - */ |
|---|
| 261 | | -struct task_cputime { |
|---|
| 262 | | - u64 utime; |
|---|
| 263 | | - u64 stime; |
|---|
| 264 | | - unsigned long long sum_exec_runtime; |
|---|
| 265 | | -}; |
|---|
| 266 | | - |
|---|
| 267 | | -/* Alternate field names when used on cache expirations: */ |
|---|
| 268 | | -#define virt_exp utime |
|---|
| 269 | | -#define prof_exp stime |
|---|
| 270 | | -#define sched_exp sum_exec_runtime |
|---|
| 271 | | - |
|---|
| 272 | 254 | enum vtime_state { |
|---|
| 273 | 255 | /* Task is sleeping or running in a CPU with VTIME inactive: */ |
|---|
| 274 | 256 | VTIME_INACTIVE = 0, |
|---|
| 275 | | - /* Task runs in userspace in a CPU with VTIME active: */ |
|---|
| 276 | | - VTIME_USER, |
|---|
| 257 | + /* Task is idle */ |
|---|
| 258 | + VTIME_IDLE, |
|---|
| 277 | 259 | /* Task runs in kernelspace in a CPU with VTIME active: */ |
|---|
| 278 | 260 | VTIME_SYS, |
|---|
| 261 | + /* Task runs in userspace in a CPU with VTIME active: */ |
|---|
| 262 | + VTIME_USER, |
|---|
| 263 | + /* Task runs as guests in a CPU with VTIME active: */ |
|---|
| 264 | + VTIME_GUEST, |
|---|
| 279 | 265 | }; |
|---|
| 280 | 266 | |
|---|
| 281 | 267 | struct vtime { |
|---|
| 282 | 268 | seqcount_t seqcount; |
|---|
| 283 | 269 | unsigned long long starttime; |
|---|
| 284 | 270 | enum vtime_state state; |
|---|
| 271 | + unsigned int cpu; |
|---|
| 285 | 272 | u64 utime; |
|---|
| 286 | 273 | u64 stime; |
|---|
| 287 | 274 | u64 gtime; |
|---|
| .. | .. |
|---|
| 298 | 285 | UCLAMP_MAX, |
|---|
| 299 | 286 | UCLAMP_CNT |
|---|
| 300 | 287 | }; |
|---|
| 288 | + |
|---|
| 289 | +#ifdef CONFIG_SMP |
|---|
| 290 | +extern struct root_domain def_root_domain; |
|---|
| 291 | +extern struct mutex sched_domains_mutex; |
|---|
| 292 | +#endif |
|---|
| 301 | 293 | |
|---|
| 302 | 294 | struct sched_info { |
|---|
| 303 | 295 | #ifdef CONFIG_SCHED_INFO |
|---|
| .. | .. |
|---|
| 360 | 352 | * Only for tasks we track a moving average of the past instantaneous |
|---|
| 361 | 353 | * estimated utilization. This allows to absorb sporadic drops in utilization |
|---|
| 362 | 354 | * of an otherwise almost periodic task. |
|---|
| 355 | + * |
|---|
| 356 | + * The UTIL_AVG_UNCHANGED flag is used to synchronize util_est with util_avg |
|---|
| 357 | + * updates. When a task is dequeued, its util_est should not be updated if its |
|---|
| 358 | + * util_avg has not been updated in the meantime. |
|---|
| 359 | + * This information is mapped into the MSB bit of util_est.enqueued at dequeue |
|---|
| 360 | + * time. Since max value of util_est.enqueued for a task is 1024 (PELT util_avg |
|---|
| 361 | + * for a task) it is safe to use MSB. |
|---|
| 363 | 362 | */ |
|---|
| 364 | 363 | struct util_est { |
|---|
| 365 | 364 | unsigned int enqueued; |
|---|
| 366 | 365 | unsigned int ewma; |
|---|
| 367 | 366 | #define UTIL_EST_WEIGHT_SHIFT 2 |
|---|
| 367 | +#define UTIL_AVG_UNCHANGED 0x80000000 |
|---|
| 368 | 368 | } __attribute__((__aligned__(sizeof(u64)))); |
|---|
| 369 | 369 | |
|---|
| 370 | 370 | /* |
|---|
| 371 | | - * The load_avg/util_avg accumulates an infinite geometric series |
|---|
| 372 | | - * (see __update_load_avg() in kernel/sched/fair.c). |
|---|
| 371 | + * The load/runnable/util_avg accumulates an infinite geometric series |
|---|
| 372 | + * (see __update_load_avg_cfs_rq() in kernel/sched/pelt.c). |
|---|
| 373 | 373 | * |
|---|
| 374 | 374 | * [load_avg definition] |
|---|
| 375 | 375 | * |
|---|
| 376 | 376 | * load_avg = runnable% * scale_load_down(load) |
|---|
| 377 | 377 | * |
|---|
| 378 | | - * where runnable% is the time ratio that a sched_entity is runnable. |
|---|
| 379 | | - * For cfs_rq, it is the aggregated load_avg of all runnable and |
|---|
| 380 | | - * blocked sched_entities. |
|---|
| 378 | + * [runnable_avg definition] |
|---|
| 379 | + * |
|---|
| 380 | + * runnable_avg = runnable% * SCHED_CAPACITY_SCALE |
|---|
| 381 | 381 | * |
|---|
| 382 | 382 | * [util_avg definition] |
|---|
| 383 | 383 | * |
|---|
| 384 | 384 | * util_avg = running% * SCHED_CAPACITY_SCALE |
|---|
| 385 | 385 | * |
|---|
| 386 | | - * where running% is the time ratio that a sched_entity is running on |
|---|
| 387 | | - * a CPU. For cfs_rq, it is the aggregated util_avg of all runnable |
|---|
| 388 | | - * and blocked sched_entities. |
|---|
| 386 | + * where runnable% is the time ratio that a sched_entity is runnable and |
|---|
| 387 | + * running% the time ratio that a sched_entity is running. |
|---|
| 389 | 388 | * |
|---|
| 390 | | - * load_avg and util_avg don't direcly factor frequency scaling and CPU |
|---|
| 391 | | - * capacity scaling. The scaling is done through the rq_clock_pelt that |
|---|
| 392 | | - * is used for computing those signals (see update_rq_clock_pelt()) |
|---|
| 389 | + * For cfs_rq, they are the aggregated values of all runnable and blocked |
|---|
| 390 | + * sched_entities. |
|---|
| 391 | + * |
|---|
| 392 | + * The load/runnable/util_avg doesn't directly factor frequency scaling and CPU |
|---|
| 393 | + * capacity scaling. The scaling is done through the rq_clock_pelt that is used |
|---|
| 394 | + * for computing those signals (see update_rq_clock_pelt()) |
|---|
| 393 | 395 | * |
|---|
| 394 | 396 | * N.B., the above ratios (runnable% and running%) themselves are in the |
|---|
| 395 | 397 | * range of [0, 1]. To do fixed point arithmetics, we therefore scale them |
|---|
| .. | .. |
|---|
| 413 | 415 | struct sched_avg { |
|---|
| 414 | 416 | u64 last_update_time; |
|---|
| 415 | 417 | u64 load_sum; |
|---|
| 416 | | - u64 runnable_load_sum; |
|---|
| 418 | + u64 runnable_sum; |
|---|
| 417 | 419 | u32 util_sum; |
|---|
| 418 | 420 | u32 period_contrib; |
|---|
| 419 | 421 | unsigned long load_avg; |
|---|
| 420 | | - unsigned long runnable_load_avg; |
|---|
| 422 | + unsigned long runnable_avg; |
|---|
| 421 | 423 | unsigned long util_avg; |
|---|
| 422 | 424 | struct util_est util_est; |
|---|
| 423 | 425 | } ____cacheline_aligned; |
|---|
| .. | .. |
|---|
| 461 | 463 | struct sched_entity { |
|---|
| 462 | 464 | /* For load-balancing: */ |
|---|
| 463 | 465 | struct load_weight load; |
|---|
| 464 | | - unsigned long runnable_weight; |
|---|
| 465 | 466 | struct rb_node run_node; |
|---|
| 466 | 467 | struct list_head group_node; |
|---|
| 467 | 468 | unsigned int on_rq; |
|---|
| .. | .. |
|---|
| 482 | 483 | struct cfs_rq *cfs_rq; |
|---|
| 483 | 484 | /* rq "owned" by this entity/group: */ |
|---|
| 484 | 485 | struct cfs_rq *my_q; |
|---|
| 486 | + /* cached value of my_q->h_nr_running */ |
|---|
| 487 | + unsigned long runnable_weight; |
|---|
| 485 | 488 | #endif |
|---|
| 486 | 489 | |
|---|
| 487 | 490 | #ifdef CONFIG_SMP |
|---|
| .. | .. |
|---|
| 539 | 542 | |
|---|
| 540 | 543 | /* |
|---|
| 541 | 544 | * Actual scheduling parameters. Initialized with the values above, |
|---|
| 542 | | - * they are continously updated during task execution. Note that |
|---|
| 545 | + * they are continuously updated during task execution. Note that |
|---|
| 543 | 546 | * the remaining runtime could be < 0 in case we are in overrun. |
|---|
| 544 | 547 | */ |
|---|
| 545 | 548 | s64 runtime; /* Remaining runtime for this instance */ |
|---|
| .. | .. |
|---|
| 552 | 555 | * @dl_throttled tells if we exhausted the runtime. If so, the |
|---|
| 553 | 556 | * task has to wait for a replenishment to be performed at the |
|---|
| 554 | 557 | * next firing of dl_timer. |
|---|
| 555 | | - * |
|---|
| 556 | | - * @dl_boosted tells if we are boosted due to DI. If so we are |
|---|
| 557 | | - * outside bandwidth enforcement mechanism (but only until we |
|---|
| 558 | | - * exit the critical section); |
|---|
| 559 | 558 | * |
|---|
| 560 | 559 | * @dl_yielded tells if task gave up the CPU before consuming |
|---|
| 561 | 560 | * all its available runtime during the last job. |
|---|
| .. | .. |
|---|
| 571 | 570 | * overruns. |
|---|
| 572 | 571 | */ |
|---|
| 573 | 572 | unsigned int dl_throttled : 1; |
|---|
| 574 | | - unsigned int dl_boosted : 1; |
|---|
| 575 | 573 | unsigned int dl_yielded : 1; |
|---|
| 576 | 574 | unsigned int dl_non_contending : 1; |
|---|
| 577 | 575 | unsigned int dl_overrun : 1; |
|---|
| .. | .. |
|---|
| 590 | 588 | * time. |
|---|
| 591 | 589 | */ |
|---|
| 592 | 590 | struct hrtimer inactive_timer; |
|---|
| 591 | + |
|---|
| 592 | +#ifdef CONFIG_RT_MUTEXES |
|---|
| 593 | + /* |
|---|
| 594 | + * Priority Inheritance. When a DEADLINE scheduling entity is boosted |
|---|
| 595 | + * pi_se points to the donor, otherwise points to the dl_se it belongs |
|---|
| 596 | + * to (the original one/itself). |
|---|
| 597 | + */ |
|---|
| 598 | + struct sched_dl_entity *pi_se; |
|---|
| 599 | +#endif |
|---|
| 593 | 600 | }; |
|---|
| 594 | 601 | |
|---|
| 595 | 602 | #ifdef CONFIG_UCLAMP_TASK |
|---|
| .. | .. |
|---|
| 631 | 638 | struct { |
|---|
| 632 | 639 | u8 blocked; |
|---|
| 633 | 640 | u8 need_qs; |
|---|
| 634 | | - u8 exp_need_qs; |
|---|
| 635 | | - |
|---|
| 636 | | - /* Otherwise the compiler can store garbage here: */ |
|---|
| 637 | | - u8 pad; |
|---|
| 641 | + u8 exp_hint; /* Hint for performance. */ |
|---|
| 642 | + u8 need_mb; /* Readers need smp_mb(). */ |
|---|
| 638 | 643 | } b; /* Bits. */ |
|---|
| 639 | 644 | u32 s; /* Set of bits. */ |
|---|
| 640 | 645 | }; |
|---|
| .. | .. |
|---|
| 648 | 653 | |
|---|
| 649 | 654 | struct wake_q_node { |
|---|
| 650 | 655 | struct wake_q_node *next; |
|---|
| 656 | +}; |
|---|
| 657 | + |
|---|
| 658 | +struct kmap_ctrl { |
|---|
| 659 | +#ifdef CONFIG_KMAP_LOCAL |
|---|
| 660 | + int idx; |
|---|
| 661 | + pte_t pteval[KM_MAX_IDX]; |
|---|
| 662 | +#endif |
|---|
| 651 | 663 | }; |
|---|
| 652 | 664 | |
|---|
| 653 | 665 | struct task_struct { |
|---|
| .. | .. |
|---|
| 670 | 682 | randomized_struct_fields_start |
|---|
| 671 | 683 | |
|---|
| 672 | 684 | void *stack; |
|---|
| 673 | | - atomic_t usage; |
|---|
| 685 | + refcount_t usage; |
|---|
| 674 | 686 | /* Per task flags (PF_*), defined further below: */ |
|---|
| 675 | 687 | unsigned int flags; |
|---|
| 676 | 688 | unsigned int ptrace; |
|---|
| 677 | 689 | |
|---|
| 678 | 690 | #ifdef CONFIG_SMP |
|---|
| 679 | | - struct llist_node wake_entry; |
|---|
| 680 | 691 | int on_cpu; |
|---|
| 692 | + struct __call_single_node wake_entry; |
|---|
| 681 | 693 | #ifdef CONFIG_THREAD_INFO_IN_TASK |
|---|
| 682 | 694 | /* Current CPU: */ |
|---|
| 683 | 695 | unsigned int cpu; |
|---|
| .. | .. |
|---|
| 706 | 718 | const struct sched_class *sched_class; |
|---|
| 707 | 719 | struct sched_entity se; |
|---|
| 708 | 720 | struct sched_rt_entity rt; |
|---|
| 709 | | - |
|---|
| 710 | | - /* task boost vendor fields */ |
|---|
| 711 | | - u64 last_sleep_ts; |
|---|
| 712 | | - int boost; |
|---|
| 713 | | - u64 boost_period; |
|---|
| 714 | | - u64 boost_expires; |
|---|
| 715 | | - |
|---|
| 716 | 721 | #ifdef CONFIG_CGROUP_SCHED |
|---|
| 717 | 722 | struct task_group *sched_task_group; |
|---|
| 718 | 723 | #endif |
|---|
| 719 | 724 | struct sched_dl_entity dl; |
|---|
| 720 | 725 | |
|---|
| 721 | 726 | #ifdef CONFIG_UCLAMP_TASK |
|---|
| 722 | | - /* Clamp values requested for a scheduling entity */ |
|---|
| 727 | + /* |
|---|
| 728 | + * Clamp values requested for a scheduling entity. |
|---|
| 729 | + * Must be updated with task_rq_lock() held. |
|---|
| 730 | + */ |
|---|
| 723 | 731 | struct uclamp_se uclamp_req[UCLAMP_CNT]; |
|---|
| 724 | | - /* Effective clamp values used for a scheduling entity */ |
|---|
| 732 | + /* |
|---|
| 733 | + * Effective clamp values used for a scheduling entity. |
|---|
| 734 | + * Must be updated with task_rq_lock() held. |
|---|
| 735 | + */ |
|---|
| 725 | 736 | struct uclamp_se uclamp[UCLAMP_CNT]; |
|---|
| 737 | +#endif |
|---|
| 738 | + |
|---|
| 739 | +#ifdef CONFIG_HOTPLUG_CPU |
|---|
| 740 | + struct list_head percpu_kthread_node; |
|---|
| 726 | 741 | #endif |
|---|
| 727 | 742 | |
|---|
| 728 | 743 | #ifdef CONFIG_PREEMPT_NOTIFIERS |
|---|
| .. | .. |
|---|
| 736 | 751 | |
|---|
| 737 | 752 | unsigned int policy; |
|---|
| 738 | 753 | int nr_cpus_allowed; |
|---|
| 739 | | -// cpumask_t cpus_allowed; |
|---|
| 740 | | - cpumask_t cpus_requested; |
|---|
| 741 | 754 | const cpumask_t *cpus_ptr; |
|---|
| 742 | 755 | cpumask_t cpus_mask; |
|---|
| 743 | | -#if defined(CONFIG_SMP) && defined(CONFIG_PREEMPT_RT_BASE) |
|---|
| 744 | | - int migrate_disable; |
|---|
| 745 | | - bool migrate_disable_scheduled; |
|---|
| 746 | | -# ifdef CONFIG_SCHED_DEBUG |
|---|
| 747 | | - int pinned_on_cpu; |
|---|
| 748 | | -# endif |
|---|
| 749 | | -#elif !defined(CONFIG_SMP) && defined(CONFIG_PREEMPT_RT_BASE) |
|---|
| 750 | | -# ifdef CONFIG_SCHED_DEBUG |
|---|
| 751 | | - int migrate_disable; |
|---|
| 752 | | -# endif |
|---|
| 756 | + void *migration_pending; |
|---|
| 757 | +#ifdef CONFIG_SMP |
|---|
| 758 | + unsigned short migration_disabled; |
|---|
| 753 | 759 | #endif |
|---|
| 754 | | -#ifdef CONFIG_PREEMPT_RT_FULL |
|---|
| 755 | | - int sleeping_lock; |
|---|
| 756 | | -#endif |
|---|
| 760 | + unsigned short migration_flags; |
|---|
| 757 | 761 | |
|---|
| 758 | 762 | #ifdef CONFIG_PREEMPT_RCU |
|---|
| 759 | 763 | int rcu_read_lock_nesting; |
|---|
| .. | .. |
|---|
| 769 | 773 | int rcu_tasks_idle_cpu; |
|---|
| 770 | 774 | struct list_head rcu_tasks_holdout_list; |
|---|
| 771 | 775 | #endif /* #ifdef CONFIG_TASKS_RCU */ |
|---|
| 776 | + |
|---|
| 777 | +#ifdef CONFIG_TASKS_TRACE_RCU |
|---|
| 778 | + int trc_reader_nesting; |
|---|
| 779 | + int trc_ipi_to_cpu; |
|---|
| 780 | + union rcu_special trc_reader_special; |
|---|
| 781 | + bool trc_reader_checked; |
|---|
| 782 | + struct list_head trc_holdout_list; |
|---|
| 783 | +#endif /* #ifdef CONFIG_TASKS_TRACE_RCU */ |
|---|
| 772 | 784 | |
|---|
| 773 | 785 | struct sched_info sched_info; |
|---|
| 774 | 786 | |
|---|
| .. | .. |
|---|
| 802 | 814 | unsigned sched_reset_on_fork:1; |
|---|
| 803 | 815 | unsigned sched_contributes_to_load:1; |
|---|
| 804 | 816 | unsigned sched_migrated:1; |
|---|
| 805 | | - unsigned sched_remote_wakeup:1; |
|---|
| 806 | 817 | #ifdef CONFIG_PSI |
|---|
| 807 | 818 | unsigned sched_psi_wake_requeue:1; |
|---|
| 808 | 819 | #endif |
|---|
| .. | .. |
|---|
| 812 | 823 | |
|---|
| 813 | 824 | /* Unserialized, strictly 'current' */ |
|---|
| 814 | 825 | |
|---|
| 826 | + /* |
|---|
| 827 | + * This field must not be in the scheduler word above due to wakelist |
|---|
| 828 | + * queueing no longer being serialized by p->on_cpu. However: |
|---|
| 829 | + * |
|---|
| 830 | + * p->XXX = X; ttwu() |
|---|
| 831 | + * schedule() if (p->on_rq && ..) // false |
|---|
| 832 | + * smp_mb__after_spinlock(); if (smp_load_acquire(&p->on_cpu) && //true |
|---|
| 833 | + * deactivate_task() ttwu_queue_wakelist()) |
|---|
| 834 | + * p->on_rq = 0; p->sched_remote_wakeup = Y; |
|---|
| 835 | + * |
|---|
| 836 | + * guarantees all stores of 'current' are visible before |
|---|
| 837 | + * ->sched_remote_wakeup gets used, so it can be in this word. |
|---|
| 838 | + */ |
|---|
| 839 | + unsigned sched_remote_wakeup:1; |
|---|
| 840 | + |
|---|
| 815 | 841 | /* Bit to tell LSMs we're in execve(): */ |
|---|
| 816 | 842 | unsigned in_execve:1; |
|---|
| 817 | 843 | unsigned in_iowait:1; |
|---|
| .. | .. |
|---|
| 820 | 846 | #endif |
|---|
| 821 | 847 | #ifdef CONFIG_MEMCG |
|---|
| 822 | 848 | unsigned in_user_fault:1; |
|---|
| 823 | | -#ifdef CONFIG_MEMCG_KMEM |
|---|
| 824 | | - unsigned memcg_kmem_skip_account:1; |
|---|
| 825 | | -#endif |
|---|
| 826 | 849 | #endif |
|---|
| 827 | 850 | #ifdef CONFIG_COMPAT_BRK |
|---|
| 828 | 851 | unsigned brk_randomized:1; |
|---|
| .. | .. |
|---|
| 830 | 853 | #ifdef CONFIG_CGROUPS |
|---|
| 831 | 854 | /* disallow userland-initiated cgroup migration */ |
|---|
| 832 | 855 | unsigned no_cgroup_migration:1; |
|---|
| 856 | + /* task is frozen/stopped (used by the cgroup freezer) */ |
|---|
| 857 | + unsigned frozen:1; |
|---|
| 833 | 858 | #endif |
|---|
| 834 | 859 | #ifdef CONFIG_BLK_CGROUP |
|---|
| 835 | | - /* to be used once the psi infrastructure lands upstream. */ |
|---|
| 836 | 860 | unsigned use_memdelay:1; |
|---|
| 861 | +#endif |
|---|
| 862 | +#ifdef CONFIG_PSI |
|---|
| 863 | + /* Stalled due to lack of memory */ |
|---|
| 864 | + unsigned in_memstall:1; |
|---|
| 865 | +#endif |
|---|
| 866 | +#ifdef CONFIG_EVENTFD |
|---|
| 867 | + /* Recursion prevention for eventfd_signal() */ |
|---|
| 868 | + unsigned in_eventfd_signal:1; |
|---|
| 837 | 869 | #endif |
|---|
| 838 | 870 | |
|---|
| 839 | 871 | unsigned long atomic_flags; /* Flags requiring atomic access. */ |
|---|
| .. | .. |
|---|
| 916 | 948 | u64 start_time; |
|---|
| 917 | 949 | |
|---|
| 918 | 950 | /* Boot based time in nsecs: */ |
|---|
| 919 | | - u64 real_start_time; |
|---|
| 951 | + u64 start_boottime; |
|---|
| 920 | 952 | |
|---|
| 921 | 953 | /* MM fault and swap info: this can arguably be seen as either mm-specific or thread-specific: */ |
|---|
| 922 | 954 | unsigned long min_flt; |
|---|
| 923 | 955 | unsigned long maj_flt; |
|---|
| 924 | 956 | |
|---|
| 925 | | -#ifdef CONFIG_POSIX_TIMERS |
|---|
| 926 | | - struct task_cputime cputime_expires; |
|---|
| 927 | | - struct list_head cpu_timers[3]; |
|---|
| 928 | | -#ifdef CONFIG_PREEMPT_RT_BASE |
|---|
| 929 | | - struct task_struct *posix_timer_list; |
|---|
| 930 | | -#endif |
|---|
| 957 | + /* Empty if CONFIG_POSIX_CPUTIMERS=n */ |
|---|
| 958 | + struct posix_cputimers posix_cputimers; |
|---|
| 959 | + |
|---|
| 960 | +#ifdef CONFIG_POSIX_CPU_TIMERS_TASK_WORK |
|---|
| 961 | + struct posix_cputimers_work posix_cputimers_work; |
|---|
| 931 | 962 | #endif |
|---|
| 932 | 963 | |
|---|
| 933 | 964 | /* Process credentials: */ |
|---|
| .. | .. |
|---|
| 940 | 971 | |
|---|
| 941 | 972 | /* Effective (overridable) subjective task credentials (COW): */ |
|---|
| 942 | 973 | const struct cred __rcu *cred; |
|---|
| 974 | + |
|---|
| 975 | +#ifdef CONFIG_KEYS |
|---|
| 976 | + /* Cached requested key. */ |
|---|
| 977 | + struct key *cached_requested_key; |
|---|
| 978 | +#endif |
|---|
| 943 | 979 | |
|---|
| 944 | 980 | /* |
|---|
| 945 | 981 | * executable name, excluding path. |
|---|
| .. | .. |
|---|
| 966 | 1002 | /* Open file information: */ |
|---|
| 967 | 1003 | struct files_struct *files; |
|---|
| 968 | 1004 | |
|---|
| 1005 | +#ifdef CONFIG_IO_URING |
|---|
| 1006 | + struct io_uring_task *io_uring; |
|---|
| 1007 | +#endif |
|---|
| 1008 | + |
|---|
| 969 | 1009 | /* Namespaces: */ |
|---|
| 970 | 1010 | struct nsproxy *nsproxy; |
|---|
| 971 | 1011 | |
|---|
| 972 | 1012 | /* Signal handlers: */ |
|---|
| 973 | 1013 | struct signal_struct *signal; |
|---|
| 974 | | - struct sighand_struct *sighand; |
|---|
| 1014 | + struct sighand_struct __rcu *sighand; |
|---|
| 975 | 1015 | struct sigqueue *sigqueue_cache; |
|---|
| 976 | | - |
|---|
| 977 | 1016 | sigset_t blocked; |
|---|
| 978 | 1017 | sigset_t real_blocked; |
|---|
| 979 | 1018 | /* Restored if set_restore_sigmask() was used: */ |
|---|
| 980 | 1019 | sigset_t saved_sigmask; |
|---|
| 981 | 1020 | struct sigpending pending; |
|---|
| 982 | | -#ifdef CONFIG_PREEMPT_RT_FULL |
|---|
| 1021 | +#ifdef CONFIG_PREEMPT_RT |
|---|
| 983 | 1022 | /* TODO: move me into ->restart_block ? */ |
|---|
| 984 | | - struct siginfo forced_info; |
|---|
| 1023 | + struct kernel_siginfo forced_info; |
|---|
| 985 | 1024 | #endif |
|---|
| 986 | 1025 | unsigned long sas_ss_sp; |
|---|
| 987 | 1026 | size_t sas_ss_size; |
|---|
| .. | .. |
|---|
| 989 | 1028 | |
|---|
| 990 | 1029 | struct callback_head *task_works; |
|---|
| 991 | 1030 | |
|---|
| 992 | | - struct audit_context *audit_context; |
|---|
| 1031 | +#ifdef CONFIG_AUDIT |
|---|
| 993 | 1032 | #ifdef CONFIG_AUDITSYSCALL |
|---|
| 1033 | + struct audit_context *audit_context; |
|---|
| 1034 | +#endif |
|---|
| 994 | 1035 | kuid_t loginuid; |
|---|
| 995 | 1036 | unsigned int sessionid; |
|---|
| 996 | 1037 | #endif |
|---|
| .. | .. |
|---|
| 1008 | 1049 | |
|---|
| 1009 | 1050 | struct wake_q_node wake_q; |
|---|
| 1010 | 1051 | struct wake_q_node wake_q_sleeper; |
|---|
| 1052 | + int wake_q_count; |
|---|
| 1011 | 1053 | |
|---|
| 1012 | 1054 | #ifdef CONFIG_RT_MUTEXES |
|---|
| 1013 | 1055 | /* PI waiters blocked on a rt_mutex held by this task: */ |
|---|
| .. | .. |
|---|
| 1017 | 1059 | /* Deadlock detection and priority inheritance handling: */ |
|---|
| 1018 | 1060 | struct rt_mutex_waiter *pi_blocked_on; |
|---|
| 1019 | 1061 | #endif |
|---|
| 1020 | | -#ifdef CONFIG_MM_EVENT_STAT |
|---|
| 1021 | | - struct mm_event_task mm_event[MM_TYPE_NUM]; |
|---|
| 1022 | | - unsigned long next_period; |
|---|
| 1023 | | -#endif |
|---|
| 1062 | + |
|---|
| 1024 | 1063 | #ifdef CONFIG_DEBUG_MUTEXES |
|---|
| 1025 | 1064 | /* Mutex deadlock detection: */ |
|---|
| 1026 | 1065 | struct mutex_waiter *blocked_on; |
|---|
| 1027 | 1066 | #endif |
|---|
| 1028 | 1067 | |
|---|
| 1068 | +#ifdef CONFIG_DEBUG_ATOMIC_SLEEP |
|---|
| 1069 | + int non_block_count; |
|---|
| 1070 | +#endif |
|---|
| 1071 | + |
|---|
| 1029 | 1072 | #ifdef CONFIG_TRACE_IRQFLAGS |
|---|
| 1030 | | - unsigned int irq_events; |
|---|
| 1031 | | - unsigned long hardirq_enable_ip; |
|---|
| 1032 | | - unsigned long hardirq_disable_ip; |
|---|
| 1033 | | - unsigned int hardirq_enable_event; |
|---|
| 1034 | | - unsigned int hardirq_disable_event; |
|---|
| 1035 | | - int hardirqs_enabled; |
|---|
| 1036 | | - int hardirq_context; |
|---|
| 1037 | | - unsigned long softirq_disable_ip; |
|---|
| 1038 | | - unsigned long softirq_enable_ip; |
|---|
| 1039 | | - unsigned int softirq_disable_event; |
|---|
| 1040 | | - unsigned int softirq_enable_event; |
|---|
| 1073 | + struct irqtrace_events irqtrace; |
|---|
| 1074 | + unsigned int hardirq_threaded; |
|---|
| 1075 | + u64 hardirq_chain_key; |
|---|
| 1041 | 1076 | int softirqs_enabled; |
|---|
| 1042 | 1077 | int softirq_context; |
|---|
| 1078 | + int irq_config; |
|---|
| 1079 | +#endif |
|---|
| 1080 | +#ifdef CONFIG_PREEMPT_RT |
|---|
| 1081 | + int softirq_disable_cnt; |
|---|
| 1043 | 1082 | #endif |
|---|
| 1044 | 1083 | |
|---|
| 1045 | 1084 | #ifdef CONFIG_LOCKDEP |
|---|
| .. | .. |
|---|
| 1050 | 1089 | struct held_lock held_locks[MAX_LOCK_DEPTH]; |
|---|
| 1051 | 1090 | #endif |
|---|
| 1052 | 1091 | |
|---|
| 1053 | | -#ifdef CONFIG_UBSAN |
|---|
| 1092 | +#if defined(CONFIG_UBSAN) && !defined(CONFIG_UBSAN_TRAP) |
|---|
| 1054 | 1093 | unsigned int in_ubsan; |
|---|
| 1055 | 1094 | #endif |
|---|
| 1056 | 1095 | |
|---|
| .. | .. |
|---|
| 1072 | 1111 | |
|---|
| 1073 | 1112 | struct io_context *io_context; |
|---|
| 1074 | 1113 | |
|---|
| 1114 | +#ifdef CONFIG_COMPACTION |
|---|
| 1115 | + struct capture_control *capture_control; |
|---|
| 1116 | +#endif |
|---|
| 1075 | 1117 | /* Ptrace state: */ |
|---|
| 1076 | 1118 | unsigned long ptrace_message; |
|---|
| 1077 | | - siginfo_t *last_siginfo; |
|---|
| 1119 | + kernel_siginfo_t *last_siginfo; |
|---|
| 1078 | 1120 | |
|---|
| 1079 | 1121 | struct task_io_accounting ioac; |
|---|
| 1080 | 1122 | #ifdef CONFIG_PSI |
|---|
| .. | .. |
|---|
| 1093 | 1135 | /* Protected by ->alloc_lock: */ |
|---|
| 1094 | 1136 | nodemask_t mems_allowed; |
|---|
| 1095 | 1137 | /* Seqence number to catch updates: */ |
|---|
| 1096 | | - seqcount_t mems_allowed_seq; |
|---|
| 1138 | + seqcount_spinlock_t mems_allowed_seq; |
|---|
| 1097 | 1139 | int cpuset_mem_spread_rotor; |
|---|
| 1098 | 1140 | int cpuset_slab_spread_rotor; |
|---|
| 1099 | 1141 | #endif |
|---|
| .. | .. |
|---|
| 1103 | 1145 | /* cg_list protected by css_set_lock and tsk->alloc_lock: */ |
|---|
| 1104 | 1146 | struct list_head cg_list; |
|---|
| 1105 | 1147 | #endif |
|---|
| 1106 | | -#ifdef CONFIG_INTEL_RDT |
|---|
| 1148 | +#ifdef CONFIG_X86_CPU_RESCTRL |
|---|
| 1107 | 1149 | u32 closid; |
|---|
| 1108 | 1150 | u32 rmid; |
|---|
| 1109 | 1151 | #endif |
|---|
| .. | .. |
|---|
| 1114 | 1156 | #endif |
|---|
| 1115 | 1157 | struct list_head pi_state_list; |
|---|
| 1116 | 1158 | struct futex_pi_state *pi_state_cache; |
|---|
| 1159 | + struct mutex futex_exit_mutex; |
|---|
| 1160 | + unsigned int futex_state; |
|---|
| 1117 | 1161 | #endif |
|---|
| 1118 | 1162 | #ifdef CONFIG_PERF_EVENTS |
|---|
| 1119 | 1163 | struct perf_event_context *perf_event_ctxp[perf_nr_task_contexts]; |
|---|
| .. | .. |
|---|
| 1181 | 1225 | |
|---|
| 1182 | 1226 | #ifdef CONFIG_RSEQ |
|---|
| 1183 | 1227 | struct rseq __user *rseq; |
|---|
| 1184 | | - u32 rseq_len; |
|---|
| 1185 | 1228 | u32 rseq_sig; |
|---|
| 1186 | 1229 | /* |
|---|
| 1187 | 1230 | * RmW on rseq_event_mask must be performed atomically |
|---|
| .. | .. |
|---|
| 1192 | 1235 | |
|---|
| 1193 | 1236 | struct tlbflush_unmap_batch tlb_ubc; |
|---|
| 1194 | 1237 | |
|---|
| 1195 | | - struct rcu_head rcu; |
|---|
| 1238 | + union { |
|---|
| 1239 | + refcount_t rcu_users; |
|---|
| 1240 | + struct rcu_head rcu; |
|---|
| 1241 | + }; |
|---|
| 1196 | 1242 | |
|---|
| 1197 | 1243 | /* Cache last used pipe for splice(): */ |
|---|
| 1198 | 1244 | struct pipe_inode_info *splice_pipe; |
|---|
| .. | .. |
|---|
| 1227 | 1273 | u64 timer_slack_ns; |
|---|
| 1228 | 1274 | u64 default_timer_slack_ns; |
|---|
| 1229 | 1275 | |
|---|
| 1230 | | -#ifdef CONFIG_KASAN |
|---|
| 1276 | +#if defined(CONFIG_KASAN_GENERIC) || defined(CONFIG_KASAN_SW_TAGS) |
|---|
| 1231 | 1277 | unsigned int kasan_depth; |
|---|
| 1278 | +#endif |
|---|
| 1279 | + |
|---|
| 1280 | +#ifdef CONFIG_KCSAN |
|---|
| 1281 | + struct kcsan_ctx kcsan_ctx; |
|---|
| 1282 | +#ifdef CONFIG_TRACE_IRQFLAGS |
|---|
| 1283 | + struct irqtrace_events kcsan_save_irqtrace; |
|---|
| 1284 | +#endif |
|---|
| 1285 | +#endif |
|---|
| 1286 | + |
|---|
| 1287 | +#if IS_ENABLED(CONFIG_KUNIT) |
|---|
| 1288 | + struct kunit *kunit_test; |
|---|
| 1232 | 1289 | #endif |
|---|
| 1233 | 1290 | |
|---|
| 1234 | 1291 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER |
|---|
| .. | .. |
|---|
| 1280 | 1337 | |
|---|
| 1281 | 1338 | /* KCOV sequence number: */ |
|---|
| 1282 | 1339 | int kcov_sequence; |
|---|
| 1340 | + |
|---|
| 1341 | + /* Collect coverage from softirq context: */ |
|---|
| 1342 | + unsigned int kcov_softirq; |
|---|
| 1283 | 1343 | #endif |
|---|
| 1284 | 1344 | |
|---|
| 1285 | 1345 | #ifdef CONFIG_MEMCG |
|---|
| .. | .. |
|---|
| 1305 | 1365 | unsigned int sequential_io; |
|---|
| 1306 | 1366 | unsigned int sequential_io_avg; |
|---|
| 1307 | 1367 | #endif |
|---|
| 1308 | | -#ifdef CONFIG_PREEMPT_RT_BASE |
|---|
| 1309 | | - struct rcu_head put_rcu; |
|---|
| 1310 | | - int softirq_nestcnt; |
|---|
| 1311 | | - unsigned int softirqs_raised; |
|---|
| 1312 | | -#endif |
|---|
| 1313 | | -#ifdef CONFIG_PREEMPT_RT_FULL |
|---|
| 1314 | | -# if defined CONFIG_HIGHMEM || defined CONFIG_X86_32 |
|---|
| 1315 | | - int kmap_idx; |
|---|
| 1316 | | - pte_t kmap_pte[KM_TYPE_NR]; |
|---|
| 1317 | | -# endif |
|---|
| 1318 | | -#endif |
|---|
| 1368 | + struct kmap_ctrl kmap_ctrl; |
|---|
| 1319 | 1369 | #ifdef CONFIG_DEBUG_ATOMIC_SLEEP |
|---|
| 1320 | 1370 | unsigned long task_state_change; |
|---|
| 1321 | | -#endif |
|---|
| 1322 | | -#ifdef CONFIG_PREEMPT_RT_FULL |
|---|
| 1323 | | - int xmit_recursion; |
|---|
| 1324 | 1371 | #endif |
|---|
| 1325 | 1372 | int pagefault_disabled; |
|---|
| 1326 | 1373 | #ifdef CONFIG_MMU |
|---|
| .. | .. |
|---|
| 1331 | 1378 | #endif |
|---|
| 1332 | 1379 | #ifdef CONFIG_THREAD_INFO_IN_TASK |
|---|
| 1333 | 1380 | /* A live task holds one reference: */ |
|---|
| 1334 | | - atomic_t stack_refcount; |
|---|
| 1381 | + refcount_t stack_refcount; |
|---|
| 1335 | 1382 | #endif |
|---|
| 1336 | 1383 | #ifdef CONFIG_LIVEPATCH |
|---|
| 1337 | 1384 | int patch_state; |
|---|
| .. | .. |
|---|
| 1340 | 1387 | /* Used by LSM modules for access restriction: */ |
|---|
| 1341 | 1388 | void *security; |
|---|
| 1342 | 1389 | #endif |
|---|
| 1343 | | - /* task is frozen/stopped (used by the cgroup freezer) */ |
|---|
| 1344 | | - ANDROID_KABI_USE(1, unsigned frozen:1); |
|---|
| 1345 | 1390 | |
|---|
| 1346 | | - /* 095444fad7e3 ("futex: Replace PF_EXITPIDONE with a state") */ |
|---|
| 1347 | | - ANDROID_KABI_USE(2, unsigned int futex_state); |
|---|
| 1391 | +#ifdef CONFIG_GCC_PLUGIN_STACKLEAK |
|---|
| 1392 | + unsigned long lowest_stack; |
|---|
| 1393 | + unsigned long prev_lowest_stack; |
|---|
| 1394 | +#endif |
|---|
| 1348 | 1395 | |
|---|
| 1349 | | - /* |
|---|
| 1350 | | - * f9b0c6c556db ("futex: Add mutex around futex exit") |
|---|
| 1351 | | - * A struct mutex takes 32 bytes, or 4 64bit entries, so pick off |
|---|
| 1352 | | - * 4 of the reserved members, and replace them with a struct mutex. |
|---|
| 1353 | | - * Do the GENKSYMS hack to work around the CRC issues |
|---|
| 1354 | | - */ |
|---|
| 1355 | | -#ifdef __GENKSYMS__ |
|---|
| 1396 | +#ifdef CONFIG_X86_MCE |
|---|
| 1397 | + void __user *mce_vaddr; |
|---|
| 1398 | + __u64 mce_kflags; |
|---|
| 1399 | + u64 mce_addr; |
|---|
| 1400 | + __u64 mce_ripv : 1, |
|---|
| 1401 | + mce_whole_page : 1, |
|---|
| 1402 | + __mce_reserved : 62; |
|---|
| 1403 | + struct callback_head mce_kill_me; |
|---|
| 1404 | + int mce_count; |
|---|
| 1405 | +#endif |
|---|
| 1406 | + ANDROID_VENDOR_DATA_ARRAY(1, 64); |
|---|
| 1407 | + ANDROID_OEM_DATA_ARRAY(1, 32); |
|---|
| 1408 | + |
|---|
| 1409 | + /* PF_IO_WORKER */ |
|---|
| 1410 | + ANDROID_KABI_USE(1, void *pf_io_worker); |
|---|
| 1411 | + |
|---|
| 1412 | + ANDROID_KABI_RESERVE(2); |
|---|
| 1356 | 1413 | ANDROID_KABI_RESERVE(3); |
|---|
| 1357 | 1414 | ANDROID_KABI_RESERVE(4); |
|---|
| 1358 | 1415 | ANDROID_KABI_RESERVE(5); |
|---|
| 1359 | 1416 | ANDROID_KABI_RESERVE(6); |
|---|
| 1360 | | -#else |
|---|
| 1361 | | - struct mutex futex_exit_mutex; |
|---|
| 1362 | | -#endif |
|---|
| 1363 | | - |
|---|
| 1364 | 1417 | ANDROID_KABI_RESERVE(7); |
|---|
| 1365 | 1418 | ANDROID_KABI_RESERVE(8); |
|---|
| 1366 | 1419 | |
|---|
| .. | .. |
|---|
| 1538 | 1591 | /* |
|---|
| 1539 | 1592 | * Per process flags |
|---|
| 1540 | 1593 | */ |
|---|
| 1541 | | -#define PF_IN_SOFTIRQ 0x00000001 /* Task is serving softirq */ |
|---|
| 1594 | +#define PF_VCPU 0x00000001 /* I'm a virtual CPU */ |
|---|
| 1542 | 1595 | #define PF_IDLE 0x00000002 /* I am an IDLE thread */ |
|---|
| 1543 | 1596 | #define PF_EXITING 0x00000004 /* Getting shut down */ |
|---|
| 1544 | | -#define PF_VCPU 0x00000010 /* I'm a virtual CPU */ |
|---|
| 1597 | +#define PF_IO_WORKER 0x00000010 /* Task is an IO worker */ |
|---|
| 1545 | 1598 | #define PF_WQ_WORKER 0x00000020 /* I'm a workqueue worker */ |
|---|
| 1546 | 1599 | #define PF_FORKNOEXEC 0x00000040 /* Forked but didn't exec */ |
|---|
| 1547 | 1600 | #define PF_MCE_PROCESS 0x00000080 /* Process policy on mce errors */ |
|---|
| .. | .. |
|---|
| 1556 | 1609 | #define PF_KSWAPD 0x00020000 /* I am kswapd */ |
|---|
| 1557 | 1610 | #define PF_MEMALLOC_NOFS 0x00040000 /* All allocation requests will inherit GFP_NOFS */ |
|---|
| 1558 | 1611 | #define PF_MEMALLOC_NOIO 0x00080000 /* All allocation requests will inherit GFP_NOIO */ |
|---|
| 1559 | | -#define PF_LESS_THROTTLE 0x00100000 /* Throttle me less: I clean memory */ |
|---|
| 1612 | +#define PF_LOCAL_THROTTLE 0x00100000 /* Throttle writes only against the bdi I write to, |
|---|
| 1613 | + * I am cleaning dirty pages from some other bdi. */ |
|---|
| 1560 | 1614 | #define PF_KTHREAD 0x00200000 /* I am a kernel thread */ |
|---|
| 1561 | 1615 | #define PF_RANDOMIZE 0x00400000 /* Randomize virtual address space */ |
|---|
| 1562 | 1616 | #define PF_SWAPWRITE 0x00800000 /* Allowed to write to swap */ |
|---|
| 1563 | | -#define PF_MEMSTALL 0x01000000 /* Stalled due to lack of memory */ |
|---|
| 1564 | | -#define PF_NO_SETAFFINITY 0x04000000 /* Userland is not allowed to meddle with cpus_allowed */ |
|---|
| 1617 | +#define PF_NO_SETAFFINITY 0x04000000 /* Userland is not allowed to meddle with cpus_mask */ |
|---|
| 1565 | 1618 | #define PF_MCE_EARLY 0x08000000 /* Early kill for mce process policy */ |
|---|
| 1566 | | -#define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */ |
|---|
| 1619 | +#define PF_MEMALLOC_NOCMA 0x10000000 /* All allocation request will have _GFP_MOVABLE cleared */ |
|---|
| 1567 | 1620 | #define PF_FREEZER_SKIP 0x40000000 /* Freezer should not count it as freezable */ |
|---|
| 1568 | 1621 | #define PF_SUSPEND_TASK 0x80000000 /* This thread called freeze_processes() and should not be frozen */ |
|---|
| 1569 | 1622 | |
|---|
| .. | .. |
|---|
| 1613 | 1666 | #define PFA_SPEC_SSB_FORCE_DISABLE 4 /* Speculative Store Bypass force disabled*/ |
|---|
| 1614 | 1667 | #define PFA_SPEC_IB_DISABLE 5 /* Indirect branch speculation restricted */ |
|---|
| 1615 | 1668 | #define PFA_SPEC_IB_FORCE_DISABLE 6 /* Indirect branch speculation permanently restricted */ |
|---|
| 1669 | +#define PFA_SPEC_SSB_NOEXEC 7 /* Speculative Store Bypass clear on execve() */ |
|---|
| 1616 | 1670 | |
|---|
| 1617 | 1671 | #define TASK_PFA_TEST(name, func) \ |
|---|
| 1618 | 1672 | static inline bool task_##func(struct task_struct *p) \ |
|---|
| .. | .. |
|---|
| 1641 | 1695 | TASK_PFA_SET(SPEC_SSB_DISABLE, spec_ssb_disable) |
|---|
| 1642 | 1696 | TASK_PFA_CLEAR(SPEC_SSB_DISABLE, spec_ssb_disable) |
|---|
| 1643 | 1697 | |
|---|
| 1698 | +TASK_PFA_TEST(SPEC_SSB_NOEXEC, spec_ssb_noexec) |
|---|
| 1699 | +TASK_PFA_SET(SPEC_SSB_NOEXEC, spec_ssb_noexec) |
|---|
| 1700 | +TASK_PFA_CLEAR(SPEC_SSB_NOEXEC, spec_ssb_noexec) |
|---|
| 1701 | + |
|---|
| 1644 | 1702 | TASK_PFA_TEST(SPEC_SSB_FORCE_DISABLE, spec_ssb_force_disable) |
|---|
| 1645 | 1703 | TASK_PFA_SET(SPEC_SSB_FORCE_DISABLE, spec_ssb_force_disable) |
|---|
| 1646 | 1704 | |
|---|
| .. | .. |
|---|
| 1659 | 1717 | } |
|---|
| 1660 | 1718 | |
|---|
| 1661 | 1719 | extern int cpuset_cpumask_can_shrink(const struct cpumask *cur, const struct cpumask *trial); |
|---|
| 1662 | | -extern int task_can_attach(struct task_struct *p, const struct cpumask *cs_cpus_allowed); |
|---|
| 1720 | +extern int task_can_attach(struct task_struct *p, const struct cpumask *cs_effective_cpus); |
|---|
| 1721 | + |
|---|
| 1722 | +#ifdef CONFIG_RT_SOFTINT_OPTIMIZATION |
|---|
| 1723 | +extern bool cpupri_check_rt(void); |
|---|
| 1724 | +#else |
|---|
| 1725 | +static inline bool cpupri_check_rt(void) |
|---|
| 1726 | +{ |
|---|
| 1727 | + return false; |
|---|
| 1728 | +} |
|---|
| 1729 | +#endif |
|---|
| 1730 | + |
|---|
| 1663 | 1731 | #ifdef CONFIG_SMP |
|---|
| 1664 | 1732 | extern void do_set_cpus_allowed(struct task_struct *p, const struct cpumask *new_mask); |
|---|
| 1665 | 1733 | extern int set_cpus_allowed_ptr(struct task_struct *p, const struct cpumask *new_mask); |
|---|
| 1734 | +extern void force_compatible_cpus_allowed_ptr(struct task_struct *p); |
|---|
| 1666 | 1735 | #else |
|---|
| 1667 | 1736 | static inline void do_set_cpus_allowed(struct task_struct *p, const struct cpumask *new_mask) |
|---|
| 1668 | 1737 | { |
|---|
| .. | .. |
|---|
| 1673 | 1742 | return -EINVAL; |
|---|
| 1674 | 1743 | return 0; |
|---|
| 1675 | 1744 | } |
|---|
| 1676 | | -#endif |
|---|
| 1677 | | - |
|---|
| 1678 | | -#ifndef cpu_relax_yield |
|---|
| 1679 | | -#define cpu_relax_yield() cpu_relax() |
|---|
| 1680 | 1745 | #endif |
|---|
| 1681 | 1746 | |
|---|
| 1682 | 1747 | extern int yield_to(struct task_struct *p, bool preempt); |
|---|
| .. | .. |
|---|
| 1700 | 1765 | extern int available_idle_cpu(int cpu); |
|---|
| 1701 | 1766 | extern int sched_setscheduler(struct task_struct *, int, const struct sched_param *); |
|---|
| 1702 | 1767 | extern int sched_setscheduler_nocheck(struct task_struct *, int, const struct sched_param *); |
|---|
| 1768 | +extern void sched_set_fifo(struct task_struct *p); |
|---|
| 1769 | +extern void sched_set_fifo_low(struct task_struct *p); |
|---|
| 1770 | +extern void sched_set_normal(struct task_struct *p, int nice); |
|---|
| 1703 | 1771 | extern int sched_setattr(struct task_struct *, const struct sched_attr *); |
|---|
| 1704 | 1772 | extern int sched_setattr_nocheck(struct task_struct *, const struct sched_attr *); |
|---|
| 1705 | 1773 | extern struct task_struct *idle_task(int cpu); |
|---|
| .. | .. |
|---|
| 1710 | 1778 | * |
|---|
| 1711 | 1779 | * Return: 1 if @p is an idle task. 0 otherwise. |
|---|
| 1712 | 1780 | */ |
|---|
| 1713 | | -static inline bool is_idle_task(const struct task_struct *p) |
|---|
| 1781 | +static __always_inline bool is_idle_task(const struct task_struct *p) |
|---|
| 1714 | 1782 | { |
|---|
| 1715 | 1783 | return !!(p->flags & PF_IDLE); |
|---|
| 1716 | 1784 | } |
|---|
| .. | .. |
|---|
| 1789 | 1857 | }) |
|---|
| 1790 | 1858 | |
|---|
| 1791 | 1859 | #ifdef CONFIG_SMP |
|---|
| 1792 | | -void scheduler_ipi(void); |
|---|
| 1860 | +static __always_inline void scheduler_ipi(void) |
|---|
| 1861 | +{ |
|---|
| 1862 | + /* |
|---|
| 1863 | + * Fold TIF_NEED_RESCHED into the preempt_count; anybody setting |
|---|
| 1864 | + * TIF_NEED_RESCHED remotely (for the first time) will also send |
|---|
| 1865 | + * this IPI. |
|---|
| 1866 | + */ |
|---|
| 1867 | + preempt_fold_need_resched(); |
|---|
| 1868 | +} |
|---|
| 1793 | 1869 | extern unsigned long wait_task_inactive(struct task_struct *, long match_state); |
|---|
| 1794 | 1870 | #else |
|---|
| 1795 | 1871 | static inline void scheduler_ipi(void) { } |
|---|
| .. | .. |
|---|
| 1891 | 1967 | { |
|---|
| 1892 | 1968 | if (task->state & (__TASK_STOPPED | __TASK_TRACED)) |
|---|
| 1893 | 1969 | return true; |
|---|
| 1894 | | -#ifdef CONFIG_PREEMPT_RT_FULL |
|---|
| 1970 | +#ifdef CONFIG_PREEMPT_RT |
|---|
| 1895 | 1971 | if (task->saved_state & (__TASK_STOPPED | __TASK_TRACED)) |
|---|
| 1896 | 1972 | return true; |
|---|
| 1897 | 1973 | #endif |
|---|
| .. | .. |
|---|
| 1902 | 1978 | { |
|---|
| 1903 | 1979 | bool traced_stopped; |
|---|
| 1904 | 1980 | |
|---|
| 1905 | | -#ifdef CONFIG_PREEMPT_RT_FULL |
|---|
| 1981 | +#ifdef CONFIG_PREEMPT_RT |
|---|
| 1906 | 1982 | unsigned long flags; |
|---|
| 1907 | 1983 | |
|---|
| 1908 | 1984 | raw_spin_lock_irqsave(&task->pi_lock, flags); |
|---|
| .. | .. |
|---|
| 1920 | 1996 | |
|---|
| 1921 | 1997 | if (task->state & __TASK_TRACED) |
|---|
| 1922 | 1998 | return true; |
|---|
| 1923 | | -#ifdef CONFIG_PREEMPT_RT_FULL |
|---|
| 1999 | +#ifdef CONFIG_PREEMPT_RT |
|---|
| 1924 | 2000 | /* in case the task is sleeping on tasklist_lock */ |
|---|
| 1925 | 2001 | raw_spin_lock_irq(&task->pi_lock); |
|---|
| 1926 | 2002 | if (task->state & __TASK_TRACED) |
|---|
| .. | .. |
|---|
| 1938 | 2014 | * value indicates whether a reschedule was done in fact. |
|---|
| 1939 | 2015 | * cond_resched_lock() will drop the spinlock before scheduling, |
|---|
| 1940 | 2016 | */ |
|---|
| 1941 | | -#ifndef CONFIG_PREEMPT |
|---|
| 2017 | +#ifndef CONFIG_PREEMPTION |
|---|
| 1942 | 2018 | extern int _cond_resched(void); |
|---|
| 1943 | 2019 | #else |
|---|
| 1944 | 2020 | static inline int _cond_resched(void) { return 0; } |
|---|
| .. | .. |
|---|
| 1967 | 2043 | |
|---|
| 1968 | 2044 | /* |
|---|
| 1969 | 2045 | * Does a critical section need to be broken due to another |
|---|
| 1970 | | - * task waiting?: (technically does not depend on CONFIG_PREEMPT, |
|---|
| 2046 | + * task waiting?: (technically does not depend on CONFIG_PREEMPTION, |
|---|
| 1971 | 2047 | * but a general need for low latency) |
|---|
| 1972 | 2048 | */ |
|---|
| 1973 | 2049 | static inline int spin_needbreak(spinlock_t *lock) |
|---|
| 1974 | 2050 | { |
|---|
| 1975 | | -#ifdef CONFIG_PREEMPT |
|---|
| 2051 | +#ifdef CONFIG_PREEMPTION |
|---|
| 1976 | 2052 | return spin_is_contended(lock); |
|---|
| 1977 | 2053 | #else |
|---|
| 1978 | 2054 | return 0; |
|---|
| .. | .. |
|---|
| 1983 | 2059 | { |
|---|
| 1984 | 2060 | return unlikely(tif_need_resched()); |
|---|
| 1985 | 2061 | } |
|---|
| 1986 | | - |
|---|
| 1987 | | -#ifdef CONFIG_PREEMPT_RT_FULL |
|---|
| 1988 | | -static inline void sleeping_lock_inc(void) |
|---|
| 1989 | | -{ |
|---|
| 1990 | | - current->sleeping_lock++; |
|---|
| 1991 | | -} |
|---|
| 1992 | | - |
|---|
| 1993 | | -static inline void sleeping_lock_dec(void) |
|---|
| 1994 | | -{ |
|---|
| 1995 | | - current->sleeping_lock--; |
|---|
| 1996 | | -} |
|---|
| 1997 | | - |
|---|
| 1998 | | -#else |
|---|
| 1999 | | - |
|---|
| 2000 | | -static inline void sleeping_lock_inc(void) { } |
|---|
| 2001 | | -static inline void sleeping_lock_dec(void) { } |
|---|
| 2002 | | -#endif |
|---|
| 2003 | 2062 | |
|---|
| 2004 | 2063 | /* |
|---|
| 2005 | 2064 | * Wrappers for p->thread_info->cpu access. No-op on UP. |
|---|
| .. | .. |
|---|
| 2039 | 2098 | * running or not. |
|---|
| 2040 | 2099 | */ |
|---|
| 2041 | 2100 | #ifndef vcpu_is_preempted |
|---|
| 2042 | | -# define vcpu_is_preempted(cpu) false |
|---|
| 2101 | +static inline bool vcpu_is_preempted(int cpu) |
|---|
| 2102 | +{ |
|---|
| 2103 | + return false; |
|---|
| 2104 | +} |
|---|
| 2043 | 2105 | #endif |
|---|
| 2044 | 2106 | |
|---|
| 2045 | 2107 | extern long sched_setaffinity(pid_t pid, const struct cpumask *new_mask); |
|---|
| .. | .. |
|---|
| 2113 | 2175 | { |
|---|
| 2114 | 2176 | if (clone_flags & CLONE_VM) { |
|---|
| 2115 | 2177 | t->rseq = NULL; |
|---|
| 2116 | | - t->rseq_len = 0; |
|---|
| 2117 | 2178 | t->rseq_sig = 0; |
|---|
| 2118 | 2179 | t->rseq_event_mask = 0; |
|---|
| 2119 | 2180 | } else { |
|---|
| 2120 | 2181 | t->rseq = current->rseq; |
|---|
| 2121 | | - t->rseq_len = current->rseq_len; |
|---|
| 2122 | 2182 | t->rseq_sig = current->rseq_sig; |
|---|
| 2123 | 2183 | t->rseq_event_mask = current->rseq_event_mask; |
|---|
| 2124 | 2184 | } |
|---|
| .. | .. |
|---|
| 2127 | 2187 | static inline void rseq_execve(struct task_struct *t) |
|---|
| 2128 | 2188 | { |
|---|
| 2129 | 2189 | t->rseq = NULL; |
|---|
| 2130 | | - t->rseq_len = 0; |
|---|
| 2131 | 2190 | t->rseq_sig = 0; |
|---|
| 2132 | 2191 | t->rseq_event_mask = 0; |
|---|
| 2133 | 2192 | } |
|---|
| .. | .. |
|---|
| 2172 | 2231 | |
|---|
| 2173 | 2232 | #endif |
|---|
| 2174 | 2233 | |
|---|
| 2175 | | -extern struct task_struct *takedown_cpu_task; |
|---|
| 2234 | +const struct sched_avg *sched_trace_cfs_rq_avg(struct cfs_rq *cfs_rq); |
|---|
| 2235 | +char *sched_trace_cfs_rq_path(struct cfs_rq *cfs_rq, char *str, int len); |
|---|
| 2236 | +int sched_trace_cfs_rq_cpu(struct cfs_rq *cfs_rq); |
|---|
| 2237 | + |
|---|
| 2238 | +const struct sched_avg *sched_trace_rq_avg_rt(struct rq *rq); |
|---|
| 2239 | +const struct sched_avg *sched_trace_rq_avg_dl(struct rq *rq); |
|---|
| 2240 | +const struct sched_avg *sched_trace_rq_avg_irq(struct rq *rq); |
|---|
| 2241 | + |
|---|
| 2242 | +int sched_trace_rq_cpu(struct rq *rq); |
|---|
| 2243 | +int sched_trace_rq_cpu_capacity(struct rq *rq); |
|---|
| 2244 | +int sched_trace_rq_nr_running(struct rq *rq); |
|---|
| 2245 | + |
|---|
| 2246 | +const struct cpumask *sched_trace_rd_span(struct root_domain *rd); |
|---|
| 2176 | 2247 | |
|---|
| 2177 | 2248 | #endif |
|---|