Skip to content

Commit 5ac9985

Browse files
committed
Merge branch 'tip/sched/core' into for-6.12
To receive 863ccdb ("sched: Allow sched_class::dequeue_task() to fail") which makes sched_class.dequeue_task() return bool instead of void. This leads to compile breakage and will be fixed by a follow-up patch. Signed-off-by: Tejun Heo <[email protected]>
2 parents 8990929 + aef6987 commit 5ac9985

File tree

25 files changed

+577
-194
lines changed

25 files changed

+577
-194
lines changed

fs/bcachefs/six.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ static inline bool six_owner_running(struct six_lock *lock)
335335
*/
336336
rcu_read_lock();
337337
struct task_struct *owner = READ_ONCE(lock->owner);
338-
bool ret = owner ? owner_on_cpu(owner) : !rt_task(current);
338+
bool ret = owner ? owner_on_cpu(owner) : !rt_or_dl_task(current);
339339
rcu_read_unlock();
340340

341341
return ret;

fs/select.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ u64 select_estimate_accuracy(struct timespec64 *tv)
8282
* Realtime tasks get a slack of 0 for obvious reasons.
8383
*/
8484

85-
if (rt_task(current))
85+
if (rt_or_dl_task(current))
8686
return 0;
8787

8888
ktime_get_ts64(&now);

include/linux/ioprio.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ static inline int task_nice_ioclass(struct task_struct *task)
4040
{
4141
if (task->policy == SCHED_IDLE)
4242
return IOPRIO_CLASS_IDLE;
43-
else if (task_is_realtime(task))
43+
else if (rt_or_dl_task_policy(task))
4444
return IOPRIO_CLASS_RT;
4545
else
4646
return IOPRIO_CLASS_BE;

include/linux/sched.h

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,9 @@ struct user_event_mm;
151151
* Special states are those that do not use the normal wait-loop pattern. See
152152
* the comment with set_special_state().
153153
*/
154-
#define is_special_task_state(state) \
155-
((state) & (__TASK_STOPPED | __TASK_TRACED | TASK_PARKED | TASK_DEAD))
154+
#define is_special_task_state(state) \
155+
((state) & (__TASK_STOPPED | __TASK_TRACED | TASK_PARKED | \
156+
TASK_DEAD | TASK_FROZEN))
156157

157158
#ifdef CONFIG_DEBUG_ATOMIC_SLEEP
158159
# define debug_normal_state_change(state_value) \
@@ -543,9 +544,14 @@ struct sched_entity {
543544
struct rb_node run_node;
544545
u64 deadline;
545546
u64 min_vruntime;
547+
u64 min_slice;
546548

547549
struct list_head group_node;
548-
unsigned int on_rq;
550+
unsigned char on_rq;
551+
unsigned char sched_delayed;
552+
unsigned char rel_deadline;
553+
unsigned char custom_slice;
554+
/* hole */
549555

550556
u64 exec_start;
551557
u64 sum_exec_runtime;

include/linux/sched/deadline.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@
1010

1111
#include <linux/sched.h>
1212

13-
#define MAX_DL_PRIO 0
14-
15-
static inline int dl_prio(int prio)
13+
static inline bool dl_prio(int prio)
1614
{
17-
if (unlikely(prio < MAX_DL_PRIO))
18-
return 1;
19-
return 0;
15+
return unlikely(prio < MAX_DL_PRIO);
2016
}
2117

22-
static inline int dl_task(struct task_struct *p)
18+
/*
19+
* Returns true if a task has a priority that belongs to DL class. PI-boosted
20+
* tasks will return true. Use dl_policy() to ignore PI-boosted tasks.
21+
*/
22+
static inline bool dl_task(struct task_struct *p)
2323
{
2424
return dl_prio(p->prio);
2525
}

include/linux/sched/prio.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
*/
1515

1616
#define MAX_RT_PRIO 100
17+
#define MAX_DL_PRIO 0
1718

1819
#define MAX_PRIO (MAX_RT_PRIO + NICE_WIDTH)
1920
#define DEFAULT_PRIO (MAX_RT_PRIO + NICE_WIDTH / 2)

include/linux/sched/rt.h

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,40 @@
66

77
struct task_struct;
88

9-
static inline int rt_prio(int prio)
9+
static inline bool rt_prio(int prio)
1010
{
11-
if (unlikely(prio < MAX_RT_PRIO))
12-
return 1;
13-
return 0;
11+
return unlikely(prio < MAX_RT_PRIO && prio >= MAX_DL_PRIO);
1412
}
1513

16-
static inline int rt_task(struct task_struct *p)
14+
static inline bool rt_or_dl_prio(int prio)
15+
{
16+
return unlikely(prio < MAX_RT_PRIO);
17+
}
18+
19+
/*
20+
* Returns true if a task has a priority that belongs to RT class. PI-boosted
21+
* tasks will return true. Use rt_policy() to ignore PI-boosted tasks.
22+
*/
23+
static inline bool rt_task(struct task_struct *p)
1724
{
1825
return rt_prio(p->prio);
1926
}
2027

21-
static inline bool task_is_realtime(struct task_struct *tsk)
28+
/*
29+
* Returns true if a task has a priority that belongs to RT or DL classes.
30+
* PI-boosted tasks will return true. Use rt_or_dl_task_policy() to ignore
31+
* PI-boosted tasks.
32+
*/
33+
static inline bool rt_or_dl_task(struct task_struct *p)
34+
{
35+
return rt_or_dl_prio(p->prio);
36+
}
37+
38+
/*
39+
* Returns true if a task has a policy that belongs to RT or DL classes.
40+
* PI-boosted tasks will return false.
41+
*/
42+
static inline bool rt_or_dl_task_policy(struct task_struct *tsk)
2243
{
2344
int policy = tsk->policy;
2445

kernel/freezer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ bool __refrigerator(bool check_kthr_stop)
7272
bool freeze;
7373

7474
raw_spin_lock_irq(&current->pi_lock);
75-
set_current_state(TASK_FROZEN);
75+
WRITE_ONCE(current->__state, TASK_FROZEN);
7676
/* unstale saved_state so that __thaw_task() will wake us up */
7777
current->saved_state = TASK_RUNNING;
7878
raw_spin_unlock_irq(&current->pi_lock);

kernel/locking/rtmutex.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ static __always_inline int __waiter_prio(struct task_struct *task)
347347
{
348348
int prio = task->prio;
349349

350-
if (!rt_prio(prio))
350+
if (!rt_or_dl_prio(prio))
351351
return DEFAULT_PRIO;
352352

353353
return prio;
@@ -435,7 +435,7 @@ static inline bool rt_mutex_steal(struct rt_mutex_waiter *waiter,
435435
* Note that RT tasks are excluded from same priority (lateral)
436436
* steals to prevent the introduction of an unbounded latency.
437437
*/
438-
if (rt_prio(waiter->tree.prio) || dl_prio(waiter->tree.prio))
438+
if (rt_or_dl_prio(waiter->tree.prio))
439439
return false;
440440

441441
return rt_waiter_node_equal(&waiter->tree, &top_waiter->tree);

kernel/locking/rwsem.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ static inline bool rwsem_try_write_lock(struct rw_semaphore *sem,
631631
* if it is an RT task or wait in the wait queue
632632
* for too long.
633633
*/
634-
if (has_handoff || (!rt_task(waiter->task) &&
634+
if (has_handoff || (!rt_or_dl_task(waiter->task) &&
635635
!time_after(jiffies, waiter->timeout)))
636636
return false;
637637

@@ -914,7 +914,7 @@ static bool rwsem_optimistic_spin(struct rw_semaphore *sem)
914914
if (owner_state != OWNER_WRITER) {
915915
if (need_resched())
916916
break;
917-
if (rt_task(current) &&
917+
if (rt_or_dl_task(current) &&
918918
(prev_owner_state != OWNER_WRITER))
919919
break;
920920
}

0 commit comments

Comments
 (0)