From 2eecd3353fa649e54e8d6794b68fc461e5e3441d Mon Sep 17 00:00:00 2001 From: Elliot Berman Date: Mon, 1 Nov 2021 15:41:25 -0700 Subject: [PATCH] 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 Signed-off-by: Sai Harshini Nimmala --- kernel/sched/walt/fixup.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/kernel/sched/walt/fixup.c b/kernel/sched/walt/fixup.c index 2b7bae6d00ef..f3b5d7e258cd 100644 --- a/kernel/sched/walt/fixup.c +++ b/kernel/sched/walt/fixup.c @@ -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 @@ -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;