Skip to content

Commit 803797d

Browse files
committed
Merge branch into tip/master: 'core/core'
# New commits in core/core: 908c121 ("Revert "timekeeping: Use time_after() in timekeeping_check_update()"") 42db2c2 ("timekeeping: Use time_after() in timekeeping_check_update()") ed4fb6d ("hrtimer: Use and report correct timerslack values for realtime tasks") aef6987 ("sched/eevdf: Propagate min_slice up the cgroup hierarchy") 857b158 ("sched/eevdf: Use sched_attr::sched_runtime to set request/slice suggestion") 85e511d ("sched/eevdf: Allow shorter slices to wakeup-preempt") 82e9d04 ("sched/fair: Avoid re-setting virtual deadline on 'migrations'") fc1892b ("sched/eevdf: Fixup PELT vs DELAYED_DEQUEUE") 54a58a7 ("sched/fair: Implement DELAY_ZERO") 152e11f ("sched/fair: Implement delayed dequeue") e1459a5 ("sched: Teach dequeue_task() about special task states") a1c4466 ("sched,freezer: Mark TASK_FROZEN special") 781773e ("sched/fair: Implement ENQUEUE_DELAYED") f12e148 ("sched/fair: Prepare pick_next_task() for delayed dequeue") 2e0199d ("sched/fair: Prepare exit/cleanup paths for delayed_dequeue") e28b5f8 ("sched/fair: Assert {set_next,put_prev}_entity() are properly balanced") dfa0a57 ("sched/uclamg: Handle delayed dequeue") abc158c ("sched: Prepare generic code for delayed dequeue") e890106 ("sched: Split DEQUEUE_SLEEP from deactivate_task()") fab4a80 ("sched/fair: Re-organize dequeue_task_fair()") 863ccdb ("sched: Allow sched_class::dequeue_task() to fail") 3b3dd89 ("sched/fair: Unify pick_{,next_}_task_fair()") c97f54f ("sched/fair: Cleanup pick_task_fair()'s curr") 8e2e13a ("sched/fair: Cleanup pick_task_fair() vs throttle") 949090e ("sched/eevdf: Remove min_vruntime_copy") f25b7b3 ("sched/eevdf: Add feature comments") 330dd6d ("hrtimer: Annotate hrtimer_cpu_base_.*_expiry() for sparse.") 38cd4ce ("timers: Add sparse annotation for timer_sync_wait_running().") ae04f69 ("sched/rt: Rename realtime_{prio, task}() to rt_or_dl_{prio, task}()") b166af3 ("sched/rt, dl: Convert functions to return bool") 130fd05 ("sched/rt: Clean up usage of rt_task()") 4ae0c2b ("sched/debug: Fix fair_server_period_max value") 924e290 ("sched/fair: Make balance_fair() test sched_fair_runnable() instead of rq->nr_running") 7f8af7b ("signal: Replace BUG_ON()s") a2b80ce ("signal: Remove task argument from dequeue_signal()") 566e2d8 ("posix-timers: Consolidate signal queueing") 24aea4c ("posix-cpu-timers: Make k_itimer::it_active consistent") 20f1338 ("posix-timers: Consolidate timer setup") 52dea0a ("posix-timers: Convert timer list to hlist") aca1dc0 ("posix-timers: Clear overrun in common_timer_set()") bfa408f ("posix-timers: Retrieve interval in common timer_settime() code") c20b99e ("posix-cpu-timers: Simplify posix_cpu_timer_set()") 286bfac ("posix-cpu-timers: Remove incorrect comment in posix_cpu_timer_set()") c444626 ("posix-cpu-timers: Use @now instead of @Val for clarity") bd29d77 ("posix-cpu-timers: Do not arm SIGEV_NONE timers") d471ff3 ("posix-cpu-timers: Replace old expiry retrieval in posix_cpu_timer_set()") 5f9d4a1 ("posix-cpu-timers: Handle SIGEV_NONE timers correctly in timer_set()") d786b8b ("posix-cpu-timers: Handle SIGEV_NONE timers correctly in timer_get()") 1c50284 ("posix-cpu-timers: Handle interval timers correctly in timer_get()") b3e866b ("posix-cpu-timers: Save interval only for armed timers") d859704 ("posix-cpu-timers: Split up posix_cpu_timer_get()") 73339b8 ("selftests/timers/posix-timers: Validate overrun after unblock") f924f86 ("selftests/timers/posix-timers: Validate timer_gettime()") 2c2b561 ("selftests/timers/posix-timers: Validate SIGEV_NONE") e65bb03 ("selftests/timers/posix_timers: Validate signal rules") 45c4225 ("selftests/timers/posix_timers: Add SIG_IGN test") 0af02a8 ("selftests/timers/posix_timers: Simplify error handling") cea5a34 ("sched/fair: Cleanup fair_server") 5f6bd38 ("sched/rt: Remove default bandwidth control") c8a8539 ("sched/core: Fix picking of tasks for core scheduling with DL server") 4b26cfd ("sched/core: Fix priority checking for DL server picks") d741f29 ("sched/fair: Fair server interface") a110a81 ("sched/deadline: Deferrable dl server") 557a6bf ("sched/fair: Add trivial fair server") a741b82 ("sched/core: Clear prev->dl_server in CFS pick fast path") c245910 ("sched/core: Add clearing of ->dl_server in put_prev_task_balance()") f23c042 ("sched/deadline: Comment sched_dl_entity::dl_server variable") faa42d2 ("sched/fair: Make SCHED_IDLE entity be preempted in strict hierarchy") a58501f ("sched: remove HZ_BW feature hedge") 2c2d962 ("sched/fair: Remove cfs_rq::nr_spread_over and cfs_rq::exec_clock") 0ec8d5a ("sched/core: Add WARN_ON_ONCE() to check overflow for migrate_disable()") c40dd90 ("sched: Initialize the vruntime of a new task when it is first enqueued") Signed-off-by: Ingo Molnar <[email protected]>
2 parents b6ec9af + 908c121 commit 803797d

40 files changed

Lines changed: 2047 additions & 762 deletions

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/proc/base.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2456,13 +2456,13 @@ static void *timers_start(struct seq_file *m, loff_t *pos)
24562456
if (!tp->sighand)
24572457
return ERR_PTR(-ESRCH);
24582458

2459-
return seq_list_start(&tp->task->signal->posix_timers, *pos);
2459+
return seq_hlist_start(&tp->task->signal->posix_timers, *pos);
24602460
}
24612461

24622462
static void *timers_next(struct seq_file *m, void *v, loff_t *pos)
24632463
{
24642464
struct timers_private *tp = m->private;
2465-
return seq_list_next(v, &tp->task->signal->posix_timers, pos);
2465+
return seq_hlist_next(v, &tp->task->signal->posix_timers, pos);
24662466
}
24672467

24682468
static void timers_stop(struct seq_file *m, void *v)
@@ -2491,7 +2491,7 @@ static int show_timer(struct seq_file *m, void *v)
24912491
[SIGEV_THREAD] = "thread",
24922492
};
24932493

2494-
timer = list_entry((struct list_head *)v, struct k_itimer, list);
2494+
timer = hlist_entry((struct hlist_node *)v, struct k_itimer, list);
24952495
notify = timer->it_sigev_notify;
24962496

24972497
seq_printf(m, "ID: %d\n", timer->it_id);
@@ -2569,10 +2569,11 @@ static ssize_t timerslack_ns_write(struct file *file, const char __user *buf,
25692569
}
25702570

25712571
task_lock(p);
2572-
if (slack_ns == 0)
2573-
p->timer_slack_ns = p->default_timer_slack_ns;
2574-
else
2575-
p->timer_slack_ns = slack_ns;
2572+
if (rt_or_dl_task_policy(p))
2573+
slack_ns = 0;
2574+
else if (slack_ns == 0)
2575+
slack_ns = p->default_timer_slack_ns;
2576+
p->timer_slack_ns = slack_ns;
25762577
task_unlock(p);
25772578

25782579
out:

fs/select.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,19 +77,16 @@ u64 select_estimate_accuracy(struct timespec64 *tv)
7777
{
7878
u64 ret;
7979
struct timespec64 now;
80+
u64 slack = current->timer_slack_ns;
8081

81-
/*
82-
* Realtime tasks get a slack of 0 for obvious reasons.
83-
*/
84-
85-
if (rt_task(current))
82+
if (slack == 0)
8683
return 0;
8784

8885
ktime_get_ts64(&now);
8986
now = timespec64_sub(*tv, now);
9087
ret = __estimate_accuracy(&now);
91-
if (ret < current->timer_slack_ns)
92-
return current->timer_slack_ns;
88+
if (ret < slack)
89+
return slack;
9390
return ret;
9491
}
9592

fs/signalfd.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ static ssize_t signalfd_dequeue(struct signalfd_ctx *ctx, kernel_siginfo_t *info
159159
DECLARE_WAITQUEUE(wait, current);
160160

161161
spin_lock_irq(&current->sighand->siglock);
162-
ret = dequeue_signal(current, &ctx->sigmask, info, &type);
162+
ret = dequeue_signal(&ctx->sigmask, info, &type);
163163
switch (ret) {
164164
case 0:
165165
if (!nonblock)
@@ -174,7 +174,7 @@ static ssize_t signalfd_dequeue(struct signalfd_ctx *ctx, kernel_siginfo_t *info
174174
add_wait_queue(&current->sighand->signalfd_wqh, &wait);
175175
for (;;) {
176176
set_current_state(TASK_INTERRUPTIBLE);
177-
ret = dequeue_signal(current, &ctx->sigmask, info, &type);
177+
ret = dequeue_signal(&ctx->sigmask, info, &type);
178178
if (ret != 0)
179179
break;
180180
if (signal_pending(current)) {

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/posix-timers.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ static inline void posix_cputimers_init_work(void) { }
158158
* @rcu: RCU head for freeing the timer.
159159
*/
160160
struct k_itimer {
161-
struct list_head list;
161+
struct hlist_node list;
162162
struct hlist_node t_hash;
163163
spinlock_t it_lock;
164164
const struct k_clock *kclock;

include/linux/sched.h

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,9 @@ struct user_event_mm;
149149
* Special states are those that do not use the normal wait-loop pattern. See
150150
* the comment with set_special_state().
151151
*/
152-
#define is_special_task_state(state) \
153-
((state) & (__TASK_STOPPED | __TASK_TRACED | TASK_PARKED | TASK_DEAD))
152+
#define is_special_task_state(state) \
153+
((state) & (__TASK_STOPPED | __TASK_TRACED | TASK_PARKED | \
154+
TASK_DEAD | TASK_FROZEN))
154155

155156
#ifdef CONFIG_DEBUG_ATOMIC_SLEEP
156157
# define debug_normal_state_change(state_value) \
@@ -541,9 +542,14 @@ struct sched_entity {
541542
struct rb_node run_node;
542543
u64 deadline;
543544
u64 min_vruntime;
545+
u64 min_slice;
544546

545547
struct list_head group_node;
546-
unsigned int on_rq;
548+
unsigned char on_rq;
549+
unsigned char sched_delayed;
550+
unsigned char rel_deadline;
551+
unsigned char custom_slice;
552+
/* hole */
547553

548554
u64 exec_start;
549555
u64 sum_exec_runtime;
@@ -639,12 +645,26 @@ struct sched_dl_entity {
639645
*
640646
* @dl_overrun tells if the task asked to be informed about runtime
641647
* overruns.
648+
*
649+
* @dl_server tells if this is a server entity.
650+
*
651+
* @dl_defer tells if this is a deferred or regular server. For
652+
* now only defer server exists.
653+
*
654+
* @dl_defer_armed tells if the deferrable server is waiting
655+
* for the replenishment timer to activate it.
656+
*
657+
* @dl_defer_running tells if the deferrable server is actually
658+
* running, skipping the defer phase.
642659
*/
643660
unsigned int dl_throttled : 1;
644661
unsigned int dl_yielded : 1;
645662
unsigned int dl_non_contending : 1;
646663
unsigned int dl_overrun : 1;
647664
unsigned int dl_server : 1;
665+
unsigned int dl_defer : 1;
666+
unsigned int dl_defer_armed : 1;
667+
unsigned int dl_defer_running : 1;
648668

649669
/*
650670
* Bandwidth enforcement timer. Each -deadline task has its
@@ -672,7 +692,8 @@ struct sched_dl_entity {
672692
*/
673693
struct rq *rq;
674694
dl_server_has_tasks_f server_has_tasks;
675-
dl_server_pick_f server_pick;
695+
dl_server_pick_f server_pick_next;
696+
dl_server_pick_f server_pick_task;
676697

677698
#ifdef CONFIG_RT_MUTEXES
678699
/*

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

0 commit comments

Comments
 (0)