diff options
author | Tejun Heo <tj@kernel.org> | 2014-09-07 20:51:30 -0400 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2014-09-07 20:51:30 -0400 |
commit | 20ae00792c6f1f18fc4fc5965445a145df92827e (patch) | |
tree | 3ca91fac24ac0a672c105e766c4d5020e53be876 /lib | |
parent | 908c7f1949cb7cc6e92ba8f18f2998e87e265b8e (diff) |
proportions: add @gfp to init functions
Percpu allocator now supports allocation mask. Add @gfp to
[flex_]proportions init functions so that !GFP_KERNEL allocation masks
can be used with them too.
This patch doesn't make any functional difference.
Signed-off-by: Tejun Heo <tj@kernel.org>
Reviewed-by: Jan Kara <jack@suse.cz>
Cc: Peter Zijlstra <peterz@infradead.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/flex_proportions.c | 8 | ||||
-rw-r--r-- | lib/proportions.c | 10 |
2 files changed, 9 insertions, 9 deletions
diff --git a/lib/flex_proportions.c b/lib/flex_proportions.c index b9d026bfcf38..8f25652f40d4 100644 --- a/lib/flex_proportions.c +++ b/lib/flex_proportions.c | |||
@@ -34,13 +34,13 @@ | |||
34 | */ | 34 | */ |
35 | #include <linux/flex_proportions.h> | 35 | #include <linux/flex_proportions.h> |
36 | 36 | ||
37 | int fprop_global_init(struct fprop_global *p) | 37 | int fprop_global_init(struct fprop_global *p, gfp_t gfp) |
38 | { | 38 | { |
39 | int err; | 39 | int err; |
40 | 40 | ||
41 | p->period = 0; | 41 | p->period = 0; |
42 | /* Use 1 to avoid dealing with periods with 0 events... */ | 42 | /* Use 1 to avoid dealing with periods with 0 events... */ |
43 | err = percpu_counter_init(&p->events, 1, GFP_KERNEL); | 43 | err = percpu_counter_init(&p->events, 1, gfp); |
44 | if (err) | 44 | if (err) |
45 | return err; | 45 | return err; |
46 | seqcount_init(&p->sequence); | 46 | seqcount_init(&p->sequence); |
@@ -168,11 +168,11 @@ void fprop_fraction_single(struct fprop_global *p, | |||
168 | */ | 168 | */ |
169 | #define PROP_BATCH (8*(1+ilog2(nr_cpu_ids))) | 169 | #define PROP_BATCH (8*(1+ilog2(nr_cpu_ids))) |
170 | 170 | ||
171 | int fprop_local_init_percpu(struct fprop_local_percpu *pl) | 171 | int fprop_local_init_percpu(struct fprop_local_percpu *pl, gfp_t gfp) |
172 | { | 172 | { |
173 | int err; | 173 | int err; |
174 | 174 | ||
175 | err = percpu_counter_init(&pl->events, 0, GFP_KERNEL); | 175 | err = percpu_counter_init(&pl->events, 0, gfp); |
176 | if (err) | 176 | if (err) |
177 | return err; | 177 | return err; |
178 | pl->period = 0; | 178 | pl->period = 0; |
diff --git a/lib/proportions.c b/lib/proportions.c index ca95f8d54384..6f724298f67a 100644 --- a/lib/proportions.c +++ b/lib/proportions.c | |||
@@ -73,7 +73,7 @@ | |||
73 | #include <linux/proportions.h> | 73 | #include <linux/proportions.h> |
74 | #include <linux/rcupdate.h> | 74 | #include <linux/rcupdate.h> |
75 | 75 | ||
76 | int prop_descriptor_init(struct prop_descriptor *pd, int shift) | 76 | int prop_descriptor_init(struct prop_descriptor *pd, int shift, gfp_t gfp) |
77 | { | 77 | { |
78 | int err; | 78 | int err; |
79 | 79 | ||
@@ -83,11 +83,11 @@ int prop_descriptor_init(struct prop_descriptor *pd, int shift) | |||
83 | pd->index = 0; | 83 | pd->index = 0; |
84 | pd->pg[0].shift = shift; | 84 | pd->pg[0].shift = shift; |
85 | mutex_init(&pd->mutex); | 85 | mutex_init(&pd->mutex); |
86 | err = percpu_counter_init(&pd->pg[0].events, 0, GFP_KERNEL); | 86 | err = percpu_counter_init(&pd->pg[0].events, 0, gfp); |
87 | if (err) | 87 | if (err) |
88 | goto out; | 88 | goto out; |
89 | 89 | ||
90 | err = percpu_counter_init(&pd->pg[1].events, 0, GFP_KERNEL); | 90 | err = percpu_counter_init(&pd->pg[1].events, 0, gfp); |
91 | if (err) | 91 | if (err) |
92 | percpu_counter_destroy(&pd->pg[0].events); | 92 | percpu_counter_destroy(&pd->pg[0].events); |
93 | 93 | ||
@@ -188,12 +188,12 @@ prop_adjust_shift(int *pl_shift, unsigned long *pl_period, int new_shift) | |||
188 | 188 | ||
189 | #define PROP_BATCH (8*(1+ilog2(nr_cpu_ids))) | 189 | #define PROP_BATCH (8*(1+ilog2(nr_cpu_ids))) |
190 | 190 | ||
191 | int prop_local_init_percpu(struct prop_local_percpu *pl) | 191 | int prop_local_init_percpu(struct prop_local_percpu *pl, gfp_t gfp) |
192 | { | 192 | { |
193 | raw_spin_lock_init(&pl->lock); | 193 | raw_spin_lock_init(&pl->lock); |
194 | pl->shift = 0; | 194 | pl->shift = 0; |
195 | pl->period = 0; | 195 | pl->period = 0; |
196 | return percpu_counter_init(&pl->events, 0, GFP_KERNEL); | 196 | return percpu_counter_init(&pl->events, 0, gfp); |
197 | } | 197 | } |
198 | 198 | ||
199 | void prop_local_destroy_percpu(struct prop_local_percpu *pl) | 199 | void prop_local_destroy_percpu(struct prop_local_percpu *pl) |