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@xxxxxxxxxx> --- drivers/infiniband/ulp/rtrs/rtrs-srv.c | 4 ++-- mm/memcontrol.c | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/infiniband/ulp/rtrs/rtrs-srv.c b/drivers/infiniband/ulp/rtrs/rtrs-srv.c index 22d7ba05e9fe..07d1af3fad28 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs-srv.c +++ b/drivers/infiniband/ulp/rtrs/rtrs-srv.c @@ -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; diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 266a1ab05434..eaca7d16b143 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -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; -- 2.38.1