[Devel] [PATCH RHEL7 COMMIT] ms/treewide: Add __GFP_NOWARN to k.alloc calls with v.alloc fallbacks
Konstantin Khorenko
khorenko at virtuozzo.com
Thu Oct 31 13:34:01 MSK 2019
The commit is pushed to "branch-rh7-3.10.0-1062.4.1.vz7.115.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1062.4.1.vz7.115.5
------>
commit 5099e20465186b5a7574ed607ddb558d1cc16f12
Author: Joe Perches <joe at perches.com>
Date: Wed Jun 19 12:15:53 2013 -0700
ms/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 at perches.com>
Acked-by: "Theodore Ts'o" <tytso at mit.edu>
Signed-off-by: Jiri Kosina <jkosina at suse.cz>
https://jira.sw.ru/browse/PSBM-99042
(cherry picked from commit 8be04b9374e59923fa337766aaa74151b95b7099)
Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
Backport notice: several hunks of the original patch were
dropped because RHEL7 kernel does not have v.alloc fallbacks
in those places yet.
---
drivers/block/drbd/drbd_bitmap.c | 2 +-
drivers/infiniband/hw/ehca/ipz_pt_fn.c | 3 ++-
fs/ext4/super.c | 4 ++--
fs/gfs2/dir.c | 2 +-
4 files changed, 6 insertions(+), 5 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)
* we must not block on IO to ourselves.
* Context is receiver thread or dmsetup. */
bytes = sizeof(struct page *)*want;
- new_pages = kzalloc(bytes, GFP_NOIO);
+ new_pages = kzalloc(bytes, GFP_NOIO | __GFP_NOWARN);
if (!new_pages) {
new_pages = __vmalloc(bytes,
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 66beaea90e3c..7ffc748cb973 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,
queue->small_page = NULL;
/* allocate queue page pointers */
- queue->queue_pages = kzalloc(nr_of_pages * sizeof(void *), GFP_KERNEL);
+ queue->queue_pages = kzalloc(nr_of_pages * sizeof(void *),
+ GFP_KERNEL | __GFP_NOWARN);
if (!queue->queue_pages) {
queue->queue_pages = vzalloc(nr_of_pages * sizeof(void *));
if (!queue->queue_pages) {
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 846eaafd9c3c..ac8c95513a87 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -162,7 +162,7 @@ void *ext4_kvmalloc(size_t size, gfp_t flags)
{
void *ret;
- ret = kmalloc(size, flags);
+ ret = kmalloc(size, flags | __GFP_NOWARN);
if (!ret)
ret = __vmalloc(size, flags, PAGE_KERNEL);
return ret;
@@ -172,7 +172,7 @@ void *ext4_kvzalloc(size_t size, gfp_t flags)
{
void *ret;
- ret = kzalloc(size, flags);
+ ret = kzalloc(size, flags | __GFP_NOWARN);
if (!ret)
ret = __vmalloc(size, flags | __GFP_ZERO, PAGE_KERNEL);
return ret;
diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c
index 25056e88a1cc..b02bd385ea7a 100644
--- a/fs/gfs2/dir.c
+++ b/fs/gfs2/dir.c
@@ -2001,7 +2001,7 @@ static int leaf_dealloc(struct gfs2_inode *dip, u32 index, u32 len,
memset(&rlist, 0, sizeof(struct gfs2_rgrp_list));
- ht = kzalloc(size, GFP_NOFS);
+ ht = kzalloc(size, GFP_NOFS | __GFP_NOWARN);
if (ht == NULL)
ht = vzalloc(size);
if (!ht)
More information about the Devel
mailing list