Skip to content

Commit

Permalink
sched: walt: fix RCU usage warning
Browse files Browse the repository at this point in the history
use rcu_dereference_sched instead of rcu_dereference to fix lockdep
warning generated as rcu_derefence is not used within rcu_read_lock.

Change-Id: Ibd093b9e1787253b97e4efcce04cd8bd38bf88de
Signed-off-by: Ashay Jaiswal <[email protected]>
  • Loading branch information
ashayj authored and Official-Ayrton990 committed Sep 6, 2022
1 parent 540e34e commit 83afcaa
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions kernel/sched/walt/walt.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <linux/syscore_ops.h>
#include <linux/cpufreq.h>
Expand Down Expand Up @@ -1029,7 +1030,7 @@ void fixup_busy_time(struct task_struct *p, int new_cpu)

new_task = is_new_task(p);
/* Protected by rq_lock */
grp = rcu_dereference(p->wts.grp);
grp = rcu_dereference_sched(p->wts.grp);

/*
* For frequency aggregation, we continue to do migration fixups
Expand Down Expand Up @@ -1972,7 +1973,7 @@ static void update_cpu_busy_time(struct task_struct *p, struct rq *rq,
if (!account_busy_for_cpu_time(rq, p, irqtime, event))
goto done;

grp = rcu_dereference(p->wts.grp);
grp = rcu_dereference_sched(p->wts.grp);
if (grp) {
struct group_cpu_time *cpu_time = &rq->wrq.grp_time;

Expand Down Expand Up @@ -3311,7 +3312,7 @@ static void remove_task_from_group(struct task_struct *p)
int empty_group = 1;
struct rq_flags rf;

grp = rcu_dereference(p->wts.grp);
grp = rcu_dereference_sched(p->wts.grp);
raw_spin_lock(&grp->lock);

rq = __task_rq_lock(p, &rf);
Expand Down

0 comments on commit 83afcaa

Please sign in to comment.