conf: apply CpuThrottling first and CpuSched next 23/276223/4
authorUnsung Lee <unsung.lee@samsung.com>
Mon, 13 Jun 2022 06:01:43 +0000 (15:01 +0900)
committerUnsung Lee <unsung.lee@samsung.com>
Mon, 13 Jun 2022 07:58:21 +0000 (16:58 +0900)
Change-Id: I74985dca4b44d2020420fbc364d48df1c523a7c3
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
src/process/proc-main.c
src/resourced/init.c

index 71080e7..d295bba 100644 (file)
@@ -826,7 +826,7 @@ __attribute__((weak)) struct proc_app_info *proc_create_app_info(const char *app
                                memset(&attr, 0, sizeof(struct sched_attr));
                                attr.size = sizeof(struct sched_attr);
                                if (pci->cpu_sched_info.cpu_nice >= CPU_MIN_NICE &&
-                                               pci->cpu_sched_info.cpu_nice <= CPU_MAX_NICE) {
+                                       pci->cpu_sched_info.cpu_nice <= CPU_MAX_NICE) {
                                        attr.sched_nice = pci->cpu_sched_info.cpu_nice;
                                        pai->app_cpu_nice_update_exclude = true;
                                }
@@ -844,6 +844,10 @@ __attribute__((weak)) struct proc_app_info *proc_create_app_info(const char *app
 
                                switch (pci->cpu_sched_info.cpu_sched_type) {
                                        case CPU_SCHED_NONE:
+                                               if (attr.sched_nice == CPU_INIT_NICE)
+                                                       goto skip_scheduler_update;
+
+                                               /* else go through */
                                        case CPU_SCHED_OTHER:
                                                attr.sched_policy = SCHED_OTHER;
 /*                                             error = sched_getattr(pid, &attr, 0);
@@ -916,6 +920,7 @@ __attribute__((weak)) struct proc_app_info *proc_create_app_info(const char *app
                                _I("[PROCESS] nice = %d", attr.sched_nice);
                                _I("[PROCESS] priority = %d", attr.sched_priority);
 
+skip_scheduler_update:
                                if (pci->watchdog_action == PROC_ACTION_IGNORE)
                                        pai->app_watchdog_exclude = true;
 
index 946681b..497a9df 100644 (file)
@@ -251,6 +251,14 @@ int fixed_service_list_init(void *data)
 
                pci->pid = pid;
 
+               /* Put a system service into (cpu) throttling group */
+               if (pci->cpu_throttling_enable) {
+                       struct proc_status ps = {0, };
+                       ps.pid = pid;
+                       ps.pai = NULL;
+                       resourced_notify(RESOURCED_NOTIFIER_THROTTLING_RESOURCE, &ps);
+               }
+
                memset(&attr, 0, sizeof(struct sched_attr));
                attr.size = sizeof(struct sched_attr);
                if (pci->cpu_sched_info.cpu_nice >= CPU_MIN_NICE &&
@@ -359,13 +367,6 @@ skip_scheduler_update:
                                _W("[WATCHDOG] Currently we support only REBOOT when a service is released");
                }
 
-               /* Put a system service into (cpu) throttling group */
-               if (pci->cpu_throttling_enable) {
-                       struct proc_status ps = {0, };
-                       ps.pid = pid;
-                       ps.pai = NULL;
-                       resourced_notify(RESOURCED_NOTIFIER_THROTTLING_RESOURCE, &ps);
-               }
 /*             if (pci->cpu_sched_info.cpu_sched_type == CPU_SCHED_FIFO ||
                    pci->cpu_sched_info.cpu_sched_type == CPU_SCHED_RR ||
                        pci->cpu_sched_info.cpu_sched_type == CPU_SCHED_DEADLINE) {