cpu-sched: Optimize search for cpu affinity fixed app 82/288182/5
authorUnsung Lee <unsung.lee@samsung.com>
Mon, 13 Feb 2023 06:11:30 +0000 (15:11 +0900)
committerChanwoo Choi <cw00.choi@samsung.com>
Thu, 16 Feb 2023 00:55:31 +0000 (00:55 +0000)
This patch includes
  - Change serach for fixed cpu affnity apps
(using the hashtable of apps by calling
'fixed_app_and_service_exist_check(name, APP_TYPE) func')

resourced manages all per-app configurations
('Private' section) using a hashtable.
On the other hand, resourced (cpu-sched) managed cpu affinity fixed apps
using a list instead of hashtable.
That is, when resourced (cpu-sched) detects app launch or app status change,
it searches the list linearly to know whether the app requires fixed cpu affinity or not.
(Linear search is normally slow when app list size is big)

resourced (cpu-shced) will
  - use the hastable of the per-app configuration when searching an app
  - use the legacy list to apply something to all fixed cpu affinity apps

Change-Id: I9340e1e7c6796463625660780b82f30c7a91a025
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
src/resource-optimizer/cpu/cpu-sched.c

index b22f4b2..e6bee5c 100644 (file)
@@ -33,15 +33,11 @@ static int cpu_sched_cpu_on(void *data);
 
 struct cpuset_info *cpu_sched_find_coreset(const char *name)
 {
-       GSList *i;
-       struct cpuset_info *cpuset_info;
+       struct proc_conf_info *pci = fixed_app_and_service_exist_check(name, APP_TYPE);
+       if (pci == NULL)
+               return NULL;
 
-       gslist_for_each_item(i, cs.apps) {
-               cpuset_info = (struct cpuset_info *)i->data;
-               if (!strcmp(name, cpuset_info->name))
-                       return cpuset_info;
-       }
-       return NULL;
+       return &pci->cpuset_info;
 }
 
 /* check if cpuset subsystem is mounted at the right location */