[PATCH 4/8] opp: Introduce APIs to remove OPPs

Rafael J. Wysocki rjw at rjwysocki.net
Wed Nov 26 14:32:26 PST 2014


On Wednesday, November 26, 2014 02:47:47 PM Viresh Kumar wrote:
> On 26 November 2014 at 11:59, Viresh Kumar <viresh.kumar at linaro.org> wrote:
> > Also it looks like I should use call_srcu() with kfree_rcu() for
> > opp_set_availability() case as well to avoid any corner cases.
> 
> This is the diff I would be adding to this patch:

That should work if I'm not mistaken, but I'm wondering if we could
settle on using one RCU type for this (later, though).

> diff --git a/drivers/base/power/opp.c b/drivers/base/power/opp.c
> index f9d80e6..3f728cd 100644
> --- a/drivers/base/power/opp.c
> +++ b/drivers/base/power/opp.c
> @@ -506,7 +506,7 @@ static void kfree_opp_rcu(struct rcu_head *head)
>         struct dev_pm_opp *opp = container_of(head, struct dev_pm_opp,
> rcu_head);
> 
>         pr_info("%s: opp:%p, dynamic:%d\n", __func__, opp, opp->dynamic);
> -       kfree(opp);
> +       kfree_rcu(opp);
>  }
> 
>  static void kfree_device_rcu(struct rcu_head *head)
> @@ -644,7 +644,7 @@ static int opp_set_availability(struct device
> *dev, unsigned long freq,
> 
>         list_replace_rcu(&opp->node, &new_opp->node);
>         mutex_unlock(&dev_opp_list_lock);
> -       kfree_rcu(opp, rcu_head);
> +       call_srcu(&dev_opp->srcu_head.srcu, &opp->rcu_head, kfree_opp_rcu);
> 
>         /* Notify the change of the OPP availability */
>         if (availability_req)

-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.



More information about the linux-arm-kernel mailing list