diff options
-rw-r--r-- | block/blk-mq.c | 3 | ||||
-rw-r--r-- | drivers/target/target_core_tpg.c | 3 | ||||
-rw-r--r-- | fs/aio.c | 4 | ||||
-rw-r--r-- | include/linux/percpu-refcount.h | 3 | ||||
-rw-r--r-- | kernel/cgroup.c | 6 | ||||
-rw-r--r-- | lib/percpu-refcount.c | 6 |
6 files changed, 15 insertions, 10 deletions
diff --git a/block/blk-mq.c b/block/blk-mq.c index 5189cb1e478a..702df07b980d 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c | |||
@@ -1776,7 +1776,8 @@ struct request_queue *blk_mq_init_queue(struct blk_mq_tag_set *set) | |||
1776 | if (!q) | 1776 | if (!q) |
1777 | goto err_hctxs; | 1777 | goto err_hctxs; |
1778 | 1778 | ||
1779 | if (percpu_ref_init(&q->mq_usage_counter, blk_mq_usage_counter_release)) | 1779 | if (percpu_ref_init(&q->mq_usage_counter, blk_mq_usage_counter_release, |
1780 | GFP_KERNEL)) | ||
1780 | goto err_map; | 1781 | goto err_map; |
1781 | 1782 | ||
1782 | setup_timer(&q->timeout, blk_mq_rq_timer, (unsigned long) q); | 1783 | setup_timer(&q->timeout, blk_mq_rq_timer, (unsigned long) q); |
diff --git a/drivers/target/target_core_tpg.c b/drivers/target/target_core_tpg.c index fddfae61222f..4ab6da338585 100644 --- a/drivers/target/target_core_tpg.c +++ b/drivers/target/target_core_tpg.c | |||
@@ -819,7 +819,8 @@ int core_tpg_add_lun( | |||
819 | { | 819 | { |
820 | int ret; | 820 | int ret; |
821 | 821 | ||
822 | ret = percpu_ref_init(&lun->lun_ref, core_tpg_lun_ref_release); | 822 | ret = percpu_ref_init(&lun->lun_ref, core_tpg_lun_ref_release, |
823 | GFP_KERNEL); | ||
823 | if (ret < 0) | 824 | if (ret < 0) |
824 | return ret; | 825 | return ret; |
825 | 826 | ||
@@ -666,10 +666,10 @@ static struct kioctx *ioctx_alloc(unsigned nr_events) | |||
666 | 666 | ||
667 | INIT_LIST_HEAD(&ctx->active_reqs); | 667 | INIT_LIST_HEAD(&ctx->active_reqs); |
668 | 668 | ||
669 | if (percpu_ref_init(&ctx->users, free_ioctx_users)) | 669 | if (percpu_ref_init(&ctx->users, free_ioctx_users, GFP_KERNEL)) |
670 | goto err; | 670 | goto err; |
671 | 671 | ||
672 | if (percpu_ref_init(&ctx->reqs, free_ioctx_reqs)) | 672 | if (percpu_ref_init(&ctx->reqs, free_ioctx_reqs, GFP_KERNEL)) |
673 | goto err; | 673 | goto err; |
674 | 674 | ||
675 | ctx->cpu = alloc_percpu(struct kioctx_cpu); | 675 | ctx->cpu = alloc_percpu(struct kioctx_cpu); |
diff --git a/include/linux/percpu-refcount.h b/include/linux/percpu-refcount.h index 3dfbf237cd8f..ee8325122dbd 100644 --- a/include/linux/percpu-refcount.h +++ b/include/linux/percpu-refcount.h | |||
@@ -49,6 +49,7 @@ | |||
49 | #include <linux/kernel.h> | 49 | #include <linux/kernel.h> |
50 | #include <linux/percpu.h> | 50 | #include <linux/percpu.h> |
51 | #include <linux/rcupdate.h> | 51 | #include <linux/rcupdate.h> |
52 | #include <linux/gfp.h> | ||
52 | 53 | ||
53 | struct percpu_ref; | 54 | struct percpu_ref; |
54 | typedef void (percpu_ref_func_t)(struct percpu_ref *); | 55 | typedef void (percpu_ref_func_t)(struct percpu_ref *); |
@@ -66,7 +67,7 @@ struct percpu_ref { | |||
66 | }; | 67 | }; |
67 | 68 | ||
68 | int __must_check percpu_ref_init(struct percpu_ref *ref, | 69 | int __must_check percpu_ref_init(struct percpu_ref *ref, |
69 | percpu_ref_func_t *release); | 70 | percpu_ref_func_t *release, gfp_t gfp); |
70 | void percpu_ref_reinit(struct percpu_ref *ref); | 71 | void percpu_ref_reinit(struct percpu_ref *ref); |
71 | void percpu_ref_exit(struct percpu_ref *ref); | 72 | void percpu_ref_exit(struct percpu_ref *ref); |
72 | void percpu_ref_kill_and_confirm(struct percpu_ref *ref, | 73 | void percpu_ref_kill_and_confirm(struct percpu_ref *ref, |
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index 7dc8788cfd52..589b4d89a0a5 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c | |||
@@ -1628,7 +1628,7 @@ static int cgroup_setup_root(struct cgroup_root *root, unsigned int ss_mask) | |||
1628 | goto out; | 1628 | goto out; |
1629 | root_cgrp->id = ret; | 1629 | root_cgrp->id = ret; |
1630 | 1630 | ||
1631 | ret = percpu_ref_init(&root_cgrp->self.refcnt, css_release); | 1631 | ret = percpu_ref_init(&root_cgrp->self.refcnt, css_release, GFP_KERNEL); |
1632 | if (ret) | 1632 | if (ret) |
1633 | goto out; | 1633 | goto out; |
1634 | 1634 | ||
@@ -4487,7 +4487,7 @@ static int create_css(struct cgroup *cgrp, struct cgroup_subsys *ss, | |||
4487 | 4487 | ||
4488 | init_and_link_css(css, ss, cgrp); | 4488 | init_and_link_css(css, ss, cgrp); |
4489 | 4489 | ||
4490 | err = percpu_ref_init(&css->refcnt, css_release); | 4490 | err = percpu_ref_init(&css->refcnt, css_release, GFP_KERNEL); |
4491 | if (err) | 4491 | if (err) |
4492 | goto err_free_css; | 4492 | goto err_free_css; |
4493 | 4493 | ||
@@ -4555,7 +4555,7 @@ static int cgroup_mkdir(struct kernfs_node *parent_kn, const char *name, | |||
4555 | goto out_unlock; | 4555 | goto out_unlock; |
4556 | } | 4556 | } |
4557 | 4557 | ||
4558 | ret = percpu_ref_init(&cgrp->self.refcnt, css_release); | 4558 | ret = percpu_ref_init(&cgrp->self.refcnt, css_release, GFP_KERNEL); |
4559 | if (ret) | 4559 | if (ret) |
4560 | goto out_free_cgrp; | 4560 | goto out_free_cgrp; |
4561 | 4561 | ||
diff --git a/lib/percpu-refcount.c b/lib/percpu-refcount.c index fe5a3342e960..ff9903264a91 100644 --- a/lib/percpu-refcount.c +++ b/lib/percpu-refcount.c | |||
@@ -40,6 +40,7 @@ static unsigned __percpu *pcpu_count_ptr(struct percpu_ref *ref) | |||
40 | * percpu_ref_init - initialize a percpu refcount | 40 | * percpu_ref_init - initialize a percpu refcount |
41 | * @ref: percpu_ref to initialize | 41 | * @ref: percpu_ref to initialize |
42 | * @release: function which will be called when refcount hits 0 | 42 | * @release: function which will be called when refcount hits 0 |
43 | * @gfp: allocation mask to use | ||
43 | * | 44 | * |
44 | * Initializes the refcount in single atomic counter mode with a refcount of 1; | 45 | * Initializes the refcount in single atomic counter mode with a refcount of 1; |
45 | * analagous to atomic_set(ref, 1). | 46 | * analagous to atomic_set(ref, 1). |
@@ -47,11 +48,12 @@ static unsigned __percpu *pcpu_count_ptr(struct percpu_ref *ref) | |||
47 | * Note that @release must not sleep - it may potentially be called from RCU | 48 | * Note that @release must not sleep - it may potentially be called from RCU |
48 | * callback context by percpu_ref_kill(). | 49 | * callback context by percpu_ref_kill(). |
49 | */ | 50 | */ |
50 | int percpu_ref_init(struct percpu_ref *ref, percpu_ref_func_t *release) | 51 | int percpu_ref_init(struct percpu_ref *ref, percpu_ref_func_t *release, |
52 | gfp_t gfp) | ||
51 | { | 53 | { |
52 | atomic_set(&ref->count, 1 + PCPU_COUNT_BIAS); | 54 | atomic_set(&ref->count, 1 + PCPU_COUNT_BIAS); |
53 | 55 | ||
54 | ref->pcpu_count_ptr = (unsigned long)alloc_percpu(unsigned); | 56 | ref->pcpu_count_ptr = (unsigned long)alloc_percpu_gfp(unsigned, gfp); |
55 | if (!ref->pcpu_count_ptr) | 57 | if (!ref->pcpu_count_ptr) |
56 | return -ENOMEM; | 58 | return -ENOMEM; |
57 | 59 | ||