(no subject)

Submitted by Konstantin Khorenko on Oct. 26, 2018, 9:08 a.m.

Details

Message ID 201810260908.w9Q98vkG024038@finist-ce7.sw.ru
State New
Series "(no subject)"
Headers show

Commit Message

Konstantin Khorenko Oct. 26, 2018, 9:08 a.m.
X-MS-Exchange-Organization-Network-992c470c-60c7-436e-e753-08d639be5813
X-MS-Exchange-CrossTenant-Network-992c470c-60c7-436e-e753-08d639be5813
Subject: [PATCH RHEL7 COMMIT] use kvzalloc for swap_info_struct allocation

The commit is pushed to "branch-rh7-3.10.0-957.1.1.vz7.81.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-957.1.1.vz7.81.1
------>
commit c1d41082a73fa2e1e687048115f606c505b49f5a
Author: Vasily Averin <vvs@virtuozzo.com>
Date:   Fri Oct 26 12:08:33 2018 +0300

    use kvzalloc for swap_info_struct allocation
    
    commit a2468cc9bfdff613 ("swap: choose swap device according to numa node")
    increased size of swap_info_struct up to 44 Kbytes,
    now its allocation requires 4th order page.
    
    Switch to kvzmalloc allows to decrease memory pressure and avoid possible failures.
    https://jira.sw.ru/browse/PSBM-89600
    
    Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
    Acked-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
 mm/swapfile.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Patch hide | download patch | download mbox

diff --git a/mm/swapfile.c b/mm/swapfile.c
index 176862d993d1..14043e6bf776 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -2494,7 +2494,7 @@  static struct swap_info_struct *alloc_swap_info(void)
 	unsigned int type;
 	int i;
 
-	p = kzalloc(sizeof(*p), GFP_KERNEL);
+	p = kvzalloc(sizeof(*p), GFP_KERNEL);
 	if (!p)
 		return ERR_PTR(-ENOMEM);
 
@@ -2505,7 +2505,7 @@  static struct swap_info_struct *alloc_swap_info(void)
 	}
 	if (type >= MAX_SWAPFILES) {
 		spin_unlock(&swap_lock);
-		kfree(p);
+		kvfree(p);
 		return ERR_PTR(-EPERM);
 	}
 	if (type >= nr_swapfiles) {
@@ -2519,7 +2519,7 @@  static struct swap_info_struct *alloc_swap_info(void)
 		smp_wmb();
 		nr_swapfiles++;
 	} else {
-		kfree(p);
+		kvfree(p);
 		p = swap_info[type];
 		/*
 		 * Do not memset this entry: a racing procfs swap_next()