mirror of
https://github.com/torvalds/linux.git
synced 2026-07-31 11:37:06 +02:00
sched/walt: Remove duplicate get_task_struct
get_pid_task internally increments the reference counter, which could cause unbalanced reference counter (always high). Only call get_task_struct when pid is 0. Change-Id: I409b477d0714ce35a0dc980782ee5878106ecffd Signed-off-by: Elliot Berman <quic_eberman@quicinc.com> Signed-off-by: Sai Harshini Nimmala <quic_snimmala@quicinc.com>
This commit is contained in:
parent
9a042aeb41
commit
2eecd3353f
|
|
@ -1,6 +1,7 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2016-2021 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <trace/hooks/cpufreq.h>
|
||||
|
|
@ -31,18 +32,13 @@ static bool is_sched_lib_based_app(pid_t pid)
|
|||
return false;
|
||||
|
||||
rcu_read_lock();
|
||||
|
||||
p = pid ? get_pid_task(find_vpid(pid), PIDTYPE_PID) : current;
|
||||
p = pid ? get_pid_task(find_vpid(pid), PIDTYPE_PID) : get_task_struct(current);
|
||||
rcu_read_unlock();
|
||||
if (!p) {
|
||||
rcu_read_unlock();
|
||||
kfree(tmp_lib_name);
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Prevent p going away */
|
||||
get_task_struct(p);
|
||||
rcu_read_unlock();
|
||||
|
||||
mm = get_task_mm(p);
|
||||
if (!mm)
|
||||
goto put_task_struct;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user