sched: Improve the scheduler

This change is for general scheduler improvements.

Change-Id: I3842c589378ce5bcc54e4c35ebcbfbdfa1f88a8f
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
This commit is contained in:
Pavankumar Kondeti 2020-03-20 13:36:54 +05:30
parent 8c06c7547e
commit 0d1ad3ffe9

View file

@ -5039,9 +5039,10 @@ unsigned int sched_lib_mask_force;
bool is_sched_lib_based_app(pid_t pid) bool is_sched_lib_based_app(pid_t pid)
{ {
const char *name = NULL; const char *name = NULL;
char *lib_list, *libname; char *libname, *lib_list;
struct vm_area_struct *vma; struct vm_area_struct *vma;
char path_buf[LIB_PATH_LENGTH]; char path_buf[LIB_PATH_LENGTH];
char tmp_lib_name[LIB_PATH_LENGTH];
bool found = false; bool found = false;
struct task_struct *p; struct task_struct *p;
struct mm_struct *mm; struct mm_struct *mm;
@ -5049,14 +5050,11 @@ bool is_sched_lib_based_app(pid_t pid)
if (strnlen(sched_lib_name, LIB_PATH_LENGTH) == 0) if (strnlen(sched_lib_name, LIB_PATH_LENGTH) == 0)
return false; return false;
lib_list = kstrdup(sched_lib_name, GFP_KERNEL);
rcu_read_lock(); rcu_read_lock();
p = find_process_by_pid(pid); p = find_process_by_pid(pid);
if (!p) { if (!p) {
rcu_read_unlock(); rcu_read_unlock();
kfree(lib_list);
return false; return false;
} }
@ -5076,11 +5074,14 @@ bool is_sched_lib_based_app(pid_t pid)
if (IS_ERR(name)) if (IS_ERR(name))
goto release_sem; goto release_sem;
strlcpy(tmp_lib_name, sched_lib_name, LIB_PATH_LENGTH);
lib_list = tmp_lib_name;
while ((libname = strsep(&lib_list, ","))) { while ((libname = strsep(&lib_list, ","))) {
libname = skip_spaces(libname);
if (strnstr(name, libname, if (strnstr(name, libname,
strnlen(name, LIB_PATH_LENGTH))) { strnlen(name, LIB_PATH_LENGTH))) {
found = true; found = true;
break; goto release_sem;
} }
} }
} }
@ -5091,7 +5092,6 @@ bool is_sched_lib_based_app(pid_t pid)
mmput(mm); mmput(mm);
put_task_struct: put_task_struct:
put_task_struct(p); put_task_struct(p);
kfree(lib_list);
return found; return found;
} }