hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
kernel/kernel/sched/rt.c
....@@ -272,7 +272,7 @@
272272 static inline bool need_pull_rt_task(struct rq *rq, struct task_struct *prev)
273273 {
274274 /* Try to pull RT tasks here if we lower this rq's prio */
275
- return rq->online && rq->rt.highest_prio.curr > prev->prio;
275
+ return rq->rt.highest_prio.curr > prev->prio;
276276 }
277277
278278 static inline int rt_overloaded(struct rq *rq)
....@@ -1761,7 +1761,7 @@
17611761 static int pick_rt_task(struct rq *rq, struct task_struct *p, int cpu)
17621762 {
17631763 if (!task_running(rq, p) &&
1764
- cpumask_test_cpu(cpu, &p->cpus_mask))
1764
+ cpumask_test_cpu(cpu, p->cpus_ptr))
17651765 return 1;
17661766
17671767 return 0;
....@@ -1864,8 +1864,8 @@
18641864 return this_cpu;
18651865 }
18661866
1867
- best_cpu = cpumask_any_and_distribute(lowest_mask,
1868
- sched_domain_span(sd));
1867
+ best_cpu = cpumask_first_and(lowest_mask,
1868
+ sched_domain_span(sd));
18691869 if (best_cpu < nr_cpu_ids) {
18701870 rcu_read_unlock();
18711871 return best_cpu;
....@@ -1882,7 +1882,7 @@
18821882 if (this_cpu != -1)
18831883 return this_cpu;
18841884
1885
- cpu = cpumask_any_distribute(lowest_mask);
1885
+ cpu = cpumask_any(lowest_mask);
18861886 if (cpu < nr_cpu_ids)
18871887 return cpu;
18881888
....@@ -1923,7 +1923,7 @@
19231923 * Also make sure that it wasn't scheduled on its rq.
19241924 */
19251925 if (unlikely(task_rq(task) != rq ||
1926
- !cpumask_test_cpu(lowest_rq->cpu, &task->cpus_mask) ||
1926
+ !cpumask_test_cpu(lowest_rq->cpu, task->cpus_ptr) ||
19271927 task_running(rq, task) ||
19281928 !rt_task(task) ||
19291929 !task_on_rq_queued(task))) {
....@@ -1971,7 +1971,7 @@
19711971 * running task can migrate over to a CPU that is running a task
19721972 * of lesser priority.
19731973 */
1974
-static int push_rt_task(struct rq *rq, bool pull)
1974
+static int push_rt_task(struct rq *rq)
19751975 {
19761976 struct task_struct *next_task;
19771977 struct rq *lowest_rq;
....@@ -1985,39 +1985,6 @@
19851985 return 0;
19861986
19871987 retry:
1988
- if (is_migration_disabled(next_task)) {
1989
- struct task_struct *push_task = NULL;
1990
- int cpu;
1991
-
1992
- if (!pull)
1993
- return 0;
1994
-
1995
- trace_sched_migrate_pull_tp(next_task);
1996
-
1997
- if (rq->push_busy)
1998
- return 0;
1999
-
2000
- cpu = find_lowest_rq(rq->curr);
2001
- if (cpu == -1 || cpu == rq->cpu)
2002
- return 0;
2003
-
2004
- /*
2005
- * Given we found a CPU with lower priority than @next_task,
2006
- * therefore it should be running. However we cannot migrate it
2007
- * to this other CPU, instead attempt to push the current
2008
- * running task on this CPU away.
2009
- */
2010
- push_task = get_push_task(rq);
2011
- if (push_task) {
2012
- raw_spin_unlock(&rq->lock);
2013
- stop_one_cpu_nowait(rq->cpu, push_cpu_stop,
2014
- push_task, &rq->push_work);
2015
- raw_spin_lock(&rq->lock);
2016
- }
2017
-
2018
- return 0;
2019
- }
2020
-
20211988 if (WARN_ON(next_task == rq->curr))
20221989 return 0;
20231990
....@@ -2072,10 +2039,12 @@
20722039 deactivate_task(rq, next_task, 0);
20732040 set_task_cpu(next_task, lowest_rq->cpu);
20742041 activate_task(lowest_rq, next_task, 0);
2075
- resched_curr(lowest_rq);
20762042 ret = 1;
20772043
2044
+ resched_curr(lowest_rq);
2045
+
20782046 double_unlock_balance(rq, lowest_rq);
2047
+
20792048 out:
20802049 put_task_struct(next_task);
20812050
....@@ -2085,7 +2054,7 @@
20852054 static void push_rt_tasks(struct rq *rq)
20862055 {
20872056 /* push_rt_task will return true if it moved an RT */
2088
- while (push_rt_task(rq, false))
2057
+ while (push_rt_task(rq))
20892058 ;
20902059 }
20912060
....@@ -2238,8 +2207,7 @@
22382207 */
22392208 if (has_pushable_tasks(rq)) {
22402209 raw_spin_lock(&rq->lock);
2241
- while (push_rt_task(rq, true))
2242
- ;
2210
+ push_rt_tasks(rq);
22432211 raw_spin_unlock(&rq->lock);
22442212 }
22452213
....@@ -2264,7 +2232,7 @@
22642232 {
22652233 int this_cpu = this_rq->cpu, cpu;
22662234 bool resched = false;
2267
- struct task_struct *p, *push_task;
2235
+ struct task_struct *p;
22682236 struct rq *src_rq;
22692237 int rt_overload_count = rt_overloaded(this_rq);
22702238
....@@ -2311,7 +2279,6 @@
23112279 * double_lock_balance, and another CPU could
23122280 * alter this_rq
23132281 */
2314
- push_task = NULL;
23152282 double_lock_balance(this_rq, src_rq);
23162283
23172284 /*
....@@ -2339,15 +2306,11 @@
23392306 if (p->prio < src_rq->curr->prio)
23402307 goto skip;
23412308
2342
- if (is_migration_disabled(p)) {
2343
- trace_sched_migrate_pull_tp(p);
2344
- push_task = get_push_task(src_rq);
2345
- } else {
2346
- deactivate_task(src_rq, p, 0);
2347
- set_task_cpu(p, this_cpu);
2348
- activate_task(this_rq, p, 0);
2349
- resched = true;
2350
- }
2309
+ resched = true;
2310
+
2311
+ deactivate_task(src_rq, p, 0);
2312
+ set_task_cpu(p, this_cpu);
2313
+ activate_task(this_rq, p, 0);
23512314 /*
23522315 * We continue with the search, just in
23532316 * case there's an even higher prio task
....@@ -2357,13 +2320,6 @@
23572320 }
23582321 skip:
23592322 double_unlock_balance(this_rq, src_rq);
2360
-
2361
- if (push_task) {
2362
- raw_spin_unlock(&this_rq->lock);
2363
- stop_one_cpu_nowait(src_rq->cpu, push_cpu_stop,
2364
- push_task, &src_rq->push_work);
2365
- raw_spin_lock(&this_rq->lock);
2366
- }
23672323 }
23682324
23692325 if (resched)
....@@ -2612,7 +2568,6 @@
26122568 .rq_offline = rq_offline_rt,
26132569 .task_woken = task_woken_rt,
26142570 .switched_from = switched_from_rt,
2615
- .find_lock_rq = find_lock_lowest_rq,
26162571 #endif
26172572
26182573 .task_tick = task_tick_rt,