| .. | .. |
|---|
| 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 | 39 | |
|---|
| 34 | 40 | /* task_struct member predeclarations (sorted alphabetically): */ |
|---|
| .. | .. |
|---|
| 36 | 42 | struct backing_dev_info; |
|---|
| 37 | 43 | struct bio_list; |
|---|
| 38 | 44 | struct blk_plug; |
|---|
| 45 | +struct capture_control; |
|---|
| 39 | 46 | struct cfs_rq; |
|---|
| 40 | 47 | struct fs_struct; |
|---|
| 41 | 48 | struct futex_pi_state; |
|---|
| .. | .. |
|---|
| 49 | 56 | struct rcu_node; |
|---|
| 50 | 57 | struct reclaim_state; |
|---|
| 51 | 58 | struct robust_list_head; |
|---|
| 59 | +struct root_domain; |
|---|
| 60 | +struct rq; |
|---|
| 52 | 61 | struct sched_attr; |
|---|
| 53 | 62 | struct sched_param; |
|---|
| 54 | 63 | struct seq_file; |
|---|
| .. | .. |
|---|
| 56 | 65 | struct signal_struct; |
|---|
| 57 | 66 | struct task_delay_info; |
|---|
| 58 | 67 | struct task_group; |
|---|
| 68 | +struct io_uring_task; |
|---|
| 59 | 69 | |
|---|
| 60 | 70 | /* |
|---|
| 61 | 71 | * Task state bitmask. NOTE! These bits are also |
|---|
| .. | .. |
|---|
| 109 | 119 | |
|---|
| 110 | 120 | #define task_is_stopped_or_traced(task) ((task->state & (__TASK_STOPPED | __TASK_TRACED)) != 0) |
|---|
| 111 | 121 | |
|---|
| 112 | | -#define task_contributes_to_load(task) ((task->state & TASK_UNINTERRUPTIBLE) != 0 && \ |
|---|
| 113 | | - (task->flags & PF_FROZEN) == 0 && \ |
|---|
| 114 | | - (task->state & TASK_NOLOAD) == 0) |
|---|
| 115 | | - |
|---|
| 116 | 122 | #ifdef CONFIG_DEBUG_ATOMIC_SLEEP |
|---|
| 117 | 123 | |
|---|
| 118 | 124 | /* |
|---|
| .. | .. |
|---|
| 153 | 159 | * |
|---|
| 154 | 160 | * for (;;) { |
|---|
| 155 | 161 | * set_current_state(TASK_UNINTERRUPTIBLE); |
|---|
| 156 | | - * if (!need_sleep) |
|---|
| 157 | | - * break; |
|---|
| 162 | + * if (CONDITION) |
|---|
| 163 | + * break; |
|---|
| 158 | 164 | * |
|---|
| 159 | 165 | * schedule(); |
|---|
| 160 | 166 | * } |
|---|
| 161 | 167 | * __set_current_state(TASK_RUNNING); |
|---|
| 162 | 168 | * |
|---|
| 163 | 169 | * If the caller does not need such serialisation (because, for instance, the |
|---|
| 164 | | - * condition test and condition change and wakeup are under the same lock) then |
|---|
| 170 | + * CONDITION test and condition change and wakeup are under the same lock) then |
|---|
| 165 | 171 | * use __set_current_state(). |
|---|
| 166 | 172 | * |
|---|
| 167 | 173 | * The above is typically ordered against the wakeup, which does: |
|---|
| 168 | 174 | * |
|---|
| 169 | | - * need_sleep = false; |
|---|
| 175 | + * CONDITION = 1; |
|---|
| 170 | 176 | * wake_up_state(p, TASK_UNINTERRUPTIBLE); |
|---|
| 171 | 177 | * |
|---|
| 172 | | - * where wake_up_state() executes a full memory barrier before accessing the |
|---|
| 173 | | - * task state. |
|---|
| 178 | + * where wake_up_state()/try_to_wake_up() executes a full memory barrier before |
|---|
| 179 | + * accessing p->state. |
|---|
| 174 | 180 | * |
|---|
| 175 | 181 | * Wakeup will do: if (@state & p->state) p->state = TASK_RUNNING, that is, |
|---|
| 176 | 182 | * once it observes the TASK_UNINTERRUPTIBLE store the waking CPU can issue a |
|---|
| 177 | 183 | * TASK_RUNNING store which can collide with __set_current_state(TASK_RUNNING). |
|---|
| 178 | 184 | * |
|---|
| 179 | 185 | * However, with slightly different timing the wakeup TASK_RUNNING store can |
|---|
| 180 | | - * also collide with the TASK_UNINTERRUPTIBLE store. Loosing that store is not |
|---|
| 186 | + * also collide with the TASK_UNINTERRUPTIBLE store. Losing that store is not |
|---|
| 181 | 187 | * a problem either because that will result in one extra go around the loop |
|---|
| 182 | 188 | * and our @cond test will save the day. |
|---|
| 183 | 189 | * |
|---|
| .. | .. |
|---|
| 219 | 225 | extern long schedule_timeout_idle(long timeout); |
|---|
| 220 | 226 | asmlinkage void schedule(void); |
|---|
| 221 | 227 | extern void schedule_preempt_disabled(void); |
|---|
| 228 | +asmlinkage void preempt_schedule_irq(void); |
|---|
| 222 | 229 | |
|---|
| 223 | 230 | extern int __must_check io_schedule_prepare(void); |
|---|
| 224 | 231 | extern void io_schedule_finish(int token); |
|---|
| .. | .. |
|---|
| 242 | 249 | #endif |
|---|
| 243 | 250 | }; |
|---|
| 244 | 251 | |
|---|
| 245 | | -/** |
|---|
| 246 | | - * struct task_cputime - collected CPU time counts |
|---|
| 247 | | - * @utime: time spent in user mode, in nanoseconds |
|---|
| 248 | | - * @stime: time spent in kernel mode, in nanoseconds |
|---|
| 249 | | - * @sum_exec_runtime: total time spent on the CPU, in nanoseconds |
|---|
| 250 | | - * |
|---|
| 251 | | - * This structure groups together three kinds of CPU time that are tracked for |
|---|
| 252 | | - * threads and thread groups. Most things considering CPU time want to group |
|---|
| 253 | | - * these counts together and treat all three of them in parallel. |
|---|
| 254 | | - */ |
|---|
| 255 | | -struct task_cputime { |
|---|
| 256 | | - u64 utime; |
|---|
| 257 | | - u64 stime; |
|---|
| 258 | | - unsigned long long sum_exec_runtime; |
|---|
| 259 | | -}; |
|---|
| 260 | | - |
|---|
| 261 | | -/* Alternate field names when used on cache expirations: */ |
|---|
| 262 | | -#define virt_exp utime |
|---|
| 263 | | -#define prof_exp stime |
|---|
| 264 | | -#define sched_exp sum_exec_runtime |
|---|
| 265 | | - |
|---|
| 266 | 252 | enum vtime_state { |
|---|
| 267 | 253 | /* Task is sleeping or running in a CPU with VTIME inactive: */ |
|---|
| 268 | 254 | VTIME_INACTIVE = 0, |
|---|
| 269 | | - /* Task runs in userspace in a CPU with VTIME active: */ |
|---|
| 270 | | - VTIME_USER, |
|---|
| 255 | + /* Task is idle */ |
|---|
| 256 | + VTIME_IDLE, |
|---|
| 271 | 257 | /* Task runs in kernelspace in a CPU with VTIME active: */ |
|---|
| 272 | 258 | VTIME_SYS, |
|---|
| 259 | + /* Task runs in userspace in a CPU with VTIME active: */ |
|---|
| 260 | + VTIME_USER, |
|---|
| 261 | + /* Task runs as guests in a CPU with VTIME active: */ |
|---|
| 262 | + VTIME_GUEST, |
|---|
| 273 | 263 | }; |
|---|
| 274 | 264 | |
|---|
| 275 | 265 | struct vtime { |
|---|
| 276 | 266 | seqcount_t seqcount; |
|---|
| 277 | 267 | unsigned long long starttime; |
|---|
| 278 | 268 | enum vtime_state state; |
|---|
| 269 | + unsigned int cpu; |
|---|
| 279 | 270 | u64 utime; |
|---|
| 280 | 271 | u64 stime; |
|---|
| 281 | 272 | u64 gtime; |
|---|
| .. | .. |
|---|
| 292 | 283 | UCLAMP_MAX, |
|---|
| 293 | 284 | UCLAMP_CNT |
|---|
| 294 | 285 | }; |
|---|
| 286 | + |
|---|
| 287 | +#ifdef CONFIG_SMP |
|---|
| 288 | +extern struct root_domain def_root_domain; |
|---|
| 289 | +extern struct mutex sched_domains_mutex; |
|---|
| 290 | +#endif |
|---|
| 295 | 291 | |
|---|
| 296 | 292 | struct sched_info { |
|---|
| 297 | 293 | #ifdef CONFIG_SCHED_INFO |
|---|
| .. | .. |
|---|
| 354 | 350 | * Only for tasks we track a moving average of the past instantaneous |
|---|
| 355 | 351 | * estimated utilization. This allows to absorb sporadic drops in utilization |
|---|
| 356 | 352 | * of an otherwise almost periodic task. |
|---|
| 353 | + * |
|---|
| 354 | + * The UTIL_AVG_UNCHANGED flag is used to synchronize util_est with util_avg |
|---|
| 355 | + * updates. When a task is dequeued, its util_est should not be updated if its |
|---|
| 356 | + * util_avg has not been updated in the meantime. |
|---|
| 357 | + * This information is mapped into the MSB bit of util_est.enqueued at dequeue |
|---|
| 358 | + * time. Since max value of util_est.enqueued for a task is 1024 (PELT util_avg |
|---|
| 359 | + * for a task) it is safe to use MSB. |
|---|
| 357 | 360 | */ |
|---|
| 358 | 361 | struct util_est { |
|---|
| 359 | 362 | unsigned int enqueued; |
|---|
| 360 | 363 | unsigned int ewma; |
|---|
| 361 | 364 | #define UTIL_EST_WEIGHT_SHIFT 2 |
|---|
| 365 | +#define UTIL_AVG_UNCHANGED 0x80000000 |
|---|
| 362 | 366 | } __attribute__((__aligned__(sizeof(u64)))); |
|---|
| 363 | 367 | |
|---|
| 364 | 368 | /* |
|---|
| 365 | | - * The load_avg/util_avg accumulates an infinite geometric series |
|---|
| 366 | | - * (see __update_load_avg() in kernel/sched/fair.c). |
|---|
| 369 | + * The load/runnable/util_avg accumulates an infinite geometric series |
|---|
| 370 | + * (see __update_load_avg_cfs_rq() in kernel/sched/pelt.c). |
|---|
| 367 | 371 | * |
|---|
| 368 | 372 | * [load_avg definition] |
|---|
| 369 | 373 | * |
|---|
| 370 | 374 | * load_avg = runnable% * scale_load_down(load) |
|---|
| 371 | 375 | * |
|---|
| 372 | | - * where runnable% is the time ratio that a sched_entity is runnable. |
|---|
| 373 | | - * For cfs_rq, it is the aggregated load_avg of all runnable and |
|---|
| 374 | | - * blocked sched_entities. |
|---|
| 376 | + * [runnable_avg definition] |
|---|
| 377 | + * |
|---|
| 378 | + * runnable_avg = runnable% * SCHED_CAPACITY_SCALE |
|---|
| 375 | 379 | * |
|---|
| 376 | 380 | * [util_avg definition] |
|---|
| 377 | 381 | * |
|---|
| 378 | 382 | * util_avg = running% * SCHED_CAPACITY_SCALE |
|---|
| 379 | 383 | * |
|---|
| 380 | | - * where running% is the time ratio that a sched_entity is running on |
|---|
| 381 | | - * a CPU. For cfs_rq, it is the aggregated util_avg of all runnable |
|---|
| 382 | | - * and blocked sched_entities. |
|---|
| 384 | + * where runnable% is the time ratio that a sched_entity is runnable and |
|---|
| 385 | + * running% the time ratio that a sched_entity is running. |
|---|
| 383 | 386 | * |
|---|
| 384 | | - * load_avg and util_avg don't direcly factor frequency scaling and CPU |
|---|
| 385 | | - * capacity scaling. The scaling is done through the rq_clock_pelt that |
|---|
| 386 | | - * is used for computing those signals (see update_rq_clock_pelt()) |
|---|
| 387 | + * For cfs_rq, they are the aggregated values of all runnable and blocked |
|---|
| 388 | + * sched_entities. |
|---|
| 389 | + * |
|---|
| 390 | + * The load/runnable/util_avg doesn't directly factor frequency scaling and CPU |
|---|
| 391 | + * capacity scaling. The scaling is done through the rq_clock_pelt that is used |
|---|
| 392 | + * for computing those signals (see update_rq_clock_pelt()) |
|---|
| 387 | 393 | * |
|---|
| 388 | 394 | * N.B., the above ratios (runnable% and running%) themselves are in the |
|---|
| 389 | 395 | * range of [0, 1]. To do fixed point arithmetics, we therefore scale them |
|---|
| .. | .. |
|---|
| 407 | 413 | struct sched_avg { |
|---|
| 408 | 414 | u64 last_update_time; |
|---|
| 409 | 415 | u64 load_sum; |
|---|
| 410 | | - u64 runnable_load_sum; |
|---|
| 416 | + u64 runnable_sum; |
|---|
| 411 | 417 | u32 util_sum; |
|---|
| 412 | 418 | u32 period_contrib; |
|---|
| 413 | 419 | unsigned long load_avg; |
|---|
| 414 | | - unsigned long runnable_load_avg; |
|---|
| 420 | + unsigned long runnable_avg; |
|---|
| 415 | 421 | unsigned long util_avg; |
|---|
| 416 | 422 | struct util_est util_est; |
|---|
| 417 | 423 | } ____cacheline_aligned; |
|---|
| .. | .. |
|---|
| 455 | 461 | struct sched_entity { |
|---|
| 456 | 462 | /* For load-balancing: */ |
|---|
| 457 | 463 | struct load_weight load; |
|---|
| 458 | | - unsigned long runnable_weight; |
|---|
| 459 | 464 | struct rb_node run_node; |
|---|
| 460 | 465 | struct list_head group_node; |
|---|
| 461 | 466 | unsigned int on_rq; |
|---|
| .. | .. |
|---|
| 476 | 481 | struct cfs_rq *cfs_rq; |
|---|
| 477 | 482 | /* rq "owned" by this entity/group: */ |
|---|
| 478 | 483 | struct cfs_rq *my_q; |
|---|
| 484 | + /* cached value of my_q->h_nr_running */ |
|---|
| 485 | + unsigned long runnable_weight; |
|---|
| 479 | 486 | #endif |
|---|
| 480 | 487 | |
|---|
| 481 | 488 | #ifdef CONFIG_SMP |
|---|
| .. | .. |
|---|
| 533 | 540 | |
|---|
| 534 | 541 | /* |
|---|
| 535 | 542 | * Actual scheduling parameters. Initialized with the values above, |
|---|
| 536 | | - * they are continously updated during task execution. Note that |
|---|
| 543 | + * they are continuously updated during task execution. Note that |
|---|
| 537 | 544 | * the remaining runtime could be < 0 in case we are in overrun. |
|---|
| 538 | 545 | */ |
|---|
| 539 | 546 | s64 runtime; /* Remaining runtime for this instance */ |
|---|
| .. | .. |
|---|
| 546 | 553 | * @dl_throttled tells if we exhausted the runtime. If so, the |
|---|
| 547 | 554 | * task has to wait for a replenishment to be performed at the |
|---|
| 548 | 555 | * next firing of dl_timer. |
|---|
| 549 | | - * |
|---|
| 550 | | - * @dl_boosted tells if we are boosted due to DI. If so we are |
|---|
| 551 | | - * outside bandwidth enforcement mechanism (but only until we |
|---|
| 552 | | - * exit the critical section); |
|---|
| 553 | 556 | * |
|---|
| 554 | 557 | * @dl_yielded tells if task gave up the CPU before consuming |
|---|
| 555 | 558 | * all its available runtime during the last job. |
|---|
| .. | .. |
|---|
| 565 | 568 | * overruns. |
|---|
| 566 | 569 | */ |
|---|
| 567 | 570 | unsigned int dl_throttled : 1; |
|---|
| 568 | | - unsigned int dl_boosted : 1; |
|---|
| 569 | 571 | unsigned int dl_yielded : 1; |
|---|
| 570 | 572 | unsigned int dl_non_contending : 1; |
|---|
| 571 | 573 | unsigned int dl_overrun : 1; |
|---|
| .. | .. |
|---|
| 584 | 586 | * time. |
|---|
| 585 | 587 | */ |
|---|
| 586 | 588 | struct hrtimer inactive_timer; |
|---|
| 589 | + |
|---|
| 590 | +#ifdef CONFIG_RT_MUTEXES |
|---|
| 591 | + /* |
|---|
| 592 | + * Priority Inheritance. When a DEADLINE scheduling entity is boosted |
|---|
| 593 | + * pi_se points to the donor, otherwise points to the dl_se it belongs |
|---|
| 594 | + * to (the original one/itself). |
|---|
| 595 | + */ |
|---|
| 596 | + struct sched_dl_entity *pi_se; |
|---|
| 597 | +#endif |
|---|
| 587 | 598 | }; |
|---|
| 588 | 599 | |
|---|
| 589 | 600 | #ifdef CONFIG_UCLAMP_TASK |
|---|
| .. | .. |
|---|
| 625 | 636 | struct { |
|---|
| 626 | 637 | u8 blocked; |
|---|
| 627 | 638 | u8 need_qs; |
|---|
| 628 | | - u8 exp_need_qs; |
|---|
| 629 | | - |
|---|
| 630 | | - /* Otherwise the compiler can store garbage here: */ |
|---|
| 631 | | - u8 pad; |
|---|
| 639 | + u8 exp_hint; /* Hint for performance. */ |
|---|
| 640 | + u8 need_mb; /* Readers need smp_mb(). */ |
|---|
| 632 | 641 | } b; /* Bits. */ |
|---|
| 633 | 642 | u32 s; /* Set of bits. */ |
|---|
| 634 | 643 | }; |
|---|
| .. | .. |
|---|
| 662 | 671 | randomized_struct_fields_start |
|---|
| 663 | 672 | |
|---|
| 664 | 673 | void *stack; |
|---|
| 665 | | - atomic_t usage; |
|---|
| 674 | + refcount_t usage; |
|---|
| 666 | 675 | /* Per task flags (PF_*), defined further below: */ |
|---|
| 667 | 676 | unsigned int flags; |
|---|
| 668 | 677 | unsigned int ptrace; |
|---|
| 669 | 678 | |
|---|
| 670 | 679 | #ifdef CONFIG_SMP |
|---|
| 671 | | - struct llist_node wake_entry; |
|---|
| 672 | 680 | int on_cpu; |
|---|
| 681 | + struct __call_single_node wake_entry; |
|---|
| 673 | 682 | #ifdef CONFIG_THREAD_INFO_IN_TASK |
|---|
| 674 | 683 | /* Current CPU: */ |
|---|
| 675 | 684 | unsigned int cpu; |
|---|
| .. | .. |
|---|
| 698 | 707 | const struct sched_class *sched_class; |
|---|
| 699 | 708 | struct sched_entity se; |
|---|
| 700 | 709 | struct sched_rt_entity rt; |
|---|
| 701 | | - |
|---|
| 702 | | - /* task boost vendor fields */ |
|---|
| 703 | | - u64 last_sleep_ts; |
|---|
| 704 | | - int boost; |
|---|
| 705 | | - u64 boost_period; |
|---|
| 706 | | - u64 boost_expires; |
|---|
| 707 | | - |
|---|
| 708 | 710 | #ifdef CONFIG_CGROUP_SCHED |
|---|
| 709 | 711 | struct task_group *sched_task_group; |
|---|
| 710 | 712 | #endif |
|---|
| 711 | 713 | struct sched_dl_entity dl; |
|---|
| 712 | 714 | |
|---|
| 713 | 715 | #ifdef CONFIG_UCLAMP_TASK |
|---|
| 714 | | - /* Clamp values requested for a scheduling entity */ |
|---|
| 716 | + /* |
|---|
| 717 | + * Clamp values requested for a scheduling entity. |
|---|
| 718 | + * Must be updated with task_rq_lock() held. |
|---|
| 719 | + */ |
|---|
| 715 | 720 | struct uclamp_se uclamp_req[UCLAMP_CNT]; |
|---|
| 716 | | - /* Effective clamp values used for a scheduling entity */ |
|---|
| 721 | + /* |
|---|
| 722 | + * Effective clamp values used for a scheduling entity. |
|---|
| 723 | + * Must be updated with task_rq_lock() held. |
|---|
| 724 | + */ |
|---|
| 717 | 725 | struct uclamp_se uclamp[UCLAMP_CNT]; |
|---|
| 726 | +#endif |
|---|
| 727 | + |
|---|
| 728 | +#ifdef CONFIG_HOTPLUG_CPU |
|---|
| 729 | + struct list_head percpu_kthread_node; |
|---|
| 718 | 730 | #endif |
|---|
| 719 | 731 | |
|---|
| 720 | 732 | #ifdef CONFIG_PREEMPT_NOTIFIERS |
|---|
| .. | .. |
|---|
| 728 | 740 | |
|---|
| 729 | 741 | unsigned int policy; |
|---|
| 730 | 742 | int nr_cpus_allowed; |
|---|
| 731 | | - cpumask_t cpus_allowed; |
|---|
| 732 | | - cpumask_t cpus_requested; |
|---|
| 743 | + const cpumask_t *cpus_ptr; |
|---|
| 744 | + cpumask_t cpus_mask; |
|---|
| 733 | 745 | |
|---|
| 734 | 746 | #ifdef CONFIG_PREEMPT_RCU |
|---|
| 735 | 747 | int rcu_read_lock_nesting; |
|---|
| .. | .. |
|---|
| 745 | 757 | int rcu_tasks_idle_cpu; |
|---|
| 746 | 758 | struct list_head rcu_tasks_holdout_list; |
|---|
| 747 | 759 | #endif /* #ifdef CONFIG_TASKS_RCU */ |
|---|
| 760 | + |
|---|
| 761 | +#ifdef CONFIG_TASKS_TRACE_RCU |
|---|
| 762 | + int trc_reader_nesting; |
|---|
| 763 | + int trc_ipi_to_cpu; |
|---|
| 764 | + union rcu_special trc_reader_special; |
|---|
| 765 | + bool trc_reader_checked; |
|---|
| 766 | + struct list_head trc_holdout_list; |
|---|
| 767 | +#endif /* #ifdef CONFIG_TASKS_TRACE_RCU */ |
|---|
| 748 | 768 | |
|---|
| 749 | 769 | struct sched_info sched_info; |
|---|
| 750 | 770 | |
|---|
| .. | .. |
|---|
| 778 | 798 | unsigned sched_reset_on_fork:1; |
|---|
| 779 | 799 | unsigned sched_contributes_to_load:1; |
|---|
| 780 | 800 | unsigned sched_migrated:1; |
|---|
| 781 | | - unsigned sched_remote_wakeup:1; |
|---|
| 782 | 801 | #ifdef CONFIG_PSI |
|---|
| 783 | 802 | unsigned sched_psi_wake_requeue:1; |
|---|
| 784 | 803 | #endif |
|---|
| .. | .. |
|---|
| 788 | 807 | |
|---|
| 789 | 808 | /* Unserialized, strictly 'current' */ |
|---|
| 790 | 809 | |
|---|
| 810 | + /* |
|---|
| 811 | + * This field must not be in the scheduler word above due to wakelist |
|---|
| 812 | + * queueing no longer being serialized by p->on_cpu. However: |
|---|
| 813 | + * |
|---|
| 814 | + * p->XXX = X; ttwu() |
|---|
| 815 | + * schedule() if (p->on_rq && ..) // false |
|---|
| 816 | + * smp_mb__after_spinlock(); if (smp_load_acquire(&p->on_cpu) && //true |
|---|
| 817 | + * deactivate_task() ttwu_queue_wakelist()) |
|---|
| 818 | + * p->on_rq = 0; p->sched_remote_wakeup = Y; |
|---|
| 819 | + * |
|---|
| 820 | + * guarantees all stores of 'current' are visible before |
|---|
| 821 | + * ->sched_remote_wakeup gets used, so it can be in this word. |
|---|
| 822 | + */ |
|---|
| 823 | + unsigned sched_remote_wakeup:1; |
|---|
| 824 | + |
|---|
| 791 | 825 | /* Bit to tell LSMs we're in execve(): */ |
|---|
| 792 | 826 | unsigned in_execve:1; |
|---|
| 793 | 827 | unsigned in_iowait:1; |
|---|
| .. | .. |
|---|
| 796 | 830 | #endif |
|---|
| 797 | 831 | #ifdef CONFIG_MEMCG |
|---|
| 798 | 832 | unsigned in_user_fault:1; |
|---|
| 799 | | -#ifdef CONFIG_MEMCG_KMEM |
|---|
| 800 | | - unsigned memcg_kmem_skip_account:1; |
|---|
| 801 | | -#endif |
|---|
| 802 | 833 | #endif |
|---|
| 803 | 834 | #ifdef CONFIG_COMPAT_BRK |
|---|
| 804 | 835 | unsigned brk_randomized:1; |
|---|
| .. | .. |
|---|
| 806 | 837 | #ifdef CONFIG_CGROUPS |
|---|
| 807 | 838 | /* disallow userland-initiated cgroup migration */ |
|---|
| 808 | 839 | unsigned no_cgroup_migration:1; |
|---|
| 840 | + /* task is frozen/stopped (used by the cgroup freezer) */ |
|---|
| 841 | + unsigned frozen:1; |
|---|
| 809 | 842 | #endif |
|---|
| 810 | 843 | #ifdef CONFIG_BLK_CGROUP |
|---|
| 811 | | - /* to be used once the psi infrastructure lands upstream. */ |
|---|
| 812 | 844 | unsigned use_memdelay:1; |
|---|
| 845 | +#endif |
|---|
| 846 | +#ifdef CONFIG_PSI |
|---|
| 847 | + /* Stalled due to lack of memory */ |
|---|
| 848 | + unsigned in_memstall:1; |
|---|
| 813 | 849 | #endif |
|---|
| 814 | 850 | |
|---|
| 815 | 851 | unsigned long atomic_flags; /* Flags requiring atomic access. */ |
|---|
| .. | .. |
|---|
| 892 | 928 | u64 start_time; |
|---|
| 893 | 929 | |
|---|
| 894 | 930 | /* Boot based time in nsecs: */ |
|---|
| 895 | | - u64 real_start_time; |
|---|
| 931 | + u64 start_boottime; |
|---|
| 896 | 932 | |
|---|
| 897 | 933 | /* MM fault and swap info: this can arguably be seen as either mm-specific or thread-specific: */ |
|---|
| 898 | 934 | unsigned long min_flt; |
|---|
| 899 | 935 | unsigned long maj_flt; |
|---|
| 900 | 936 | |
|---|
| 901 | | -#ifdef CONFIG_POSIX_TIMERS |
|---|
| 902 | | - struct task_cputime cputime_expires; |
|---|
| 903 | | - struct list_head cpu_timers[3]; |
|---|
| 937 | + /* Empty if CONFIG_POSIX_CPUTIMERS=n */ |
|---|
| 938 | + struct posix_cputimers posix_cputimers; |
|---|
| 939 | + |
|---|
| 940 | +#ifdef CONFIG_POSIX_CPU_TIMERS_TASK_WORK |
|---|
| 941 | + struct posix_cputimers_work posix_cputimers_work; |
|---|
| 904 | 942 | #endif |
|---|
| 905 | 943 | |
|---|
| 906 | 944 | /* Process credentials: */ |
|---|
| .. | .. |
|---|
| 913 | 951 | |
|---|
| 914 | 952 | /* Effective (overridable) subjective task credentials (COW): */ |
|---|
| 915 | 953 | const struct cred __rcu *cred; |
|---|
| 954 | + |
|---|
| 955 | +#ifdef CONFIG_KEYS |
|---|
| 956 | + /* Cached requested key. */ |
|---|
| 957 | + struct key *cached_requested_key; |
|---|
| 958 | +#endif |
|---|
| 916 | 959 | |
|---|
| 917 | 960 | /* |
|---|
| 918 | 961 | * executable name, excluding path. |
|---|
| .. | .. |
|---|
| 939 | 982 | /* Open file information: */ |
|---|
| 940 | 983 | struct files_struct *files; |
|---|
| 941 | 984 | |
|---|
| 985 | +#ifdef CONFIG_IO_URING |
|---|
| 986 | + struct io_uring_task *io_uring; |
|---|
| 987 | +#endif |
|---|
| 988 | + |
|---|
| 942 | 989 | /* Namespaces: */ |
|---|
| 943 | 990 | struct nsproxy *nsproxy; |
|---|
| 944 | 991 | |
|---|
| 945 | 992 | /* Signal handlers: */ |
|---|
| 946 | 993 | struct signal_struct *signal; |
|---|
| 947 | | - struct sighand_struct *sighand; |
|---|
| 994 | + struct sighand_struct __rcu *sighand; |
|---|
| 948 | 995 | sigset_t blocked; |
|---|
| 949 | 996 | sigset_t real_blocked; |
|---|
| 950 | 997 | /* Restored if set_restore_sigmask() was used: */ |
|---|
| .. | .. |
|---|
| 956 | 1003 | |
|---|
| 957 | 1004 | struct callback_head *task_works; |
|---|
| 958 | 1005 | |
|---|
| 959 | | - struct audit_context *audit_context; |
|---|
| 1006 | +#ifdef CONFIG_AUDIT |
|---|
| 960 | 1007 | #ifdef CONFIG_AUDITSYSCALL |
|---|
| 1008 | + struct audit_context *audit_context; |
|---|
| 1009 | +#endif |
|---|
| 961 | 1010 | kuid_t loginuid; |
|---|
| 962 | 1011 | unsigned int sessionid; |
|---|
| 963 | 1012 | #endif |
|---|
| .. | .. |
|---|
| 974 | 1023 | raw_spinlock_t pi_lock; |
|---|
| 975 | 1024 | |
|---|
| 976 | 1025 | struct wake_q_node wake_q; |
|---|
| 1026 | + int wake_q_count; |
|---|
| 977 | 1027 | |
|---|
| 978 | 1028 | #ifdef CONFIG_RT_MUTEXES |
|---|
| 979 | 1029 | /* PI waiters blocked on a rt_mutex held by this task: */ |
|---|
| .. | .. |
|---|
| 983 | 1033 | /* Deadlock detection and priority inheritance handling: */ |
|---|
| 984 | 1034 | struct rt_mutex_waiter *pi_blocked_on; |
|---|
| 985 | 1035 | #endif |
|---|
| 986 | | -#ifdef CONFIG_MM_EVENT_STAT |
|---|
| 987 | | - struct mm_event_task mm_event[MM_TYPE_NUM]; |
|---|
| 988 | | - unsigned long next_period; |
|---|
| 989 | | -#endif |
|---|
| 1036 | + |
|---|
| 990 | 1037 | #ifdef CONFIG_DEBUG_MUTEXES |
|---|
| 991 | 1038 | /* Mutex deadlock detection: */ |
|---|
| 992 | 1039 | struct mutex_waiter *blocked_on; |
|---|
| 993 | 1040 | #endif |
|---|
| 994 | 1041 | |
|---|
| 1042 | +#ifdef CONFIG_DEBUG_ATOMIC_SLEEP |
|---|
| 1043 | + int non_block_count; |
|---|
| 1044 | +#endif |
|---|
| 1045 | + |
|---|
| 995 | 1046 | #ifdef CONFIG_TRACE_IRQFLAGS |
|---|
| 996 | | - unsigned int irq_events; |
|---|
| 997 | | - unsigned long hardirq_enable_ip; |
|---|
| 998 | | - unsigned long hardirq_disable_ip; |
|---|
| 999 | | - unsigned int hardirq_enable_event; |
|---|
| 1000 | | - unsigned int hardirq_disable_event; |
|---|
| 1001 | | - int hardirqs_enabled; |
|---|
| 1002 | | - int hardirq_context; |
|---|
| 1003 | | - unsigned long softirq_disable_ip; |
|---|
| 1004 | | - unsigned long softirq_enable_ip; |
|---|
| 1005 | | - unsigned int softirq_disable_event; |
|---|
| 1006 | | - unsigned int softirq_enable_event; |
|---|
| 1047 | + struct irqtrace_events irqtrace; |
|---|
| 1048 | + unsigned int hardirq_threaded; |
|---|
| 1049 | + u64 hardirq_chain_key; |
|---|
| 1007 | 1050 | int softirqs_enabled; |
|---|
| 1008 | 1051 | int softirq_context; |
|---|
| 1052 | + int irq_config; |
|---|
| 1009 | 1053 | #endif |
|---|
| 1010 | 1054 | |
|---|
| 1011 | 1055 | #ifdef CONFIG_LOCKDEP |
|---|
| .. | .. |
|---|
| 1016 | 1060 | struct held_lock held_locks[MAX_LOCK_DEPTH]; |
|---|
| 1017 | 1061 | #endif |
|---|
| 1018 | 1062 | |
|---|
| 1019 | | -#ifdef CONFIG_UBSAN |
|---|
| 1063 | +#if defined(CONFIG_UBSAN) && !defined(CONFIG_UBSAN_TRAP) |
|---|
| 1020 | 1064 | unsigned int in_ubsan; |
|---|
| 1021 | 1065 | #endif |
|---|
| 1022 | 1066 | |
|---|
| .. | .. |
|---|
| 1038 | 1082 | |
|---|
| 1039 | 1083 | struct io_context *io_context; |
|---|
| 1040 | 1084 | |
|---|
| 1085 | +#ifdef CONFIG_COMPACTION |
|---|
| 1086 | + struct capture_control *capture_control; |
|---|
| 1087 | +#endif |
|---|
| 1041 | 1088 | /* Ptrace state: */ |
|---|
| 1042 | 1089 | unsigned long ptrace_message; |
|---|
| 1043 | | - siginfo_t *last_siginfo; |
|---|
| 1090 | + kernel_siginfo_t *last_siginfo; |
|---|
| 1044 | 1091 | |
|---|
| 1045 | 1092 | struct task_io_accounting ioac; |
|---|
| 1046 | 1093 | #ifdef CONFIG_PSI |
|---|
| .. | .. |
|---|
| 1059 | 1106 | /* Protected by ->alloc_lock: */ |
|---|
| 1060 | 1107 | nodemask_t mems_allowed; |
|---|
| 1061 | 1108 | /* Seqence number to catch updates: */ |
|---|
| 1062 | | - seqcount_t mems_allowed_seq; |
|---|
| 1109 | + seqcount_spinlock_t mems_allowed_seq; |
|---|
| 1063 | 1110 | int cpuset_mem_spread_rotor; |
|---|
| 1064 | 1111 | int cpuset_slab_spread_rotor; |
|---|
| 1065 | 1112 | #endif |
|---|
| .. | .. |
|---|
| 1069 | 1116 | /* cg_list protected by css_set_lock and tsk->alloc_lock: */ |
|---|
| 1070 | 1117 | struct list_head cg_list; |
|---|
| 1071 | 1118 | #endif |
|---|
| 1072 | | -#ifdef CONFIG_INTEL_RDT |
|---|
| 1119 | +#ifdef CONFIG_X86_CPU_RESCTRL |
|---|
| 1073 | 1120 | u32 closid; |
|---|
| 1074 | 1121 | u32 rmid; |
|---|
| 1075 | 1122 | #endif |
|---|
| .. | .. |
|---|
| 1080 | 1127 | #endif |
|---|
| 1081 | 1128 | struct list_head pi_state_list; |
|---|
| 1082 | 1129 | struct futex_pi_state *pi_state_cache; |
|---|
| 1130 | + struct mutex futex_exit_mutex; |
|---|
| 1131 | + unsigned int futex_state; |
|---|
| 1083 | 1132 | #endif |
|---|
| 1084 | 1133 | #ifdef CONFIG_PERF_EVENTS |
|---|
| 1085 | 1134 | struct perf_event_context *perf_event_ctxp[perf_nr_task_contexts]; |
|---|
| .. | .. |
|---|
| 1147 | 1196 | |
|---|
| 1148 | 1197 | #ifdef CONFIG_RSEQ |
|---|
| 1149 | 1198 | struct rseq __user *rseq; |
|---|
| 1150 | | - u32 rseq_len; |
|---|
| 1151 | 1199 | u32 rseq_sig; |
|---|
| 1152 | 1200 | /* |
|---|
| 1153 | 1201 | * RmW on rseq_event_mask must be performed atomically |
|---|
| .. | .. |
|---|
| 1158 | 1206 | |
|---|
| 1159 | 1207 | struct tlbflush_unmap_batch tlb_ubc; |
|---|
| 1160 | 1208 | |
|---|
| 1161 | | - struct rcu_head rcu; |
|---|
| 1209 | + union { |
|---|
| 1210 | + refcount_t rcu_users; |
|---|
| 1211 | + struct rcu_head rcu; |
|---|
| 1212 | + }; |
|---|
| 1162 | 1213 | |
|---|
| 1163 | 1214 | /* Cache last used pipe for splice(): */ |
|---|
| 1164 | 1215 | struct pipe_inode_info *splice_pipe; |
|---|
| .. | .. |
|---|
| 1193 | 1244 | u64 timer_slack_ns; |
|---|
| 1194 | 1245 | u64 default_timer_slack_ns; |
|---|
| 1195 | 1246 | |
|---|
| 1196 | | -#ifdef CONFIG_KASAN |
|---|
| 1247 | +#if defined(CONFIG_KASAN_GENERIC) || defined(CONFIG_KASAN_SW_TAGS) |
|---|
| 1197 | 1248 | unsigned int kasan_depth; |
|---|
| 1249 | +#endif |
|---|
| 1250 | + |
|---|
| 1251 | +#ifdef CONFIG_KCSAN |
|---|
| 1252 | + struct kcsan_ctx kcsan_ctx; |
|---|
| 1253 | +#ifdef CONFIG_TRACE_IRQFLAGS |
|---|
| 1254 | + struct irqtrace_events kcsan_save_irqtrace; |
|---|
| 1255 | +#endif |
|---|
| 1256 | +#endif |
|---|
| 1257 | + |
|---|
| 1258 | +#if IS_ENABLED(CONFIG_KUNIT) |
|---|
| 1259 | + struct kunit *kunit_test; |
|---|
| 1198 | 1260 | #endif |
|---|
| 1199 | 1261 | |
|---|
| 1200 | 1262 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER |
|---|
| .. | .. |
|---|
| 1246 | 1308 | |
|---|
| 1247 | 1309 | /* KCOV sequence number: */ |
|---|
| 1248 | 1310 | int kcov_sequence; |
|---|
| 1311 | + |
|---|
| 1312 | + /* Collect coverage from softirq context: */ |
|---|
| 1313 | + unsigned int kcov_softirq; |
|---|
| 1249 | 1314 | #endif |
|---|
| 1250 | 1315 | |
|---|
| 1251 | 1316 | #ifdef CONFIG_MEMCG |
|---|
| .. | .. |
|---|
| 1283 | 1348 | #endif |
|---|
| 1284 | 1349 | #ifdef CONFIG_THREAD_INFO_IN_TASK |
|---|
| 1285 | 1350 | /* A live task holds one reference: */ |
|---|
| 1286 | | - atomic_t stack_refcount; |
|---|
| 1351 | + refcount_t stack_refcount; |
|---|
| 1287 | 1352 | #endif |
|---|
| 1288 | 1353 | #ifdef CONFIG_LIVEPATCH |
|---|
| 1289 | 1354 | int patch_state; |
|---|
| .. | .. |
|---|
| 1292 | 1357 | /* Used by LSM modules for access restriction: */ |
|---|
| 1293 | 1358 | void *security; |
|---|
| 1294 | 1359 | #endif |
|---|
| 1295 | | - /* task is frozen/stopped (used by the cgroup freezer) */ |
|---|
| 1296 | | - ANDROID_KABI_USE(1, unsigned frozen:1); |
|---|
| 1297 | 1360 | |
|---|
| 1298 | | - /* 095444fad7e3 ("futex: Replace PF_EXITPIDONE with a state") */ |
|---|
| 1299 | | - ANDROID_KABI_USE(2, unsigned int futex_state); |
|---|
| 1361 | +#ifdef CONFIG_GCC_PLUGIN_STACKLEAK |
|---|
| 1362 | + unsigned long lowest_stack; |
|---|
| 1363 | + unsigned long prev_lowest_stack; |
|---|
| 1364 | +#endif |
|---|
| 1300 | 1365 | |
|---|
| 1301 | | - /* |
|---|
| 1302 | | - * f9b0c6c556db ("futex: Add mutex around futex exit") |
|---|
| 1303 | | - * A struct mutex takes 32 bytes, or 4 64bit entries, so pick off |
|---|
| 1304 | | - * 4 of the reserved members, and replace them with a struct mutex. |
|---|
| 1305 | | - * Do the GENKSYMS hack to work around the CRC issues |
|---|
| 1306 | | - */ |
|---|
| 1307 | | -#ifdef __GENKSYMS__ |
|---|
| 1366 | +#ifdef CONFIG_X86_MCE |
|---|
| 1367 | + void __user *mce_vaddr; |
|---|
| 1368 | + __u64 mce_kflags; |
|---|
| 1369 | + u64 mce_addr; |
|---|
| 1370 | + __u64 mce_ripv : 1, |
|---|
| 1371 | + mce_whole_page : 1, |
|---|
| 1372 | + __mce_reserved : 62; |
|---|
| 1373 | + struct callback_head mce_kill_me; |
|---|
| 1374 | + int mce_count; |
|---|
| 1375 | +#endif |
|---|
| 1376 | + ANDROID_VENDOR_DATA_ARRAY(1, 64); |
|---|
| 1377 | + ANDROID_OEM_DATA_ARRAY(1, 32); |
|---|
| 1378 | + |
|---|
| 1379 | + /* PF_IO_WORKER */ |
|---|
| 1380 | + ANDROID_KABI_USE(1, void *pf_io_worker); |
|---|
| 1381 | + |
|---|
| 1382 | + ANDROID_KABI_RESERVE(2); |
|---|
| 1308 | 1383 | ANDROID_KABI_RESERVE(3); |
|---|
| 1309 | 1384 | ANDROID_KABI_RESERVE(4); |
|---|
| 1310 | 1385 | ANDROID_KABI_RESERVE(5); |
|---|
| 1311 | 1386 | ANDROID_KABI_RESERVE(6); |
|---|
| 1312 | | -#else |
|---|
| 1313 | | - struct mutex futex_exit_mutex; |
|---|
| 1314 | | -#endif |
|---|
| 1315 | | - |
|---|
| 1316 | 1387 | ANDROID_KABI_RESERVE(7); |
|---|
| 1317 | 1388 | ANDROID_KABI_RESERVE(8); |
|---|
| 1318 | 1389 | |
|---|
| .. | .. |
|---|
| 1490 | 1561 | /* |
|---|
| 1491 | 1562 | * Per process flags |
|---|
| 1492 | 1563 | */ |
|---|
| 1564 | +#define PF_VCPU 0x00000001 /* I'm a virtual CPU */ |
|---|
| 1493 | 1565 | #define PF_IDLE 0x00000002 /* I am an IDLE thread */ |
|---|
| 1494 | 1566 | #define PF_EXITING 0x00000004 /* Getting shut down */ |
|---|
| 1495 | | -#define PF_VCPU 0x00000010 /* I'm a virtual CPU */ |
|---|
| 1567 | +#define PF_IO_WORKER 0x00000010 /* Task is an IO worker */ |
|---|
| 1496 | 1568 | #define PF_WQ_WORKER 0x00000020 /* I'm a workqueue worker */ |
|---|
| 1497 | 1569 | #define PF_FORKNOEXEC 0x00000040 /* Forked but didn't exec */ |
|---|
| 1498 | 1570 | #define PF_MCE_PROCESS 0x00000080 /* Process policy on mce errors */ |
|---|
| .. | .. |
|---|
| 1507 | 1579 | #define PF_KSWAPD 0x00020000 /* I am kswapd */ |
|---|
| 1508 | 1580 | #define PF_MEMALLOC_NOFS 0x00040000 /* All allocation requests will inherit GFP_NOFS */ |
|---|
| 1509 | 1581 | #define PF_MEMALLOC_NOIO 0x00080000 /* All allocation requests will inherit GFP_NOIO */ |
|---|
| 1510 | | -#define PF_LESS_THROTTLE 0x00100000 /* Throttle me less: I clean memory */ |
|---|
| 1582 | +#define PF_LOCAL_THROTTLE 0x00100000 /* Throttle writes only against the bdi I write to, |
|---|
| 1583 | + * I am cleaning dirty pages from some other bdi. */ |
|---|
| 1511 | 1584 | #define PF_KTHREAD 0x00200000 /* I am a kernel thread */ |
|---|
| 1512 | 1585 | #define PF_RANDOMIZE 0x00400000 /* Randomize virtual address space */ |
|---|
| 1513 | 1586 | #define PF_SWAPWRITE 0x00800000 /* Allowed to write to swap */ |
|---|
| 1514 | | -#define PF_MEMSTALL 0x01000000 /* Stalled due to lack of memory */ |
|---|
| 1515 | | -#define PF_NO_SETAFFINITY 0x04000000 /* Userland is not allowed to meddle with cpus_allowed */ |
|---|
| 1587 | +#define PF_NO_SETAFFINITY 0x04000000 /* Userland is not allowed to meddle with cpus_mask */ |
|---|
| 1516 | 1588 | #define PF_MCE_EARLY 0x08000000 /* Early kill for mce process policy */ |
|---|
| 1517 | | -#define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */ |
|---|
| 1589 | +#define PF_MEMALLOC_NOCMA 0x10000000 /* All allocation request will have _GFP_MOVABLE cleared */ |
|---|
| 1518 | 1590 | #define PF_FREEZER_SKIP 0x40000000 /* Freezer should not count it as freezable */ |
|---|
| 1519 | 1591 | #define PF_SUSPEND_TASK 0x80000000 /* This thread called freeze_processes() and should not be frozen */ |
|---|
| 1520 | 1592 | |
|---|
| .. | .. |
|---|
| 1564 | 1636 | #define PFA_SPEC_SSB_FORCE_DISABLE 4 /* Speculative Store Bypass force disabled*/ |
|---|
| 1565 | 1637 | #define PFA_SPEC_IB_DISABLE 5 /* Indirect branch speculation restricted */ |
|---|
| 1566 | 1638 | #define PFA_SPEC_IB_FORCE_DISABLE 6 /* Indirect branch speculation permanently restricted */ |
|---|
| 1639 | +#define PFA_SPEC_SSB_NOEXEC 7 /* Speculative Store Bypass clear on execve() */ |
|---|
| 1567 | 1640 | |
|---|
| 1568 | 1641 | #define TASK_PFA_TEST(name, func) \ |
|---|
| 1569 | 1642 | static inline bool task_##func(struct task_struct *p) \ |
|---|
| .. | .. |
|---|
| 1592 | 1665 | TASK_PFA_SET(SPEC_SSB_DISABLE, spec_ssb_disable) |
|---|
| 1593 | 1666 | TASK_PFA_CLEAR(SPEC_SSB_DISABLE, spec_ssb_disable) |
|---|
| 1594 | 1667 | |
|---|
| 1668 | +TASK_PFA_TEST(SPEC_SSB_NOEXEC, spec_ssb_noexec) |
|---|
| 1669 | +TASK_PFA_SET(SPEC_SSB_NOEXEC, spec_ssb_noexec) |
|---|
| 1670 | +TASK_PFA_CLEAR(SPEC_SSB_NOEXEC, spec_ssb_noexec) |
|---|
| 1671 | + |
|---|
| 1595 | 1672 | TASK_PFA_TEST(SPEC_SSB_FORCE_DISABLE, spec_ssb_force_disable) |
|---|
| 1596 | 1673 | TASK_PFA_SET(SPEC_SSB_FORCE_DISABLE, spec_ssb_force_disable) |
|---|
| 1597 | 1674 | |
|---|
| .. | .. |
|---|
| 1610 | 1687 | } |
|---|
| 1611 | 1688 | |
|---|
| 1612 | 1689 | extern int cpuset_cpumask_can_shrink(const struct cpumask *cur, const struct cpumask *trial); |
|---|
| 1613 | | -extern int task_can_attach(struct task_struct *p, const struct cpumask *cs_cpus_allowed); |
|---|
| 1690 | + |
|---|
| 1691 | +#ifdef CONFIG_RT_SOFTINT_OPTIMIZATION |
|---|
| 1692 | +extern bool cpupri_check_rt(void); |
|---|
| 1693 | +#else |
|---|
| 1694 | +static inline bool cpupri_check_rt(void) |
|---|
| 1695 | +{ |
|---|
| 1696 | + return false; |
|---|
| 1697 | +} |
|---|
| 1698 | +#endif |
|---|
| 1699 | + |
|---|
| 1700 | +extern int task_can_attach(struct task_struct *p); |
|---|
| 1701 | +extern int dl_bw_alloc(int cpu, u64 dl_bw); |
|---|
| 1702 | +extern void dl_bw_free(int cpu, u64 dl_bw); |
|---|
| 1614 | 1703 | #ifdef CONFIG_SMP |
|---|
| 1615 | 1704 | extern void do_set_cpus_allowed(struct task_struct *p, const struct cpumask *new_mask); |
|---|
| 1616 | 1705 | extern int set_cpus_allowed_ptr(struct task_struct *p, const struct cpumask *new_mask); |
|---|
| 1706 | +extern void force_compatible_cpus_allowed_ptr(struct task_struct *p); |
|---|
| 1617 | 1707 | #else |
|---|
| 1618 | 1708 | static inline void do_set_cpus_allowed(struct task_struct *p, const struct cpumask *new_mask) |
|---|
| 1619 | 1709 | { |
|---|
| .. | .. |
|---|
| 1624 | 1714 | return -EINVAL; |
|---|
| 1625 | 1715 | return 0; |
|---|
| 1626 | 1716 | } |
|---|
| 1627 | | -#endif |
|---|
| 1628 | | - |
|---|
| 1629 | | -#ifndef cpu_relax_yield |
|---|
| 1630 | | -#define cpu_relax_yield() cpu_relax() |
|---|
| 1631 | 1717 | #endif |
|---|
| 1632 | 1718 | |
|---|
| 1633 | 1719 | extern int yield_to(struct task_struct *p, bool preempt); |
|---|
| .. | .. |
|---|
| 1651 | 1737 | extern int available_idle_cpu(int cpu); |
|---|
| 1652 | 1738 | extern int sched_setscheduler(struct task_struct *, int, const struct sched_param *); |
|---|
| 1653 | 1739 | extern int sched_setscheduler_nocheck(struct task_struct *, int, const struct sched_param *); |
|---|
| 1740 | +extern void sched_set_fifo(struct task_struct *p); |
|---|
| 1741 | +extern void sched_set_fifo_low(struct task_struct *p); |
|---|
| 1742 | +extern void sched_set_normal(struct task_struct *p, int nice); |
|---|
| 1654 | 1743 | extern int sched_setattr(struct task_struct *, const struct sched_attr *); |
|---|
| 1655 | 1744 | extern int sched_setattr_nocheck(struct task_struct *, const struct sched_attr *); |
|---|
| 1656 | 1745 | extern struct task_struct *idle_task(int cpu); |
|---|
| .. | .. |
|---|
| 1661 | 1750 | * |
|---|
| 1662 | 1751 | * Return: 1 if @p is an idle task. 0 otherwise. |
|---|
| 1663 | 1752 | */ |
|---|
| 1664 | | -static inline bool is_idle_task(const struct task_struct *p) |
|---|
| 1753 | +static __always_inline bool is_idle_task(const struct task_struct *p) |
|---|
| 1665 | 1754 | { |
|---|
| 1666 | 1755 | return !!(p->flags & PF_IDLE); |
|---|
| 1667 | 1756 | } |
|---|
| .. | .. |
|---|
| 1739 | 1828 | }) |
|---|
| 1740 | 1829 | |
|---|
| 1741 | 1830 | #ifdef CONFIG_SMP |
|---|
| 1742 | | -void scheduler_ipi(void); |
|---|
| 1831 | +static __always_inline void scheduler_ipi(void) |
|---|
| 1832 | +{ |
|---|
| 1833 | + /* |
|---|
| 1834 | + * Fold TIF_NEED_RESCHED into the preempt_count; anybody setting |
|---|
| 1835 | + * TIF_NEED_RESCHED remotely (for the first time) will also send |
|---|
| 1836 | + * this IPI. |
|---|
| 1837 | + */ |
|---|
| 1838 | + preempt_fold_need_resched(); |
|---|
| 1839 | +} |
|---|
| 1743 | 1840 | extern unsigned long wait_task_inactive(struct task_struct *, long match_state); |
|---|
| 1744 | 1841 | #else |
|---|
| 1745 | 1842 | static inline void scheduler_ipi(void) { } |
|---|
| .. | .. |
|---|
| 1805 | 1902 | * value indicates whether a reschedule was done in fact. |
|---|
| 1806 | 1903 | * cond_resched_lock() will drop the spinlock before scheduling, |
|---|
| 1807 | 1904 | */ |
|---|
| 1808 | | -#ifndef CONFIG_PREEMPT |
|---|
| 1905 | +#ifndef CONFIG_PREEMPTION |
|---|
| 1809 | 1906 | extern int _cond_resched(void); |
|---|
| 1810 | 1907 | #else |
|---|
| 1811 | 1908 | static inline int _cond_resched(void) { return 0; } |
|---|
| .. | .. |
|---|
| 1834 | 1931 | |
|---|
| 1835 | 1932 | /* |
|---|
| 1836 | 1933 | * Does a critical section need to be broken due to another |
|---|
| 1837 | | - * task waiting?: (technically does not depend on CONFIG_PREEMPT, |
|---|
| 1934 | + * task waiting?: (technically does not depend on CONFIG_PREEMPTION, |
|---|
| 1838 | 1935 | * but a general need for low latency) |
|---|
| 1839 | 1936 | */ |
|---|
| 1840 | 1937 | static inline int spin_needbreak(spinlock_t *lock) |
|---|
| 1841 | 1938 | { |
|---|
| 1842 | | -#ifdef CONFIG_PREEMPT |
|---|
| 1939 | +#ifdef CONFIG_PREEMPTION |
|---|
| 1843 | 1940 | return spin_is_contended(lock); |
|---|
| 1844 | 1941 | #else |
|---|
| 1845 | 1942 | return 0; |
|---|
| .. | .. |
|---|
| 1889 | 1986 | * running or not. |
|---|
| 1890 | 1987 | */ |
|---|
| 1891 | 1988 | #ifndef vcpu_is_preempted |
|---|
| 1892 | | -# define vcpu_is_preempted(cpu) false |
|---|
| 1989 | +static inline bool vcpu_is_preempted(int cpu) |
|---|
| 1990 | +{ |
|---|
| 1991 | + return false; |
|---|
| 1992 | +} |
|---|
| 1893 | 1993 | #endif |
|---|
| 1894 | 1994 | |
|---|
| 1895 | 1995 | extern long sched_setaffinity(pid_t pid, const struct cpumask *new_mask); |
|---|
| .. | .. |
|---|
| 1963 | 2063 | { |
|---|
| 1964 | 2064 | if (clone_flags & CLONE_VM) { |
|---|
| 1965 | 2065 | t->rseq = NULL; |
|---|
| 1966 | | - t->rseq_len = 0; |
|---|
| 1967 | 2066 | t->rseq_sig = 0; |
|---|
| 1968 | 2067 | t->rseq_event_mask = 0; |
|---|
| 1969 | 2068 | } else { |
|---|
| 1970 | 2069 | t->rseq = current->rseq; |
|---|
| 1971 | | - t->rseq_len = current->rseq_len; |
|---|
| 1972 | 2070 | t->rseq_sig = current->rseq_sig; |
|---|
| 1973 | 2071 | t->rseq_event_mask = current->rseq_event_mask; |
|---|
| 1974 | 2072 | } |
|---|
| .. | .. |
|---|
| 1977 | 2075 | static inline void rseq_execve(struct task_struct *t) |
|---|
| 1978 | 2076 | { |
|---|
| 1979 | 2077 | t->rseq = NULL; |
|---|
| 1980 | | - t->rseq_len = 0; |
|---|
| 1981 | 2078 | t->rseq_sig = 0; |
|---|
| 1982 | 2079 | t->rseq_event_mask = 0; |
|---|
| 1983 | 2080 | } |
|---|
| .. | .. |
|---|
| 2022 | 2119 | |
|---|
| 2023 | 2120 | #endif |
|---|
| 2024 | 2121 | |
|---|
| 2122 | +const struct sched_avg *sched_trace_cfs_rq_avg(struct cfs_rq *cfs_rq); |
|---|
| 2123 | +char *sched_trace_cfs_rq_path(struct cfs_rq *cfs_rq, char *str, int len); |
|---|
| 2124 | +int sched_trace_cfs_rq_cpu(struct cfs_rq *cfs_rq); |
|---|
| 2125 | + |
|---|
| 2126 | +const struct sched_avg *sched_trace_rq_avg_rt(struct rq *rq); |
|---|
| 2127 | +const struct sched_avg *sched_trace_rq_avg_dl(struct rq *rq); |
|---|
| 2128 | +const struct sched_avg *sched_trace_rq_avg_irq(struct rq *rq); |
|---|
| 2129 | + |
|---|
| 2130 | +int sched_trace_rq_cpu(struct rq *rq); |
|---|
| 2131 | +int sched_trace_rq_cpu_capacity(struct rq *rq); |
|---|
| 2132 | +int sched_trace_rq_nr_running(struct rq *rq); |
|---|
| 2133 | + |
|---|
| 2134 | +const struct cpumask *sched_trace_rd_span(struct root_domain *rd); |
|---|
| 2135 | + |
|---|
| 2025 | 2136 | #endif |
|---|