Commit cac03ac3 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'sched-urgent-2022-08-06' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull scheduler fixes from Ingo Molnar:
 "Various fixes: a deadline scheduler fix, a migration fix, a Sparse fix
  and a comment fix"

* tag 'sched-urgent-2022-08-06' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  sched/core: Do not requeue task on CPU excluded from cpus_mask
  sched/rt: Fix Sparse warnings due to undefined rt.c declarations
  exit: Fix typo in comment: s/sub-theads/sub-threads
  sched, cpuset: Fix dl_cpu_busy() panic due to empty cs->cpus_allowed
parents 592d8362 751d4cbc
...@@ -1825,7 +1825,7 @@ current_restore_flags(unsigned long orig_flags, unsigned long flags) ...@@ -1825,7 +1825,7 @@ current_restore_flags(unsigned long orig_flags, unsigned long flags)
} }
extern int cpuset_cpumask_can_shrink(const struct cpumask *cur, const struct cpumask *trial); extern int cpuset_cpumask_can_shrink(const struct cpumask *cur, const struct cpumask *trial);
extern int task_can_attach(struct task_struct *p, const struct cpumask *cs_cpus_allowed); extern int task_can_attach(struct task_struct *p, const struct cpumask *cs_effective_cpus);
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
extern void do_set_cpus_allowed(struct task_struct *p, const struct cpumask *new_mask); extern void do_set_cpus_allowed(struct task_struct *p, const struct cpumask *new_mask);
extern int set_cpus_allowed_ptr(struct task_struct *p, const struct cpumask *new_mask); extern int set_cpus_allowed_ptr(struct task_struct *p, const struct cpumask *new_mask);
......
...@@ -2239,7 +2239,7 @@ static int cpuset_can_attach(struct cgroup_taskset *tset) ...@@ -2239,7 +2239,7 @@ static int cpuset_can_attach(struct cgroup_taskset *tset)
goto out_unlock; goto out_unlock;
cgroup_taskset_for_each(task, css, tset) { cgroup_taskset_for_each(task, css, tset) {
ret = task_can_attach(task, cs->cpus_allowed); ret = task_can_attach(task, cs->effective_cpus);
if (ret) if (ret)
goto out_unlock; goto out_unlock;
ret = security_task_setscheduler(task); ret = security_task_setscheduler(task);
......
...@@ -1051,7 +1051,7 @@ static int wait_task_zombie(struct wait_opts *wo, struct task_struct *p) ...@@ -1051,7 +1051,7 @@ static int wait_task_zombie(struct wait_opts *wo, struct task_struct *p)
* p->signal fields because the whole thread group is dead * p->signal fields because the whole thread group is dead
* and nobody can change them. * and nobody can change them.
* *
* psig->stats_lock also protects us from our sub-theads * psig->stats_lock also protects us from our sub-threads
* which can reap other children at the same time. Until * which can reap other children at the same time. Until
* we change k_getrusage()-like users to rely on this lock * we change k_getrusage()-like users to rely on this lock
* we have to take ->siglock as well. * we have to take ->siglock as well.
......
...@@ -3802,7 +3802,7 @@ bool cpus_share_cache(int this_cpu, int that_cpu) ...@@ -3802,7 +3802,7 @@ bool cpus_share_cache(int this_cpu, int that_cpu)
return per_cpu(sd_llc_id, this_cpu) == per_cpu(sd_llc_id, that_cpu); return per_cpu(sd_llc_id, this_cpu) == per_cpu(sd_llc_id, that_cpu);
} }
static inline bool ttwu_queue_cond(int cpu) static inline bool ttwu_queue_cond(struct task_struct *p, int cpu)
{ {
/* /*
* Do not complicate things with the async wake_list while the CPU is * Do not complicate things with the async wake_list while the CPU is
...@@ -3811,6 +3811,10 @@ static inline bool ttwu_queue_cond(int cpu) ...@@ -3811,6 +3811,10 @@ static inline bool ttwu_queue_cond(int cpu)
if (!cpu_active(cpu)) if (!cpu_active(cpu))
return false; return false;
/* Ensure the task will still be allowed to run on the CPU. */
if (!cpumask_test_cpu(cpu, p->cpus_ptr))
return false;
/* /*
* If the CPU does not share cache, then queue the task on the * If the CPU does not share cache, then queue the task on the
* remote rqs wakelist to avoid accessing remote data. * remote rqs wakelist to avoid accessing remote data.
...@@ -3840,7 +3844,7 @@ static inline bool ttwu_queue_cond(int cpu) ...@@ -3840,7 +3844,7 @@ static inline bool ttwu_queue_cond(int cpu)
static bool ttwu_queue_wakelist(struct task_struct *p, int cpu, int wake_flags) static bool ttwu_queue_wakelist(struct task_struct *p, int cpu, int wake_flags)
{ {
if (sched_feat(TTWU_QUEUE) && ttwu_queue_cond(cpu)) { if (sched_feat(TTWU_QUEUE) && ttwu_queue_cond(p, cpu)) {
sched_clock_cpu(cpu); /* Sync clocks across CPUs */ sched_clock_cpu(cpu); /* Sync clocks across CPUs */
__ttwu_queue_wakelist(p, cpu, wake_flags); __ttwu_queue_wakelist(p, cpu, wake_flags);
return true; return true;
...@@ -9012,7 +9016,7 @@ int cpuset_cpumask_can_shrink(const struct cpumask *cur, ...@@ -9012,7 +9016,7 @@ int cpuset_cpumask_can_shrink(const struct cpumask *cur,
} }
int task_can_attach(struct task_struct *p, int task_can_attach(struct task_struct *p,
const struct cpumask *cs_cpus_allowed) const struct cpumask *cs_effective_cpus)
{ {
int ret = 0; int ret = 0;
...@@ -9031,9 +9035,11 @@ int task_can_attach(struct task_struct *p, ...@@ -9031,9 +9035,11 @@ int task_can_attach(struct task_struct *p,
} }
if (dl_task(p) && !cpumask_intersects(task_rq(p)->rd->span, if (dl_task(p) && !cpumask_intersects(task_rq(p)->rd->span,
cs_cpus_allowed)) { cs_effective_cpus)) {
int cpu = cpumask_any_and(cpu_active_mask, cs_cpus_allowed); int cpu = cpumask_any_and(cpu_active_mask, cs_effective_cpus);
if (unlikely(cpu >= nr_cpu_ids))
return -EINVAL;
ret = dl_cpu_busy(cpu, p); ret = dl_cpu_busy(cpu, p);
} }
......
...@@ -481,9 +481,6 @@ extern void __refill_cfs_bandwidth_runtime(struct cfs_bandwidth *cfs_b); ...@@ -481,9 +481,6 @@ extern void __refill_cfs_bandwidth_runtime(struct cfs_bandwidth *cfs_b);
extern void start_cfs_bandwidth(struct cfs_bandwidth *cfs_b); extern void start_cfs_bandwidth(struct cfs_bandwidth *cfs_b);
extern void unthrottle_cfs_rq(struct cfs_rq *cfs_rq); extern void unthrottle_cfs_rq(struct cfs_rq *cfs_rq);
extern void unregister_rt_sched_group(struct task_group *tg);
extern void free_rt_sched_group(struct task_group *tg);
extern int alloc_rt_sched_group(struct task_group *tg, struct task_group *parent);
extern void init_tg_rt_entry(struct task_group *tg, struct rt_rq *rt_rq, extern void init_tg_rt_entry(struct task_group *tg, struct rt_rq *rt_rq,
struct sched_rt_entity *rt_se, int cpu, struct sched_rt_entity *rt_se, int cpu,
struct sched_rt_entity *parent); struct sched_rt_entity *parent);
...@@ -521,6 +518,10 @@ struct cfs_bandwidth { }; ...@@ -521,6 +518,10 @@ struct cfs_bandwidth { };
#endif /* CONFIG_CGROUP_SCHED */ #endif /* CONFIG_CGROUP_SCHED */
extern void unregister_rt_sched_group(struct task_group *tg);
extern void free_rt_sched_group(struct task_group *tg);
extern int alloc_rt_sched_group(struct task_group *tg, struct task_group *parent);
/* /*
* u64_u32_load/u64_u32_store * u64_u32_load/u64_u32_store
* *
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment