diff options
author | Tejun Heo <tj@kernel.org> | 2014-09-07 20:51:29 -0400 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2014-09-07 20:51:29 -0400 |
commit | 908c7f1949cb7cc6e92ba8f18f2998e87e265b8e (patch) | |
tree | af885c65c6fe794cab7b7ad37bd811531a2a2ac5 | |
parent | ebd8fef304f99da84d4a52ad056f6137ac9652d4 (diff) |
percpu_counter: add @gfp to percpu_counter_init()
Percpu allocator now supports allocation mask. Add @gfp to
percpu_counter_init() so that !GFP_KERNEL allocation masks can be used
with percpu_counters too.
We could have left percpu_counter_init() alone and added
percpu_counter_init_gfp(); however, the number of users isn't that
high and introducing _gfp variants to all percpu data structures would
be quite ugly, so let's just do the conversion. This is the one with
the most users. Other percpu data structures are a lot easier to
convert.
This patch doesn't make any functional difference.
Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Jan Kara <jack@suse.cz>
Acked-by: "David S. Miller" <davem@davemloft.net>
Cc: x86@kernel.org
Cc: Jens Axboe <axboe@kernel.dk>
Cc: "Theodore Ts'o" <tytso@mit.edu>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Andrew Morton <akpm@linux-foundation.org>
-rw-r--r-- | arch/x86/kvm/mmu.c | 2 | ||||
-rw-r--r-- | fs/btrfs/disk-io.c | 8 | ||||
-rw-r--r-- | fs/btrfs/extent-tree.c | 2 | ||||
-rw-r--r-- | fs/ext2/super.c | 6 | ||||
-rw-r--r-- | fs/ext3/super.c | 6 | ||||
-rw-r--r-- | fs/ext4/super.c | 14 | ||||
-rw-r--r-- | fs/file_table.c | 2 | ||||
-rw-r--r-- | fs/quota/dquot.c | 2 | ||||
-rw-r--r-- | fs/super.c | 3 | ||||
-rw-r--r-- | include/linux/percpu_counter.h | 10 | ||||
-rw-r--r-- | include/net/dst_ops.h | 2 | ||||
-rw-r--r-- | include/net/inet_frag.h | 2 | ||||
-rw-r--r-- | lib/flex_proportions.c | 4 | ||||
-rw-r--r-- | lib/percpu_counter.c | 4 | ||||
-rw-r--r-- | lib/proportions.c | 6 | ||||
-rw-r--r-- | mm/backing-dev.c | 2 | ||||
-rw-r--r-- | mm/mmap.c | 2 | ||||
-rw-r--r-- | mm/nommu.c | 2 | ||||
-rw-r--r-- | mm/shmem.c | 2 | ||||
-rw-r--r-- | net/dccp/proto.c | 2 | ||||
-rw-r--r-- | net/ipv4/tcp.c | 4 | ||||
-rw-r--r-- | net/ipv4/tcp_memcontrol.c | 2 | ||||
-rw-r--r-- | net/sctp/protocol.c | 2 |
23 files changed, 49 insertions, 42 deletions
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 931467881da7..5bd53f206f4f 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c | |||
@@ -4534,7 +4534,7 @@ int kvm_mmu_module_init(void) | |||
4534 | if (!mmu_page_header_cache) | 4534 | if (!mmu_page_header_cache) |
4535 | goto nomem; | 4535 | goto nomem; |
4536 | 4536 | ||
4537 | if (percpu_counter_init(&kvm_total_used_mmu_pages, 0)) | 4537 | if (percpu_counter_init(&kvm_total_used_mmu_pages, 0, GFP_KERNEL)) |
4538 | goto nomem; | 4538 | goto nomem; |
4539 | 4539 | ||
4540 | register_shrinker(&mmu_shrinker); | 4540 | register_shrinker(&mmu_shrinker); |
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 08e65e9cf2aa..61dae01788d7 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -1180,7 +1180,7 @@ static struct btrfs_subvolume_writers *btrfs_alloc_subvolume_writers(void) | |||
1180 | if (!writers) | 1180 | if (!writers) |
1181 | return ERR_PTR(-ENOMEM); | 1181 | return ERR_PTR(-ENOMEM); |
1182 | 1182 | ||
1183 | ret = percpu_counter_init(&writers->counter, 0); | 1183 | ret = percpu_counter_init(&writers->counter, 0, GFP_KERNEL); |
1184 | if (ret < 0) { | 1184 | if (ret < 0) { |
1185 | kfree(writers); | 1185 | kfree(writers); |
1186 | return ERR_PTR(ret); | 1186 | return ERR_PTR(ret); |
@@ -2185,7 +2185,7 @@ int open_ctree(struct super_block *sb, | |||
2185 | goto fail_srcu; | 2185 | goto fail_srcu; |
2186 | } | 2186 | } |
2187 | 2187 | ||
2188 | ret = percpu_counter_init(&fs_info->dirty_metadata_bytes, 0); | 2188 | ret = percpu_counter_init(&fs_info->dirty_metadata_bytes, 0, GFP_KERNEL); |
2189 | if (ret) { | 2189 | if (ret) { |
2190 | err = ret; | 2190 | err = ret; |
2191 | goto fail_bdi; | 2191 | goto fail_bdi; |
@@ -2193,13 +2193,13 @@ int open_ctree(struct super_block *sb, | |||
2193 | fs_info->dirty_metadata_batch = PAGE_CACHE_SIZE * | 2193 | fs_info->dirty_metadata_batch = PAGE_CACHE_SIZE * |
2194 | (1 + ilog2(nr_cpu_ids)); | 2194 | (1 + ilog2(nr_cpu_ids)); |
2195 | 2195 | ||
2196 | ret = percpu_counter_init(&fs_info->delalloc_bytes, 0); | 2196 | ret = percpu_counter_init(&fs_info->delalloc_bytes, 0, GFP_KERNEL); |
2197 | if (ret) { | 2197 | if (ret) { |
2198 | err = ret; | 2198 | err = ret; |
2199 | goto fail_dirty_metadata_bytes; | 2199 | goto fail_dirty_metadata_bytes; |
2200 | } | 2200 | } |
2201 | 2201 | ||
2202 | ret = percpu_counter_init(&fs_info->bio_counter, 0); | 2202 | ret = percpu_counter_init(&fs_info->bio_counter, 0, GFP_KERNEL); |
2203 | if (ret) { | 2203 | if (ret) { |
2204 | err = ret; | 2204 | err = ret; |
2205 | goto fail_delalloc_bytes; | 2205 | goto fail_delalloc_bytes; |
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 813537f362f9..94ec71eda86b 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -3493,7 +3493,7 @@ static int update_space_info(struct btrfs_fs_info *info, u64 flags, | |||
3493 | if (!found) | 3493 | if (!found) |
3494 | return -ENOMEM; | 3494 | return -ENOMEM; |
3495 | 3495 | ||
3496 | ret = percpu_counter_init(&found->total_bytes_pinned, 0); | 3496 | ret = percpu_counter_init(&found->total_bytes_pinned, 0, GFP_KERNEL); |
3497 | if (ret) { | 3497 | if (ret) { |
3498 | kfree(found); | 3498 | kfree(found); |
3499 | return ret; | 3499 | return ret; |
diff --git a/fs/ext2/super.c b/fs/ext2/super.c index b88edc05c230..170dc41e8bf4 100644 --- a/fs/ext2/super.c +++ b/fs/ext2/super.c | |||
@@ -1067,14 +1067,14 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) | |||
1067 | ext2_rsv_window_add(sb, &sbi->s_rsv_window_head); | 1067 | ext2_rsv_window_add(sb, &sbi->s_rsv_window_head); |
1068 | 1068 | ||
1069 | err = percpu_counter_init(&sbi->s_freeblocks_counter, | 1069 | err = percpu_counter_init(&sbi->s_freeblocks_counter, |
1070 | ext2_count_free_blocks(sb)); | 1070 | ext2_count_free_blocks(sb), GFP_KERNEL); |
1071 | if (!err) { | 1071 | if (!err) { |
1072 | err = percpu_counter_init(&sbi->s_freeinodes_counter, | 1072 | err = percpu_counter_init(&sbi->s_freeinodes_counter, |
1073 | ext2_count_free_inodes(sb)); | 1073 | ext2_count_free_inodes(sb), GFP_KERNEL); |
1074 | } | 1074 | } |
1075 | if (!err) { | 1075 | if (!err) { |
1076 | err = percpu_counter_init(&sbi->s_dirs_counter, | 1076 | err = percpu_counter_init(&sbi->s_dirs_counter, |
1077 | ext2_count_dirs(sb)); | 1077 | ext2_count_dirs(sb), GFP_KERNEL); |
1078 | } | 1078 | } |
1079 | if (err) { | 1079 | if (err) { |
1080 | ext2_msg(sb, KERN_ERR, "error: insufficient memory"); | 1080 | ext2_msg(sb, KERN_ERR, "error: insufficient memory"); |
diff --git a/fs/ext3/super.c b/fs/ext3/super.c index 08cdfe5461e3..eba021b88440 100644 --- a/fs/ext3/super.c +++ b/fs/ext3/super.c | |||
@@ -2039,14 +2039,14 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent) | |||
2039 | goto failed_mount2; | 2039 | goto failed_mount2; |
2040 | } | 2040 | } |
2041 | err = percpu_counter_init(&sbi->s_freeblocks_counter, | 2041 | err = percpu_counter_init(&sbi->s_freeblocks_counter, |
2042 | ext3_count_free_blocks(sb)); | 2042 | ext3_count_free_blocks(sb), GFP_KERNEL); |
2043 | if (!err) { | 2043 | if (!err) { |
2044 | err = percpu_counter_init(&sbi->s_freeinodes_counter, | 2044 | err = percpu_counter_init(&sbi->s_freeinodes_counter, |
2045 | ext3_count_free_inodes(sb)); | 2045 | ext3_count_free_inodes(sb), GFP_KERNEL); |
2046 | } | 2046 | } |
2047 | if (!err) { | 2047 | if (!err) { |
2048 | err = percpu_counter_init(&sbi->s_dirs_counter, | 2048 | err = percpu_counter_init(&sbi->s_dirs_counter, |
2049 | ext3_count_dirs(sb)); | 2049 | ext3_count_dirs(sb), GFP_KERNEL); |
2050 | } | 2050 | } |
2051 | if (err) { | 2051 | if (err) { |
2052 | ext3_msg(sb, KERN_ERR, "error: insufficient memory"); | 2052 | ext3_msg(sb, KERN_ERR, "error: insufficient memory"); |
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 32b43ad154b9..e25ca8fdde7d 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -3891,7 +3891,8 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) | |||
3891 | /* Register extent status tree shrinker */ | 3891 | /* Register extent status tree shrinker */ |
3892 | ext4_es_register_shrinker(sbi); | 3892 | ext4_es_register_shrinker(sbi); |
3893 | 3893 | ||
3894 | if ((err = percpu_counter_init(&sbi->s_extent_cache_cnt, 0)) != 0) { | 3894 | err = percpu_counter_init(&sbi->s_extent_cache_cnt, 0, GFP_KERNEL); |
3895 | if (err) { | ||
3895 | ext4_msg(sb, KERN_ERR, "insufficient memory"); | 3896 | ext4_msg(sb, KERN_ERR, "insufficient memory"); |
3896 | goto failed_mount3; | 3897 | goto failed_mount3; |
3897 | } | 3898 | } |
@@ -4105,17 +4106,20 @@ no_journal: | |||
4105 | block = ext4_count_free_clusters(sb); | 4106 | block = ext4_count_free_clusters(sb); |
4106 | ext4_free_blocks_count_set(sbi->s_es, | 4107 | ext4_free_blocks_count_set(sbi->s_es, |
4107 | EXT4_C2B(sbi, block)); | 4108 | EXT4_C2B(sbi, block)); |
4108 | err = percpu_counter_init(&sbi->s_freeclusters_counter, block); | 4109 | err = percpu_counter_init(&sbi->s_freeclusters_counter, block, |
4110 | GFP_KERNEL); | ||
4109 | if (!err) { | 4111 | if (!err) { |
4110 | unsigned long freei = ext4_count_free_inodes(sb); | 4112 | unsigned long freei = ext4_count_free_inodes(sb); |
4111 | sbi->s_es->s_free_inodes_count = cpu_to_le32(freei); | 4113 | sbi->s_es->s_free_inodes_count = cpu_to_le32(freei); |
4112 | err = percpu_counter_init(&sbi->s_freeinodes_counter, freei); | 4114 | err = percpu_counter_init(&sbi->s_freeinodes_counter, freei, |
4115 | GFP_KERNEL); | ||
4113 | } | 4116 | } |
4114 | if (!err) | 4117 | if (!err) |
4115 | err = percpu_counter_init(&sbi->s_dirs_counter, | 4118 | err = percpu_counter_init(&sbi->s_dirs_counter, |
4116 | ext4_count_dirs(sb)); | 4119 | ext4_count_dirs(sb), GFP_KERNEL); |
4117 | if (!err) | 4120 | if (!err) |
4118 | err = percpu_counter_init(&sbi->s_dirtyclusters_counter, 0); | 4121 | err = percpu_counter_init(&sbi->s_dirtyclusters_counter, 0, |
4122 | GFP_KERNEL); | ||
4119 | if (err) { | 4123 | if (err) { |
4120 | ext4_msg(sb, KERN_ERR, "insufficient memory"); | 4124 | ext4_msg(sb, KERN_ERR, "insufficient memory"); |
4121 | goto failed_mount6; | 4125 | goto failed_mount6; |
diff --git a/fs/file_table.c b/fs/file_table.c index 385bfd31512a..0bab12b20460 100644 --- a/fs/file_table.c +++ b/fs/file_table.c | |||
@@ -331,5 +331,5 @@ void __init files_init(unsigned long mempages) | |||
331 | 331 | ||
332 | n = (mempages * (PAGE_SIZE / 1024)) / 10; | 332 | n = (mempages * (PAGE_SIZE / 1024)) / 10; |
333 | files_stat.max_files = max_t(unsigned long, n, NR_FILE); | 333 | files_stat.max_files = max_t(unsigned long, n, NR_FILE); |
334 | percpu_counter_init(&nr_files, 0); | 334 | percpu_counter_init(&nr_files, 0, GFP_KERNEL); |
335 | } | 335 | } |
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c index f2d0eee9d1f1..8b663b2d9562 100644 --- a/fs/quota/dquot.c +++ b/fs/quota/dquot.c | |||
@@ -2725,7 +2725,7 @@ static int __init dquot_init(void) | |||
2725 | panic("Cannot create dquot hash table"); | 2725 | panic("Cannot create dquot hash table"); |
2726 | 2726 | ||
2727 | for (i = 0; i < _DQST_DQSTAT_LAST; i++) { | 2727 | for (i = 0; i < _DQST_DQSTAT_LAST; i++) { |
2728 | ret = percpu_counter_init(&dqstats.counter[i], 0); | 2728 | ret = percpu_counter_init(&dqstats.counter[i], 0, GFP_KERNEL); |
2729 | if (ret) | 2729 | if (ret) |
2730 | panic("Cannot create dquot stat counters"); | 2730 | panic("Cannot create dquot stat counters"); |
2731 | } | 2731 | } |
diff --git a/fs/super.c b/fs/super.c index b9a214d2fe98..1b836107acee 100644 --- a/fs/super.c +++ b/fs/super.c | |||
@@ -175,7 +175,8 @@ static struct super_block *alloc_super(struct file_system_type *type, int flags) | |||
175 | goto fail; | 175 | goto fail; |
176 | 176 | ||
177 | for (i = 0; i < SB_FREEZE_LEVELS; i++) { | 177 | for (i = 0; i < SB_FREEZE_LEVELS; i++) { |
178 | if (percpu_counter_init(&s->s_writers.counter[i], 0) < 0) | 178 | if (percpu_counter_init(&s->s_writers.counter[i], 0, |
179 | GFP_KERNEL) < 0) | ||
179 | goto fail; | 180 | goto fail; |
180 | lockdep_init_map(&s->s_writers.lock_map[i], sb_writers_name[i], | 181 | lockdep_init_map(&s->s_writers.lock_map[i], sb_writers_name[i], |
181 | &type->s_writers_key[i], 0); | 182 | &type->s_writers_key[i], 0); |
diff --git a/include/linux/percpu_counter.h b/include/linux/percpu_counter.h index d5dd4657c8d6..50e50095c8d1 100644 --- a/include/linux/percpu_counter.h +++ b/include/linux/percpu_counter.h | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/threads.h> | 12 | #include <linux/threads.h> |
13 | #include <linux/percpu.h> | 13 | #include <linux/percpu.h> |
14 | #include <linux/types.h> | 14 | #include <linux/types.h> |
15 | #include <linux/gfp.h> | ||
15 | 16 | ||
16 | #ifdef CONFIG_SMP | 17 | #ifdef CONFIG_SMP |
17 | 18 | ||
@@ -26,14 +27,14 @@ struct percpu_counter { | |||
26 | 27 | ||
27 | extern int percpu_counter_batch; | 28 | extern int percpu_counter_batch; |
28 | 29 | ||
29 | int __percpu_counter_init(struct percpu_counter *fbc, s64 amount, | 30 | int __percpu_counter_init(struct percpu_counter *fbc, s64 amount, gfp_t gfp, |
30 | struct lock_class_key *key); | 31 | struct lock_class_key *key); |
31 | 32 | ||
32 | #define percpu_counter_init(fbc, value) \ | 33 | #define percpu_counter_init(fbc, value, gfp) \ |
33 | ({ \ | 34 | ({ \ |
34 | static struct lock_class_key __key; \ | 35 | static struct lock_class_key __key; \ |
35 | \ | 36 | \ |
36 | __percpu_counter_init(fbc, value, &__key); \ | 37 | __percpu_counter_init(fbc, value, gfp, &__key); \ |
37 | }) | 38 | }) |
38 | 39 | ||
39 | void percpu_counter_destroy(struct percpu_counter *fbc); | 40 | void percpu_counter_destroy(struct percpu_counter *fbc); |
@@ -89,7 +90,8 @@ struct percpu_counter { | |||
89 | s64 count; | 90 | s64 count; |
90 | }; | 91 | }; |
91 | 92 | ||
92 | static inline int percpu_counter_init(struct percpu_counter *fbc, s64 amount) | 93 | static inline int percpu_counter_init(struct percpu_counter *fbc, s64 amount, |
94 | gfp_t gfp) | ||
93 | { | 95 | { |
94 | fbc->count = amount; | 96 | fbc->count = amount; |
95 | return 0; | 97 | return 0; |
diff --git a/include/net/dst_ops.h b/include/net/dst_ops.h index 2f26dfb8450e..1f99a1de0e4f 100644 --- a/include/net/dst_ops.h +++ b/include/net/dst_ops.h | |||
@@ -63,7 +63,7 @@ static inline void dst_entries_add(struct dst_ops *dst, int val) | |||
63 | 63 | ||
64 | static inline int dst_entries_init(struct dst_ops *dst) | 64 | static inline int dst_entries_init(struct dst_ops *dst) |
65 | { | 65 | { |
66 | return percpu_counter_init(&dst->pcpuc_entries, 0); | 66 | return percpu_counter_init(&dst->pcpuc_entries, 0, GFP_KERNEL); |
67 | } | 67 | } |
68 | 68 | ||
69 | static inline void dst_entries_destroy(struct dst_ops *dst) | 69 | static inline void dst_entries_destroy(struct dst_ops *dst) |
diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h index 65a8855e99fe..8d1765577acc 100644 --- a/include/net/inet_frag.h +++ b/include/net/inet_frag.h | |||
@@ -151,7 +151,7 @@ static inline void add_frag_mem_limit(struct inet_frag_queue *q, int i) | |||
151 | 151 | ||
152 | static inline void init_frag_mem_limit(struct netns_frags *nf) | 152 | static inline void init_frag_mem_limit(struct netns_frags *nf) |
153 | { | 153 | { |
154 | percpu_counter_init(&nf->mem, 0); | 154 | percpu_counter_init(&nf->mem, 0, GFP_KERNEL); |
155 | } | 155 | } |
156 | 156 | ||
157 | static inline unsigned int sum_frag_mem_limit(struct netns_frags *nf) | 157 | static inline unsigned int sum_frag_mem_limit(struct netns_frags *nf) |
diff --git a/lib/flex_proportions.c b/lib/flex_proportions.c index ebf3bac460b0..b9d026bfcf38 100644 --- a/lib/flex_proportions.c +++ b/lib/flex_proportions.c | |||
@@ -40,7 +40,7 @@ int fprop_global_init(struct fprop_global *p) | |||
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); | 43 | err = percpu_counter_init(&p->events, 1, GFP_KERNEL); |
44 | if (err) | 44 | if (err) |
45 | return err; | 45 | return err; |
46 | seqcount_init(&p->sequence); | 46 | seqcount_init(&p->sequence); |
@@ -172,7 +172,7 @@ int fprop_local_init_percpu(struct fprop_local_percpu *pl) | |||
172 | { | 172 | { |
173 | int err; | 173 | int err; |
174 | 174 | ||
175 | err = percpu_counter_init(&pl->events, 0); | 175 | err = percpu_counter_init(&pl->events, 0, GFP_KERNEL); |
176 | if (err) | 176 | if (err) |
177 | return err; | 177 | return err; |
178 | pl->period = 0; | 178 | pl->period = 0; |
diff --git a/lib/percpu_counter.c b/lib/percpu_counter.c index 3fde78275cd1..48144cdae819 100644 --- a/lib/percpu_counter.c +++ b/lib/percpu_counter.c | |||
@@ -112,7 +112,7 @@ s64 __percpu_counter_sum(struct percpu_counter *fbc) | |||
112 | } | 112 | } |
113 | EXPORT_SYMBOL(__percpu_counter_sum); | 113 | EXPORT_SYMBOL(__percpu_counter_sum); |
114 | 114 | ||
115 | int __percpu_counter_init(struct percpu_counter *fbc, s64 amount, | 115 | int __percpu_counter_init(struct percpu_counter *fbc, s64 amount, gfp_t gfp, |
116 | struct lock_class_key *key) | 116 | struct lock_class_key *key) |
117 | { | 117 | { |
118 | unsigned long flags __maybe_unused; | 118 | unsigned long flags __maybe_unused; |
@@ -120,7 +120,7 @@ int __percpu_counter_init(struct percpu_counter *fbc, s64 amount, | |||
120 | raw_spin_lock_init(&fbc->lock); | 120 | raw_spin_lock_init(&fbc->lock); |
121 | lockdep_set_class(&fbc->lock, key); | 121 | lockdep_set_class(&fbc->lock, key); |
122 | fbc->count = amount; | 122 | fbc->count = amount; |
123 | fbc->counters = alloc_percpu(s32); | 123 | fbc->counters = alloc_percpu_gfp(s32, gfp); |
124 | if (!fbc->counters) | 124 | if (!fbc->counters) |
125 | return -ENOMEM; | 125 | return -ENOMEM; |
126 | 126 | ||
diff --git a/lib/proportions.c b/lib/proportions.c index 05df84801b56..ca95f8d54384 100644 --- a/lib/proportions.c +++ b/lib/proportions.c | |||
@@ -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); | 86 | err = percpu_counter_init(&pd->pg[0].events, 0, GFP_KERNEL); |
87 | if (err) | 87 | if (err) |
88 | goto out; | 88 | goto out; |
89 | 89 | ||
90 | err = percpu_counter_init(&pd->pg[1].events, 0); | 90 | err = percpu_counter_init(&pd->pg[1].events, 0, GFP_KERNEL); |
91 | if (err) | 91 | if (err) |
92 | percpu_counter_destroy(&pd->pg[0].events); | 92 | percpu_counter_destroy(&pd->pg[0].events); |
93 | 93 | ||
@@ -193,7 +193,7 @@ int prop_local_init_percpu(struct prop_local_percpu *pl) | |||
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); | 196 | return percpu_counter_init(&pl->events, 0, GFP_KERNEL); |
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 1706cbbdf5f0..f19a818be2d3 100644 --- a/mm/backing-dev.c +++ b/mm/backing-dev.c | |||
@@ -455,7 +455,7 @@ int bdi_init(struct backing_dev_info *bdi) | |||
455 | bdi_wb_init(&bdi->wb, bdi); | 455 | bdi_wb_init(&bdi->wb, bdi); |
456 | 456 | ||
457 | for (i = 0; i < NR_BDI_STAT_ITEMS; i++) { | 457 | for (i = 0; i < NR_BDI_STAT_ITEMS; i++) { |
458 | err = percpu_counter_init(&bdi->bdi_stat[i], 0); | 458 | err = percpu_counter_init(&bdi->bdi_stat[i], 0, GFP_KERNEL); |
459 | if (err) | 459 | if (err) |
460 | goto err; | 460 | goto err; |
461 | } | 461 | } |
@@ -3196,7 +3196,7 @@ void __init mmap_init(void) | |||
3196 | { | 3196 | { |
3197 | int ret; | 3197 | int ret; |
3198 | 3198 | ||
3199 | ret = percpu_counter_init(&vm_committed_as, 0); | 3199 | ret = percpu_counter_init(&vm_committed_as, 0, GFP_KERNEL); |
3200 | VM_BUG_ON(ret); | 3200 | VM_BUG_ON(ret); |
3201 | } | 3201 | } |
3202 | 3202 | ||
diff --git a/mm/nommu.c b/mm/nommu.c index a881d9673c6b..bd1808e194a7 100644 --- a/mm/nommu.c +++ b/mm/nommu.c | |||
@@ -539,7 +539,7 @@ void __init mmap_init(void) | |||
539 | { | 539 | { |
540 | int ret; | 540 | int ret; |
541 | 541 | ||
542 | ret = percpu_counter_init(&vm_committed_as, 0); | 542 | ret = percpu_counter_init(&vm_committed_as, 0, GFP_KERNEL); |
543 | VM_BUG_ON(ret); | 543 | VM_BUG_ON(ret); |
544 | vm_region_jar = KMEM_CACHE(vm_region, SLAB_PANIC); | 544 | vm_region_jar = KMEM_CACHE(vm_region, SLAB_PANIC); |
545 | } | 545 | } |
diff --git a/mm/shmem.c b/mm/shmem.c index 0e5fb225007c..d4bc55d3f107 100644 --- a/mm/shmem.c +++ b/mm/shmem.c | |||
@@ -2993,7 +2993,7 @@ int shmem_fill_super(struct super_block *sb, void *data, int silent) | |||
2993 | #endif | 2993 | #endif |
2994 | 2994 | ||
2995 | spin_lock_init(&sbinfo->stat_lock); | 2995 | spin_lock_init(&sbinfo->stat_lock); |
2996 | if (percpu_counter_init(&sbinfo->used_blocks, 0)) | 2996 | if (percpu_counter_init(&sbinfo->used_blocks, 0, GFP_KERNEL)) |
2997 | goto failed; | 2997 | goto failed; |
2998 | sbinfo->free_inodes = sbinfo->max_inodes; | 2998 | sbinfo->free_inodes = sbinfo->max_inodes; |
2999 | 2999 | ||
diff --git a/net/dccp/proto.c b/net/dccp/proto.c index de2c1e719305..e421eddf67b4 100644 --- a/net/dccp/proto.c +++ b/net/dccp/proto.c | |||
@@ -1115,7 +1115,7 @@ static int __init dccp_init(void) | |||
1115 | 1115 | ||
1116 | BUILD_BUG_ON(sizeof(struct dccp_skb_cb) > | 1116 | BUILD_BUG_ON(sizeof(struct dccp_skb_cb) > |
1117 | FIELD_SIZEOF(struct sk_buff, cb)); | 1117 | FIELD_SIZEOF(struct sk_buff, cb)); |
1118 | rc = percpu_counter_init(&dccp_orphan_count, 0); | 1118 | rc = percpu_counter_init(&dccp_orphan_count, 0, GFP_KERNEL); |
1119 | if (rc) | 1119 | if (rc) |
1120 | goto out_fail; | 1120 | goto out_fail; |
1121 | rc = -ENOBUFS; | 1121 | rc = -ENOBUFS; |
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 541f26a67ba2..d59c2604c247 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -3188,8 +3188,8 @@ void __init tcp_init(void) | |||
3188 | 3188 | ||
3189 | BUILD_BUG_ON(sizeof(struct tcp_skb_cb) > sizeof(skb->cb)); | 3189 | BUILD_BUG_ON(sizeof(struct tcp_skb_cb) > sizeof(skb->cb)); |
3190 | 3190 | ||
3191 | percpu_counter_init(&tcp_sockets_allocated, 0); | 3191 | percpu_counter_init(&tcp_sockets_allocated, 0, GFP_KERNEL); |
3192 | percpu_counter_init(&tcp_orphan_count, 0); | 3192 | percpu_counter_init(&tcp_orphan_count, 0, GFP_KERNEL); |
3193 | tcp_hashinfo.bind_bucket_cachep = | 3193 | tcp_hashinfo.bind_bucket_cachep = |
3194 | kmem_cache_create("tcp_bind_bucket", | 3194 | kmem_cache_create("tcp_bind_bucket", |
3195 | sizeof(struct inet_bind_bucket), 0, | 3195 | sizeof(struct inet_bind_bucket), 0, |
diff --git a/net/ipv4/tcp_memcontrol.c b/net/ipv4/tcp_memcontrol.c index 3af522622fad..1d191357bf88 100644 --- a/net/ipv4/tcp_memcontrol.c +++ b/net/ipv4/tcp_memcontrol.c | |||
@@ -32,7 +32,7 @@ int tcp_init_cgroup(struct mem_cgroup *memcg, struct cgroup_subsys *ss) | |||
32 | res_parent = &parent_cg->memory_allocated; | 32 | res_parent = &parent_cg->memory_allocated; |
33 | 33 | ||
34 | res_counter_init(&cg_proto->memory_allocated, res_parent); | 34 | res_counter_init(&cg_proto->memory_allocated, res_parent); |
35 | percpu_counter_init(&cg_proto->sockets_allocated, 0); | 35 | percpu_counter_init(&cg_proto->sockets_allocated, 0, GFP_KERNEL); |
36 | 36 | ||
37 | return 0; | 37 | return 0; |
38 | } | 38 | } |
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c index 6240834f4b95..f00a85a3fddd 100644 --- a/net/sctp/protocol.c +++ b/net/sctp/protocol.c | |||
@@ -1341,7 +1341,7 @@ static __init int sctp_init(void) | |||
1341 | if (!sctp_chunk_cachep) | 1341 | if (!sctp_chunk_cachep) |
1342 | goto err_chunk_cachep; | 1342 | goto err_chunk_cachep; |
1343 | 1343 | ||
1344 | status = percpu_counter_init(&sctp_sockets_allocated, 0); | 1344 | status = percpu_counter_init(&sctp_sockets_allocated, 0, GFP_KERNEL); |
1345 | if (status) | 1345 | if (status) |
1346 | goto err_percpu_counter_init; | 1346 | goto err_percpu_counter_init; |
1347 | 1347 | ||