diff options
author | Joe Perches <joe@perches.com> | 2013-06-19 15:15:53 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2013-08-20 07:06:40 -0400 |
commit | 8be04b9374e59923fa337766aaa74151b95b7099 (patch) | |
tree | 7491f7f6a9ebeb9f78ed41a94591ffd70e99b870 | |
parent | 85dbe706074c8b9091a3bc5f24eff02a044701c3 (diff) |
treewide: Add __GFP_NOWARN to k.alloc calls with v.alloc fallbacks
Don't emit OOM warnings when k.alloc calls fail when
there there is a v.alloc immediately afterwards.
Converted a kmalloc/vmalloc with memset to kzalloc/vzalloc.
Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-rw-r--r-- | drivers/block/drbd/drbd_bitmap.c | 2 | ||||
-rw-r--r-- | drivers/infiniband/hw/ehca/ipz_pt_fn.c | 3 | ||||
-rw-r--r-- | drivers/net/ethernet/chelsio/cxgb3/cxgb3_offload.c | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 2 | ||||
-rw-r--r-- | drivers/scsi/cxgbi/libcxgbi.h | 8 | ||||
-rw-r--r-- | fs/btrfs/send.c | 2 | ||||
-rw-r--r-- | fs/ext4/super.c | 4 | ||||
-rw-r--r-- | fs/gfs2/dir.c | 2 | ||||
-rw-r--r-- | net/sched/sch_choke.c | 3 |
9 files changed, 15 insertions, 13 deletions
diff --git a/drivers/block/drbd/drbd_bitmap.c b/drivers/block/drbd/drbd_bitmap.c index 64fbb8385cdc..b12c11ec4bd2 100644 --- a/drivers/block/drbd/drbd_bitmap.c +++ b/drivers/block/drbd/drbd_bitmap.c | |||
@@ -393,7 +393,7 @@ static struct page **bm_realloc_pages(struct drbd_bitmap *b, unsigned long want) | |||
393 | * we must not block on IO to ourselves. | 393 | * we must not block on IO to ourselves. |
394 | * Context is receiver thread or dmsetup. */ | 394 | * Context is receiver thread or dmsetup. */ |
395 | bytes = sizeof(struct page *)*want; | 395 | bytes = sizeof(struct page *)*want; |
396 | new_pages = kzalloc(bytes, GFP_NOIO); | 396 | new_pages = kzalloc(bytes, GFP_NOIO | __GFP_NOWARN); |
397 | if (!new_pages) { | 397 | if (!new_pages) { |
398 | new_pages = __vmalloc(bytes, | 398 | new_pages = __vmalloc(bytes, |
399 | GFP_NOIO | __GFP_HIGHMEM | __GFP_ZERO, | 399 | GFP_NOIO | __GFP_HIGHMEM | __GFP_ZERO, |
diff --git a/drivers/infiniband/hw/ehca/ipz_pt_fn.c b/drivers/infiniband/hw/ehca/ipz_pt_fn.c index 62c71fadb4d9..8d594517cd29 100644 --- a/drivers/infiniband/hw/ehca/ipz_pt_fn.c +++ b/drivers/infiniband/hw/ehca/ipz_pt_fn.c | |||
@@ -222,7 +222,8 @@ int ipz_queue_ctor(struct ehca_pd *pd, struct ipz_queue *queue, | |||
222 | queue->small_page = NULL; | 222 | queue->small_page = NULL; |
223 | 223 | ||
224 | /* allocate queue page pointers */ | 224 | /* allocate queue page pointers */ |
225 | queue->queue_pages = kzalloc(nr_of_pages * sizeof(void *), GFP_KERNEL); | 225 | queue->queue_pages = kzalloc(nr_of_pages * sizeof(void *), |
226 | GFP_KERNEL | __GFP_NOWARN); | ||
226 | if (!queue->queue_pages) { | 227 | if (!queue->queue_pages) { |
227 | queue->queue_pages = vzalloc(nr_of_pages * sizeof(void *)); | 228 | queue->queue_pages = vzalloc(nr_of_pages * sizeof(void *)); |
228 | if (!queue->queue_pages) { | 229 | if (!queue->queue_pages) { |
diff --git a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_offload.c b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_offload.c index 4058b856eb71..76ae09999b5b 100644 --- a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_offload.c +++ b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_offload.c | |||
@@ -1157,7 +1157,7 @@ static void cxgb_redirect(struct dst_entry *old, struct dst_entry *new, | |||
1157 | */ | 1157 | */ |
1158 | void *cxgb_alloc_mem(unsigned long size) | 1158 | void *cxgb_alloc_mem(unsigned long size) |
1159 | { | 1159 | { |
1160 | void *p = kzalloc(size, GFP_KERNEL); | 1160 | void *p = kzalloc(size, GFP_KERNEL | __GFP_NOWARN); |
1161 | 1161 | ||
1162 | if (!p) | 1162 | if (!p) |
1163 | p = vzalloc(size); | 1163 | p = vzalloc(size); |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c index 5a3256b083f2..5d5f2685ee2b 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | |||
@@ -1133,7 +1133,7 @@ out: release_firmware(fw); | |||
1133 | */ | 1133 | */ |
1134 | void *t4_alloc_mem(size_t size) | 1134 | void *t4_alloc_mem(size_t size) |
1135 | { | 1135 | { |
1136 | void *p = kzalloc(size, GFP_KERNEL); | 1136 | void *p = kzalloc(size, GFP_KERNEL | __GFP_NOWARN); |
1137 | 1137 | ||
1138 | if (!p) | 1138 | if (!p) |
1139 | p = vzalloc(size); | 1139 | p = vzalloc(size); |
diff --git a/drivers/scsi/cxgbi/libcxgbi.h b/drivers/scsi/cxgbi/libcxgbi.h index 80fa99b3d384..8135f04671af 100644 --- a/drivers/scsi/cxgbi/libcxgbi.h +++ b/drivers/scsi/cxgbi/libcxgbi.h | |||
@@ -658,11 +658,11 @@ static inline u32 cxgbi_tag_nonrsvd_bits(struct cxgbi_tag_format *tformat, | |||
658 | static inline void *cxgbi_alloc_big_mem(unsigned int size, | 658 | static inline void *cxgbi_alloc_big_mem(unsigned int size, |
659 | gfp_t gfp) | 659 | gfp_t gfp) |
660 | { | 660 | { |
661 | void *p = kmalloc(size, gfp); | 661 | void *p = kzalloc(size, gfp | __GFP_NOWARN); |
662 | |||
662 | if (!p) | 663 | if (!p) |
663 | p = vmalloc(size); | 664 | p = vzalloc(size); |
664 | if (p) | 665 | |
665 | memset(p, 0, size); | ||
666 | return p; | 666 | return p; |
667 | } | 667 | } |
668 | 668 | ||
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c index d3f3b43cae0b..2e14fd89a8b4 100644 --- a/fs/btrfs/send.c +++ b/fs/btrfs/send.c | |||
@@ -219,7 +219,7 @@ static int fs_path_ensure_buf(struct fs_path *p, int len) | |||
219 | len = PAGE_ALIGN(len); | 219 | len = PAGE_ALIGN(len); |
220 | 220 | ||
221 | if (p->buf == p->inline_buf) { | 221 | if (p->buf == p->inline_buf) { |
222 | tmp_buf = kmalloc(len, GFP_NOFS); | 222 | tmp_buf = kmalloc(len, GFP_NOFS | __GFP_NOWARN); |
223 | if (!tmp_buf) { | 223 | if (!tmp_buf) { |
224 | tmp_buf = vmalloc(len); | 224 | tmp_buf = vmalloc(len); |
225 | if (!tmp_buf) | 225 | if (!tmp_buf) |
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index bca26f34edf4..ffdfe385b029 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -162,7 +162,7 @@ void *ext4_kvmalloc(size_t size, gfp_t flags) | |||
162 | { | 162 | { |
163 | void *ret; | 163 | void *ret; |
164 | 164 | ||
165 | ret = kmalloc(size, flags); | 165 | ret = kmalloc(size, flags | __GFP_NOWARN); |
166 | if (!ret) | 166 | if (!ret) |
167 | ret = __vmalloc(size, flags, PAGE_KERNEL); | 167 | ret = __vmalloc(size, flags, PAGE_KERNEL); |
168 | return ret; | 168 | return ret; |
@@ -172,7 +172,7 @@ void *ext4_kvzalloc(size_t size, gfp_t flags) | |||
172 | { | 172 | { |
173 | void *ret; | 173 | void *ret; |
174 | 174 | ||
175 | ret = kzalloc(size, flags); | 175 | ret = kzalloc(size, flags | __GFP_NOWARN); |
176 | if (!ret) | 176 | if (!ret) |
177 | ret = __vmalloc(size, flags | __GFP_ZERO, PAGE_KERNEL); | 177 | ret = __vmalloc(size, flags | __GFP_ZERO, PAGE_KERNEL); |
178 | return ret; | 178 | return ret; |
diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c index 0cb4c1557f20..2e5fc268d324 100644 --- a/fs/gfs2/dir.c +++ b/fs/gfs2/dir.c | |||
@@ -1859,7 +1859,7 @@ static int leaf_dealloc(struct gfs2_inode *dip, u32 index, u32 len, | |||
1859 | 1859 | ||
1860 | memset(&rlist, 0, sizeof(struct gfs2_rgrp_list)); | 1860 | memset(&rlist, 0, sizeof(struct gfs2_rgrp_list)); |
1861 | 1861 | ||
1862 | ht = kzalloc(size, GFP_NOFS); | 1862 | ht = kzalloc(size, GFP_NOFS | __GFP_NOWARN); |
1863 | if (ht == NULL) | 1863 | if (ht == NULL) |
1864 | ht = vzalloc(size); | 1864 | ht = vzalloc(size); |
1865 | if (!ht) | 1865 | if (!ht) |
diff --git a/net/sched/sch_choke.c b/net/sched/sch_choke.c index ef53ab8d0aae..ddd73cb2d7ba 100644 --- a/net/sched/sch_choke.c +++ b/net/sched/sch_choke.c | |||
@@ -438,7 +438,8 @@ static int choke_change(struct Qdisc *sch, struct nlattr *opt) | |||
438 | if (mask != q->tab_mask) { | 438 | if (mask != q->tab_mask) { |
439 | struct sk_buff **ntab; | 439 | struct sk_buff **ntab; |
440 | 440 | ||
441 | ntab = kcalloc(mask + 1, sizeof(struct sk_buff *), GFP_KERNEL); | 441 | ntab = kcalloc(mask + 1, sizeof(struct sk_buff *), |
442 | GFP_KERNEL | __GFP_NOWARN); | ||
442 | if (!ntab) | 443 | if (!ntab) |
443 | ntab = vzalloc((mask + 1) * sizeof(struct sk_buff *)); | 444 | ntab = vzalloc((mask + 1) * sizeof(struct sk_buff *)); |
444 | if (!ntab) | 445 | if (!ntab) |