mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-10-30 22:03:17 +01:00
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 <[email protected]> Reviewed-by: David Vernet <[email protected]> Acked-by: Josh Don <[email protected]> Acked-by: Hao Luo <[email protected]> Acked-by: Barret Rhoden <[email protected]>
This commit is contained in:
1 parent
96fd6c65ef
commit
2c8d046d5d
2 files changed
+7
-2
No files matched your search
+1
-1
@@ -8391,7 +8391,7 @@ static void check_preempt_wakeup_fair(struct rq *rq, struct task_struct *p, int
|
||||
* Batch and idle tasks do not preempt non-idle tasks (their preemption
|
||||
* is driven by the tick):
|
||||
*/
|
||||
if (unlikely(p->policy != SCHED_NORMAL) || !sched_feat(WAKEUP_PREEMPTION))
|
||||
if (unlikely(!normal_policy(p->policy)) || !sched_feat(WAKEUP_PREEMPTION))
|
||||
return;
|
||||
|
||||
find_matching_se(&se, &pse);
|
||||
|
||||
@@ -192,9 +192,14 @@ static inline int idle_policy(int policy)
|
||||
return policy == SCHED_IDLE;
|
||||
}
|
||||
|
||||
static inline int normal_policy(int policy)
|
||||
{
|
||||
return policy == SCHED_NORMAL;
|
||||
}
|
||||
|
||||
static inline int fair_policy(int policy)
|
||||
{
|
||||
return policy == SCHED_NORMAL || policy == SCHED_BATCH;
|
||||
return normal_policy(policy) || policy == SCHED_BATCH;
|
||||
}
|
||||
|
||||
static inline int rt_policy(int policy)
|
||||
|
||||
Reference in new issue
Block a user