sched/rt: Rename realtime_{prio, task}() to rt_or_dl_{prio, task}()
authorQais Yousef <qyousef@layalina.io>
Mon, 10 Jun 2024 19:20:18 +0000 (20:20 +0100)
committerPeter Zijlstra <peterz@infradead.org>
Wed, 7 Aug 2024 16:32:38 +0000 (18:32 +0200)
Some find the name realtime overloaded. Use rt_or_dl() as an
alternative, hopefully better, name.

Suggested-by: Daniel Bristot de Oliveira <bristot@redhat.com>
Signed-off-by: Qais Yousef <qyousef@layalina.io>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/r/20240610192018.1567075-4-qyousef@layalina.io
13 files changed:
fs/bcachefs/six.c
fs/select.c
include/linux/ioprio.h
include/linux/sched/rt.h
kernel/locking/rtmutex.c
kernel/locking/rwsem.c
kernel/locking/ww_mutex.h
kernel/sched/core.c
kernel/sched/syscalls.c
kernel/time/hrtimer.c
kernel/trace/trace_sched_wakeup.c
mm/page-writeback.c
mm/page_alloc.c

index b30870bf7e4a050d53a50070afa03b08c8d9af40..9cbd3c14c94f309319899576277b560cc06c05e9 100644 (file)
@@ -335,7 +335,7 @@ static inline bool six_owner_running(struct six_lock *lock)
         */
        rcu_read_lock();
        struct task_struct *owner = READ_ONCE(lock->owner);
-       bool ret = owner ? owner_on_cpu(owner) : !realtime_task(current);
+       bool ret = owner ? owner_on_cpu(owner) : !rt_or_dl_task(current);
        rcu_read_unlock();
 
        return ret;
index 8d5c1419416c9b78f8a875c42a2d94472e445921..73fce145eb725b230a5211472372c1f29f9a8263 100644 (file)
@@ -82,7 +82,7 @@ u64 select_estimate_accuracy(struct timespec64 *tv)
         * Realtime tasks get a slack of 0 for obvious reasons.
         */
 
-       if (realtime_task(current))
+       if (rt_or_dl_task(current))
                return 0;
 
        ktime_get_ts64(&now);
index 75859b78d540eb9ed184ad3e4705b080012cd329..b25377b6ea98dd6a0446ac71a71ae969d526d540 100644 (file)
@@ -40,7 +40,7 @@ static inline int task_nice_ioclass(struct task_struct *task)
 {
        if (task->policy == SCHED_IDLE)
                return IOPRIO_CLASS_IDLE;
-       else if (realtime_task_policy(task))
+       else if (rt_or_dl_task_policy(task))
                return IOPRIO_CLASS_RT;
        else
                return IOPRIO_CLASS_BE;
index 91ef1ef2019f5723202ef035dfcfd751642f53e1..4e3338103654c5f84ef639380c6970279802b241 100644 (file)
@@ -11,7 +11,7 @@ static inline bool rt_prio(int prio)
        return unlikely(prio < MAX_RT_PRIO && prio >= MAX_DL_PRIO);
 }
 
-static inline bool realtime_prio(int prio)
+static inline bool rt_or_dl_prio(int prio)
 {
        return unlikely(prio < MAX_RT_PRIO);
 }
@@ -27,19 +27,19 @@ static inline bool rt_task(struct task_struct *p)
 
 /*
  * Returns true if a task has a priority that belongs to RT or DL classes.
- * PI-boosted tasks will return true. Use realtime_task_policy() to ignore
+ * PI-boosted tasks will return true. Use rt_or_dl_task_policy() to ignore
  * PI-boosted tasks.
  */
-static inline bool realtime_task(struct task_struct *p)
+static inline bool rt_or_dl_task(struct task_struct *p)
 {
-       return realtime_prio(p->prio);
+       return rt_or_dl_prio(p->prio);
 }
 
 /*
  * Returns true if a task has a policy that belongs to RT or DL classes.
  * PI-boosted tasks will return false.
  */
-static inline bool realtime_task_policy(struct task_struct *tsk)
+static inline bool rt_or_dl_task_policy(struct task_struct *tsk)
 {
        int policy = tsk->policy;
 
index 55c9dab37f337edfcd578eb9f7d0d4d041707538..c2a530d704b420be77e7f8d78f9154f8c9ced52c 100644 (file)
@@ -347,7 +347,7 @@ static __always_inline int __waiter_prio(struct task_struct *task)
 {
        int prio = task->prio;
 
-       if (!realtime_prio(prio))
+       if (!rt_or_dl_prio(prio))
                return DEFAULT_PRIO;
 
        return prio;
@@ -435,7 +435,7 @@ static inline bool rt_mutex_steal(struct rt_mutex_waiter *waiter,
         * Note that RT tasks are excluded from same priority (lateral)
         * steals to prevent the introduction of an unbounded latency.
         */
-       if (realtime_prio(waiter->tree.prio))
+       if (rt_or_dl_prio(waiter->tree.prio))
                return false;
 
        return rt_waiter_node_equal(&waiter->tree, &top_waiter->tree);
index 516174a64fa5b98794ac02634a1a199f4e40b27a..5ded7dff46efadcbebc34ea52fe308a40da5af3e 100644 (file)
@@ -631,7 +631,7 @@ static inline bool rwsem_try_write_lock(struct rw_semaphore *sem,
                         * if it is an RT task or wait in the wait queue
                         * for too long.
                         */
-                       if (has_handoff || (!realtime_task(waiter->task) &&
+                       if (has_handoff || (!rt_or_dl_task(waiter->task) &&
                                            !time_after(jiffies, waiter->timeout)))
                                return false;
 
@@ -914,7 +914,7 @@ static bool rwsem_optimistic_spin(struct rw_semaphore *sem)
                if (owner_state != OWNER_WRITER) {
                        if (need_resched())
                                break;
-                       if (realtime_task(current) &&
+                       if (rt_or_dl_task(current) &&
                           (prev_owner_state != OWNER_WRITER))
                                break;
                }
index fa4b416a1f621ed95d85a5ff140fc9d1c1ae22c3..76d204b7d29c9b7c2c79a5810126581d5cf85399 100644 (file)
@@ -237,7 +237,7 @@ __ww_ctx_less(struct ww_acquire_ctx *a, struct ww_acquire_ctx *b)
        int a_prio = a->task->prio;
        int b_prio = b->task->prio;
 
-       if (realtime_prio(a_prio) || realtime_prio(b_prio)) {
+       if (rt_or_dl_prio(a_prio) || rt_or_dl_prio(b_prio)) {
 
                if (a_prio > b_prio)
                        return true;
index 673cbeb7ad488751eb046475dc581b48e0b2b149..ab50100363ca81660e0ee81bbad80189aa7df8ee 100644 (file)
@@ -166,7 +166,7 @@ static inline int __task_prio(const struct task_struct *p)
        if (p->dl_server)
                return -1; /* deadline */
 
-       if (realtime_prio(p->prio)) /* includes deadline */
+       if (rt_or_dl_prio(p->prio))
                return p->prio; /* [-1, 99] */
 
        if (p->sched_class == &idle_sched_class)
@@ -8590,7 +8590,7 @@ void normalize_rt_tasks(void)
                schedstat_set(p->stats.sleep_start, 0);
                schedstat_set(p->stats.block_start, 0);
 
-               if (!realtime_task(p)) {
+               if (!rt_or_dl_task(p)) {
                        /*
                         * Renice negative nice level userspace
                         * tasks back to 0:
index 6d60326d73e4a442c2c6792b6441a407b2d927b5..60e70c889d91e849a46323bb3cda38aac75c7733 100644 (file)
@@ -57,7 +57,7 @@ static int effective_prio(struct task_struct *p)
         * keep the priority unchanged. Otherwise, update priority
         * to the normal priority:
         */
-       if (!realtime_prio(p->prio))
+       if (!rt_or_dl_prio(p->prio))
                return p->normal_prio;
        return p->prio;
 }
index a1d1d8d886a89b3b6892e25b71ae9793dab2514d..f4be3abbb47b3644713370277d96ddb0b9d0628c 100644 (file)
@@ -1975,7 +1975,7 @@ static void __hrtimer_init_sleeper(struct hrtimer_sleeper *sl,
         * expiry.
         */
        if (IS_ENABLED(CONFIG_PREEMPT_RT)) {
-               if (realtime_task_policy(current) && !(mode & HRTIMER_MODE_SOFT))
+               if (rt_or_dl_task_policy(current) && !(mode & HRTIMER_MODE_SOFT))
                        mode |= HRTIMER_MODE_HARD;
        }
 
@@ -2075,7 +2075,7 @@ long hrtimer_nanosleep(ktime_t rqtp, const enum hrtimer_mode mode,
        u64 slack;
 
        slack = current->timer_slack_ns;
-       if (realtime_task(current))
+       if (rt_or_dl_task(current))
                slack = 0;
 
        hrtimer_init_sleeper_on_stack(&t, clockid, mode);
@@ -2280,7 +2280,7 @@ schedule_hrtimeout_range_clock(ktime_t *expires, u64 delta,
         * Override any slack passed by the user if under
         * rt contraints.
         */
-       if (realtime_task(current))
+       if (rt_or_dl_task(current))
                delta = 0;
 
        hrtimer_init_sleeper_on_stack(&t, clock_id, mode);
index 1824e17c93c7792f2b1989adbee98a8895d0b844..ae2ace5e515af5e2d372b395d7f98f1431d1a485 100644 (file)
@@ -547,7 +547,7 @@ probe_wakeup(void *ignore, struct task_struct *p)
         *  - wakeup_dl handles tasks belonging to sched_dl class only.
         */
        if (tracing_dl || (wakeup_dl && !dl_task(p)) ||
-           (wakeup_rt && !realtime_task(p)) ||
+           (wakeup_rt && !rt_or_dl_task(p)) ||
            (!dl_task(p) && (p->prio >= wakeup_prio || p->prio >= current->prio)))
                return;
 
index 78dcad72970374af1731d31ac1511a9cc166cfdc..7a04cb1918fd54c67a3bf15cadd12263b995396a 100644 (file)
@@ -418,7 +418,7 @@ static void domain_dirty_limits(struct dirty_throttle_control *dtc)
                bg_thresh = (bg_ratio * available_memory) / PAGE_SIZE;
 
        tsk = current;
-       if (realtime_task(tsk)) {
+       if (rt_or_dl_task(tsk)) {
                bg_thresh += bg_thresh / 4 + global_wb_domain.dirty_limit / 32;
                thresh += thresh / 4 + global_wb_domain.dirty_limit / 32;
        }
@@ -477,7 +477,7 @@ static unsigned long node_dirty_limit(struct pglist_data *pgdat)
        else
                dirty = vm_dirty_ratio * node_memory / 100;
 
-       if (realtime_task(tsk))
+       if (rt_or_dl_task(tsk))
                dirty += dirty / 4;
 
        /*
index 54274e468d5142f0f76869d445599077f5807073..36f8abde37510373b387f9abefec613eb092845f 100644 (file)
@@ -4002,7 +4002,7 @@ gfp_to_alloc_flags(gfp_t gfp_mask, unsigned int order)
                 */
                if (alloc_flags & ALLOC_MIN_RESERVE)
                        alloc_flags &= ~ALLOC_CPUSET;
-       } else if (unlikely(realtime_task(current)) && in_task())
+       } else if (unlikely(rt_or_dl_task(current)) && in_task())
                alloc_flags |= ALLOC_MIN_RESERVE;
 
        alloc_flags = gfp_to_alloc_flags_cma(gfp_mask, alloc_flags);