Re: [PATCH 2/4] base/drivers/arch_topology: Replace mutex with READ_ONCE / WRITE_ONCE

From: Viresh Kumar
Date: Tue Oct 30 2018 - 01:57:54 EST


On Mon, Oct 29, 2018 at 9:54 PM Daniel Lezcano
<daniel.lezcano@xxxxxxxxxx> wrote:
>
> The mutex protects a per_cpu variable access. The potential race can
> happen only when the cpufreq governor module is loaded and at the same
> time the cpu capacity is changed in the sysfs.
>
> There is no real interest of using a mutex to protect a variable
> assignation when there is no situation where a task can take the lock
> and block.
>
> Replace the mutex by READ_ONCE / WRITE_ONCE.
>
> Signed-off-by: Daniel Lezcano <daniel.lezcano@xxxxxxxxxx>
> ---
> drivers/base/arch_topology.c | 7 +------
> include/linux/arch_topology.h | 2 +-
> 2 files changed, 2 insertions(+), 7 deletions(-)

Reviewed-by: Viresh Kumar <viresh.kumar@xxxxxxxxxx>