[2/3] lib/percpu-refcount: apply PERCPU_REF_AUTO_EXIT
Commit Message
Apply the added new flag of PERCPU_REF_AUTO_EXIT, so that users needn't
to call percpu_ref_exit() in ->release() any more.
Signed-off-by: Ming Lei <ming.lei@redhat.com>
---
drivers/infiniband/ulp/rtrs/rtrs-srv.c | 4 ++--
mm/memcontrol.c | 5 ++---
2 files changed, 4 insertions(+), 5 deletions(-)
@@ -122,7 +122,6 @@ static inline void rtrs_srv_inflight_ref_release(struct percpu_ref *ref)
struct rtrs_srv_path,
ids_inflight_ref);
- percpu_ref_exit(&srv_path->ids_inflight_ref);
complete(&srv_path->complete_done);
}
@@ -147,7 +146,8 @@ static int rtrs_srv_alloc_ops_ids(struct rtrs_srv_path *srv_path)
}
ret = percpu_ref_init(&srv_path->ids_inflight_ref,
- rtrs_srv_inflight_ref_release, 0, GFP_KERNEL);
+ rtrs_srv_inflight_ref_release,
+ PERCPU_REF_AUTO_EXIT, GFP_KERNEL);
if (ret) {
pr_err("Percpu reference init failed\n");
goto err;
@@ -294,7 +294,6 @@ static void obj_cgroup_release(struct percpu_ref *ref)
list_del(&objcg->list);
spin_unlock_irqrestore(&objcg_lock, flags);
- percpu_ref_exit(ref);
kfree_rcu(objcg, rcu);
}
@@ -307,8 +306,8 @@ static struct obj_cgroup *obj_cgroup_alloc(void)
if (!objcg)
return NULL;
- ret = percpu_ref_init(&objcg->refcnt, obj_cgroup_release, 0,
- GFP_KERNEL);
+ ret = percpu_ref_init(&objcg->refcnt, obj_cgroup_release,
+ PERCPU_REF_AUTO_EXIT, GFP_KERNEL);
if (ret) {
kfree(objcg);
return NULL;