Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2959944imu; Mon, 19 Nov 2018 08:38:56 -0800 (PST) X-Google-Smtp-Source: AJdET5ftV1O0Gv+3yTXHYDJ9IblwSeSh6Xvm1OM3G4tnPPP4xy3JQVpqFtwZnpMdP9ZKG2UUAdQT X-Received: by 2002:a62:2606:: with SMTP id m6mr7697670pfm.133.1542645536653; Mon, 19 Nov 2018 08:38:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542645536; cv=none; d=google.com; s=arc-20160816; b=cR/1FDJ1rCQ3S0eBfFXVFvmqps0tk+07NJRb3SiYV8sGA7GXyOYij/7JvBNYcUN7RB kvCbU6ai2KXB7G1Yeu5e0VCiMJForAKMu7tGHPzXNVgH9wwUK5dFaqepCIDEko3XgIl5 wh995uCBT9kupSyZ0nq8pHYu31Q3zwy8P+u4L69AmlgQvLOTGuQSDsIR3kCjIPSj6xt+ 4iazEmITOx7rMGvOXNjZIvsJqAx8E3s50XBVDS9WDoL4nrMN7WWP3x5kd/bBO/VmJdhS +dd+7CplsMfCMHH1Zl9179yyfmksURYzKFksvmnmPMdoH7a+pySGixt65g5NRpDobNhL VBSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=seAs2EWN81DcRU2U2zYyMW6maiVMVL14zuylOgFmxVw=; b=p/UeSe/jGEHsTrkPWmcdTsk3bcbCMbNqyTQeQ2OK6uDiWcUdFxQXrl9AyoWcubDYC/ MoIN6mv//3l80kwIptu4NSZePiwg5aEIQp1CoCoE9wOatvbU9UtlvljZN6aSA1Cyvr0L UAJEn7vTA6Vxort3qsokVQB7LZmncUC1P1N3qOaz4pa6pgmoO8aogkwKw6+/Bc1LJlo5 3avb7oFJhR+RJhvH5sepR2zUfs9lCaItI1PfOLVJFDFVyvkFnMJ7Wdkj3bSZf9QIaNyT t+BEDBjdf+V7fx6XddiljeSuVsoa8/aqED4YsotsqNWhjvPpnzmj5ligwCmLySb6JjWc k3hQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=l91t4C0I; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v5si13202798pfe.52.2018.11.19.08.38.41; Mon, 19 Nov 2018 08:38:56 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=l91t4C0I; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732258AbeKTDBq (ORCPT + 99 others); Mon, 19 Nov 2018 22:01:46 -0500 Received: from mail.kernel.org ([198.145.29.99]:33822 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731329AbeKTDBp (ORCPT ); Mon, 19 Nov 2018 22:01:45 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8905E2086A; Mon, 19 Nov 2018 16:37:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1542645456; bh=ji7BhfbsUzbsVyFokeQElb+JueKoaq9hznEkUp1m/zU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l91t4C0IA4xj9V54ex3hA3VCkSl6k2xLqTNr2BvBGZKO4ll/QhFDsgbPP7IyX7dTO qHl/VNaeYtbGPT6g/idkIOXvgKoY+B6mfrdpCqqkOcDB2M2DHP7XECrfMr/xF0Th9C gsaEMzcESxwzf1tGl0cQlQXoduu5AnYHMUT5iRng= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vasily Averin , Aaron Lu , Michal Hocko , Andrew Morton , Huang Ying , Linus Torvalds Subject: [PATCH 4.19 169/205] mm/swapfile.c: use kvzalloc for swap_info_struct allocation Date: Mon, 19 Nov 2018 17:27:56 +0100 Message-Id: <20181119162640.330953682@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181119162616.586062722@linuxfoundation.org> References: <20181119162616.586062722@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Vasily Averin commit 873d7bcfd066663e3e50113dc4a0de19289b6354 upstream. Commit a2468cc9bfdf ("swap: choose swap device according to numa node") changed 'avail_lists' field of 'struct swap_info_struct' to an array. In popular linux distros it increased size of swap_info_struct up to 40 Kbytes and now swap_info_struct allocation requires order-4 page. Switch to kvzmalloc allows to avoid unexpected allocation failures. Link: http://lkml.kernel.org/r/fc23172d-3c75-21e2-d551-8b1808cbe593@virtuozzo.com Fixes: a2468cc9bfdf ("swap: choose swap device according to numa node") Signed-off-by: Vasily Averin Acked-by: Aaron Lu Acked-by: Michal Hocko Reviewed-by: Andrew Morton Cc: Huang Ying Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- mm/swapfile.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -2820,7 +2820,7 @@ static struct swap_info_struct *alloc_sw unsigned int type; int i; - p = kzalloc(sizeof(*p), GFP_KERNEL); + p = kvzalloc(sizeof(*p), GFP_KERNEL); if (!p) return ERR_PTR(-ENOMEM); @@ -2831,7 +2831,7 @@ static struct swap_info_struct *alloc_sw } if (type >= MAX_SWAPFILES) { spin_unlock(&swap_lock); - kfree(p); + kvfree(p); return ERR_PTR(-EPERM); } if (type >= nr_swapfiles) { @@ -2845,7 +2845,7 @@ static struct swap_info_struct *alloc_sw smp_wmb(); nr_swapfiles++; } else { - kfree(p); + kvfree(p); p = swap_info[type]; /* * Do not memset this entry: a racing procfs swap_next()