Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

sched: Add normal_policy()

A new BPF extensible sched_class will need to dynamically change how a task
picks its sched_class. For example, if the loaded BPF scheduler progs fail,
the tasks will be forced back on CFS even if the task's policy is set to the
new sched_class. To support such mapping, add normal_policy() which wraps
testing for %SCHED_NORMAL. This doesn't cause any behavior changes.

v2: Update the description with more details on the expected use.

Signed-off-by: Tejun Heo <tj@kernel.org>
Reviewed-by: David Vernet <dvernet@meta.com>
Acked-by: Josh Don <joshdon@google.com>
Acked-by: Hao Luo <haoluo@google.com>
Acked-by: Barret Rhoden <brho@google.com>

+7 -2
+1 -1
kernel/sched/fair.c
··· 8391 8391 * Batch and idle tasks do not preempt non-idle tasks (their preemption 8392 8392 * is driven by the tick): 8393 8393 */ 8394 - if (unlikely(p->policy != SCHED_NORMAL) || !sched_feat(WAKEUP_PREEMPTION)) 8394 + if (unlikely(!normal_policy(p->policy)) || !sched_feat(WAKEUP_PREEMPTION)) 8395 8395 return; 8396 8396 8397 8397 find_matching_se(&se, &pse);
+6 -1
kernel/sched/sched.h
··· 192 192 return policy == SCHED_IDLE; 193 193 } 194 194 195 + static inline int normal_policy(int policy) 196 + { 197 + return policy == SCHED_NORMAL; 198 + } 199 + 195 200 static inline int fair_policy(int policy) 196 201 { 197 - return policy == SCHED_NORMAL || policy == SCHED_BATCH; 202 + return normal_policy(policy) || policy == SCHED_BATCH; 198 203 } 199 204 200 205 static inline int rt_policy(int policy)