diff --git a/modules/common/appspawn_common.c b/modules/common/appspawn_common.c index 7c6095d776e9c7bed2e24c42a0d5ec0dcee0ad2f..f36a5e00ff937f834cbe6cc7c5a026ff39e5d6e2 100644 --- a/modules/common/appspawn_common.c +++ b/modules/common/appspawn_common.c @@ -287,12 +287,6 @@ static int SetXpmConfig(const AppSpawnMgr *content, const AppSpawningCtx *proper static int SetUidGid(const AppSpawnMgr *content, const AppSpawningCtx *property) { - if (IsAppSpawnMode(content) || IsHybridSpawnMode(content)) { - struct sched_param param = { 0 }; - param.sched_priority = 0; - int ret = sched_setscheduler(0, SCHED_OTHER, ¶m); - APPSPAWN_CHECK_ONLY_LOG(ret == 0, "UpdateSchedPrio failed ret: %{public}d, %{public}d", ret, errno); - } AppSpawnMsgDacInfo *dacInfo = (AppSpawnMsgDacInfo *)GetAppProperty(property, TLV_DAC_INFO); APPSPAWN_CHECK(dacInfo != NULL, return APPSPAWN_TLV_NONE, "No tlv %{public}d in msg %{public}s", TLV_DAC_INFO, GetProcessName(property)); @@ -725,6 +719,17 @@ APPSPAWN_STATIC int RecordStartTime(AppSpawnMgr *content, AppSpawningCtx *proper return 0; } +static int SetSchedPriority(AppSpawnMgr *content, AppSpawningCtx *property) +{ + if (IsAppSpawnMode(content)) { + struct sched_param param = { 0 }; + param.sched_priority = 0; + int ret = sched_setscheduler(0, SCHED_OTHER, ¶m); + APPSPAWN_CHECK_ONLY_LOG(ret == 0, "UpdateSchedPrio failed ret %{public}d, errno %{public}d", ret, errno); + } + return 0; +} + MODULE_CONSTRUCTOR(void) { APPSPAWN_LOGV("Load common module ..."); @@ -743,4 +748,5 @@ MODULE_CONSTRUCTOR(void) AddAppSpawnHook(STAGE_PARENT_POST_FORK, HOOK_PRIO_HIGHEST, CloseFdArgs); AddAppSpawnHook(STAGE_CHILD_PRE_COLDBOOT, HOOK_PRIO_HIGHEST, SetFdEnv); AddAppSpawnHook(STAGE_CHILD_PRE_RUN, HOOK_PRIO_HIGHEST, RecordStartTime); + AddAppSpawnHook(STAGE_CHILD_PRE_RUN, HOOK_PRIO_LOWEST - 1, SetSchedPriority); }