mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 02:50:49 +09:00
sched: optimize prio for kernel RT thread and kworker
In some cases, there are too much userspace high priority RT threads, which cause kernel RT threads or kworkers block too long time. This config separate kernel and userspace RT threads into two priority regions, priority 0~49 for kernel and priority 50~99 for userspace, so that kernel RT threads is always higher priority than userspace. This config also set RT policy for kworkers. Change-Id: I87e03915dc0dd03cbcd91d211d2ef56c301451f9 Signed-off-by: Liang Chen <cl@rock-chips.com>
This commit is contained in:
@@ -51,6 +51,7 @@
|
||||
#include <linux/sched/isolation.h>
|
||||
#include <linux/nmi.h>
|
||||
#include <linux/kvm_para.h>
|
||||
#include <uapi/linux/sched/types.h>
|
||||
|
||||
#include "workqueue_internal.h"
|
||||
|
||||
@@ -1959,6 +1960,15 @@ static struct worker *create_worker(struct worker_pool *pool)
|
||||
goto fail;
|
||||
|
||||
set_user_nice(worker->task, pool->attrs->nice);
|
||||
if (IS_ENABLED(CONFIG_ROCKCHIP_OPTIMIZE_RT_PRIO)) {
|
||||
struct sched_param param;
|
||||
|
||||
if (pool->attrs->nice == 0)
|
||||
param.sched_priority = MAX_RT_PRIO / 2 - 4;
|
||||
else
|
||||
param.sched_priority = MAX_RT_PRIO / 2 - 2;
|
||||
sched_setscheduler_nocheck(worker->task, SCHED_RR, ¶m);
|
||||
}
|
||||
kthread_bind_mask(worker->task, pool->attrs->cpumask);
|
||||
|
||||
/* successful, attach the worker to the pool */
|
||||
|
||||
Reference in New Issue
Block a user