diff options
-rw-r--r-- | include/linux/flex_proportions.h | 5 | ||||
-rw-r--r-- | include/linux/proportions.h | 5 | ||||
-rw-r--r-- | lib/flex_proportions.c | 8 | ||||
-rw-r--r-- | lib/proportions.c | 10 | ||||
-rw-r--r-- | mm/backing-dev.c | 2 | ||||
-rw-r--r-- | mm/page-writeback.c | 2 |
6 files changed, 17 insertions, 15 deletions
diff --git a/include/linux/flex_proportions.h b/include/linux/flex_proportions.h index 4ebc49fae391..0d348e011a6e 100644 --- a/include/linux/flex_proportions.h +++ b/include/linux/flex_proportions.h | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/percpu_counter.h> | 10 | #include <linux/percpu_counter.h> |
11 | #include <linux/spinlock.h> | 11 | #include <linux/spinlock.h> |
12 | #include <linux/seqlock.h> | 12 | #include <linux/seqlock.h> |
13 | #include <linux/gfp.h> | ||
13 | 14 | ||
14 | /* | 15 | /* |
15 | * When maximum proportion of some event type is specified, this is the | 16 | * When maximum proportion of some event type is specified, this is the |
@@ -32,7 +33,7 @@ struct fprop_global { | |||
32 | seqcount_t sequence; | 33 | seqcount_t sequence; |
33 | }; | 34 | }; |
34 | 35 | ||
35 | int fprop_global_init(struct fprop_global *p); | 36 | int fprop_global_init(struct fprop_global *p, gfp_t gfp); |
36 | void fprop_global_destroy(struct fprop_global *p); | 37 | void fprop_global_destroy(struct fprop_global *p); |
37 | bool fprop_new_period(struct fprop_global *p, int periods); | 38 | bool fprop_new_period(struct fprop_global *p, int periods); |
38 | 39 | ||
@@ -79,7 +80,7 @@ struct fprop_local_percpu { | |||
79 | raw_spinlock_t lock; /* Protect period and numerator */ | 80 | raw_spinlock_t lock; /* Protect period and numerator */ |
80 | }; | 81 | }; |
81 | 82 | ||
82 | int fprop_local_init_percpu(struct fprop_local_percpu *pl); | 83 | int fprop_local_init_percpu(struct fprop_local_percpu *pl, gfp_t gfp); |
83 | void fprop_local_destroy_percpu(struct fprop_local_percpu *pl); | 84 | void fprop_local_destroy_percpu(struct fprop_local_percpu *pl); |
84 | void __fprop_inc_percpu(struct fprop_global *p, struct fprop_local_percpu *pl); | 85 | void __fprop_inc_percpu(struct fprop_global *p, struct fprop_local_percpu *pl); |
85 | void __fprop_inc_percpu_max(struct fprop_global *p, struct fprop_local_percpu *pl, | 86 | void __fprop_inc_percpu_max(struct fprop_global *p, struct fprop_local_percpu *pl, |
diff --git a/include/linux/proportions.h b/include/linux/proportions.h index 26a8a4ed9b07..00e8e8fa7358 100644 --- a/include/linux/proportions.h +++ b/include/linux/proportions.h | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/percpu_counter.h> | 12 | #include <linux/percpu_counter.h> |
13 | #include <linux/spinlock.h> | 13 | #include <linux/spinlock.h> |
14 | #include <linux/mutex.h> | 14 | #include <linux/mutex.h> |
15 | #include <linux/gfp.h> | ||
15 | 16 | ||
16 | struct prop_global { | 17 | struct prop_global { |
17 | /* | 18 | /* |
@@ -40,7 +41,7 @@ struct prop_descriptor { | |||
40 | struct mutex mutex; /* serialize the prop_global switch */ | 41 | struct mutex mutex; /* serialize the prop_global switch */ |
41 | }; | 42 | }; |
42 | 43 | ||
43 | int prop_descriptor_init(struct prop_descriptor *pd, int shift); | 44 | int prop_descriptor_init(struct prop_descriptor *pd, int shift, gfp_t gfp); |
44 | void prop_change_shift(struct prop_descriptor *pd, int new_shift); | 45 | void prop_change_shift(struct prop_descriptor *pd, int new_shift); |
45 | 46 | ||
46 | /* | 47 | /* |
@@ -61,7 +62,7 @@ struct prop_local_percpu { | |||
61 | raw_spinlock_t lock; /* protect the snapshot state */ | 62 | raw_spinlock_t lock; /* protect the snapshot state */ |
62 | }; | 63 | }; |
63 | 64 | ||
64 | int prop_local_init_percpu(struct prop_local_percpu *pl); | 65 | int prop_local_init_percpu(struct prop_local_percpu *pl, gfp_t gfp); |
65 | void prop_local_destroy_percpu(struct prop_local_percpu *pl); | 66 | void prop_local_destroy_percpu(struct prop_local_percpu *pl); |
66 | void __prop_inc_percpu(struct prop_descriptor *pd, struct prop_local_percpu *pl); | 67 | void __prop_inc_percpu(struct prop_descriptor *pd, struct prop_local_percpu *pl); |
67 | void prop_fraction_percpu(struct prop_descriptor *pd, struct prop_local_percpu *pl, | 68 | void prop_fraction_percpu(struct prop_descriptor *pd, struct prop_local_percpu *pl, |
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) |
diff --git a/mm/backing-dev.c b/mm/backing-dev.c index f19a818be2d3..64ec49d1772b 100644 --- a/mm/backing-dev.c +++ b/mm/backing-dev.c | |||
@@ -470,7 +470,7 @@ int bdi_init(struct backing_dev_info *bdi) | |||
470 | bdi->write_bandwidth = INIT_BW; | 470 | bdi->write_bandwidth = INIT_BW; |
471 | bdi->avg_write_bandwidth = INIT_BW; | 471 | bdi->avg_write_bandwidth = INIT_BW; |
472 | 472 | ||
473 | err = fprop_local_init_percpu(&bdi->completions); | 473 | err = fprop_local_init_percpu(&bdi->completions, GFP_KERNEL); |
474 | 474 | ||
475 | if (err) { | 475 | if (err) { |
476 | err: | 476 | err: |
diff --git a/mm/page-writeback.c b/mm/page-writeback.c index 91d73ef1744d..508599403721 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c | |||
@@ -1777,7 +1777,7 @@ void __init page_writeback_init(void) | |||
1777 | writeback_set_ratelimit(); | 1777 | writeback_set_ratelimit(); |
1778 | register_cpu_notifier(&ratelimit_nb); | 1778 | register_cpu_notifier(&ratelimit_nb); |
1779 | 1779 | ||
1780 | fprop_global_init(&writeout_completions); | 1780 | fprop_global_init(&writeout_completions, GFP_KERNEL); |
1781 | } | 1781 | } |
1782 | 1782 | ||
1783 | /** | 1783 | /** |