Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1322486ybv; Thu, 20 Feb 2020 17:54:46 -0800 (PST) X-Google-Smtp-Source: APXvYqwpujMVd6NNzGF6jku+q7PfoRWcu9yTkZ7TQ+dsrObJ3G5zAXAD/IpuBXPlfvv/imfRz0GX X-Received: by 2002:a9d:ecc:: with SMTP id 70mr25149631otj.182.1582250086656; Thu, 20 Feb 2020 17:54:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582250086; cv=none; d=google.com; s=arc-20160816; b=sS9imtJ0LizfbN+rqGxV0exC1af3F7O8lO0Crg8isYxUaGa+bs4bW5B4iEdreVAiNA dPQRf/Yx4qEz48iajTsJnVuhgSCP+rPT1i4KOB61E3zUVqz/vPfN4ywKoo8SuGx5yL8g kLWNV1yU2C/iJZUMz9Q2NOxCYjwqEHW2Y0T8eMoRZW9ErkGX5YTI41hH/Uyl4krYhWKa EbpLzIlszTr18xr15LapVJUHMZO7xnsdMuMFaeqB5bHwaqCE62zmx081CvmaHb6MQ5lQ aMg2u9pUcuBcf7AXd45NzqIeBjhdzrrEJMlA8B3kaeVJ56dAMKUtjUtoXGKUeymBDYdu CIwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:dkim-signature:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=ZgqXP5uwpGcW0RceBT61zrwGEA5iC5CnbKuv9h2cRIU=; b=xVFNqHt9+PlvdOAKTlgDv3HgWJyx0DMh6UW1jXi6/ivJnQI7fttkEAaFEm389qyxkS 6JHsGMgha+qam3WAoF5UAdd1IgP/twk8pMED8IT+OLQmsip5+eFyaa1crP2r+yUsssbv h3Pv2P9wmg1iNj3+rUdXKTYgnolKR/uIzD8ki3quqnfU0qE84p/9QLeXwx8OMFWsTcBJ +pbERJKtKOXdl6V/+xbJ3j9LyowjGvVbxff9+Ba812ABhA3SNAQxhaiNvmjDB8K4Ux53 ZuIoKPfdvOo8neDPnACK6Eqk1SRYU3AeXCawof6u06HqctO+tdA7VH5mBk6L3nRq+XMD pZIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=IcfdLuIy; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l17si700347otk.218.2020.02.20.17.54.34; Thu, 20 Feb 2020 17:54:46 -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=@nvidia.com header.s=n1 header.b=IcfdLuIy; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729686AbgBUBxq (ORCPT + 99 others); Thu, 20 Feb 2020 20:53:46 -0500 Received: from hqnvemgate25.nvidia.com ([216.228.121.64]:6695 "EHLO hqnvemgate25.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729676AbgBUBxp (ORCPT ); Thu, 20 Feb 2020 20:53:45 -0500 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate25.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Thu, 20 Feb 2020 17:53:10 -0800 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Thu, 20 Feb 2020 17:53:43 -0800 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Thu, 20 Feb 2020 17:53:43 -0800 Received: from [10.110.48.28] (10.124.1.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Fri, 21 Feb 2020 01:53:43 +0000 Subject: Re: [PATCH] mm/page_alloc: increase default min_free_kbytes bound To: Joel Savitz , CC: Andrew Morton , Rafael Aquini , References: <20200220150103.5183-1-jsavitz@redhat.com> From: John Hubbard X-Nvconfidentiality: public Message-ID: <4778f04b-7ff0-0648-1ff9-dd02c79f45ea@nvidia.com> Date: Thu, 20 Feb 2020 17:53:42 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <20200220150103.5183-1-jsavitz@redhat.com> X-Originating-IP: [10.124.1.5] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To HQMAIL107.nvidia.com (172.20.187.13) Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1582249990; bh=ZgqXP5uwpGcW0RceBT61zrwGEA5iC5CnbKuv9h2cRIU=; h=X-PGP-Universal:Subject:To:CC:References:From:X-Nvconfidentiality: Message-ID:Date:User-Agent:MIME-Version:In-Reply-To: X-Originating-IP:X-ClientProxiedBy:Content-Type:Content-Language: Content-Transfer-Encoding; b=IcfdLuIyghaknA70cfsOuxsWbfNUyaGVDOj3dFHpp+X7LvYA46mp7IKBegdJ0kAFj m105kyXVSvq1qyACSdc8vA2Ucq+k4SAEYvDRLqnScKUNpRGHAwgwaADoYaB3xuK/LR weEtSggSSo5i/xZC7EmcivrIwwAT/tgwiQnIyFmHK3m35RN61TLkDpmku6lY5BecYf vSYpzkW0huWld4MgPZq5bt7V2kKI8OgAaM5aLoUr6YYgmYynatnsbeeRvjCdv2agHd 2JZ5DFAG/f3DM3bZmAaO32LOpifLnGQitjo8oxI+DI6sa/KYVPjWCGnXI2ee2qZ0Zp 0Sh0njGNLEUdQ== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/20/20 7:01 AM, Joel Savitz wrote: > > Currently, the vm.min_free_kbytes sysctl value is capped at a hardcoded > 64M in init_per_zone_wmark_min (unless it is overridden by khugepaged > initialization). > > This value has not been modified since 2005, and enterprise-grade > systems now frequently have hundreds of GB of RAM and multiple 10, 40, > or even 100 GB NICs. We have seen page allocation failures on heavily > loaded systems related to NIC drivers. These issues were resolved by an > increase to vm.min_free_kbytes. > > This patch increases the hardcoded value by a factor of 4 as a temporary > solution. > > Further work to make the calculation of vm.min_free_kbytes more > consistent throughout the kernel would be desirable. > > As an example of the inconsistency of the current method, this value is > recalculated by init_per_zone_wmark_min() in the case of memory hotplug > which will override the value set by set_recommended_min_free_kbytes() > called during khugepaged initialization even if khugepaged remains > enabled, however an on/off toggle of khugepaged will then recalculate > and set the value via set_recommended_min_free_kbytes(). > > Signed-off-by: Joel Savitz > --- > mm/page_alloc.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index 3c4eb750a199..32cbfb13e958 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -7867,8 +7867,8 @@ int __meminit init_per_zone_wmark_min(void) > min_free_kbytes = new_min_free_kbytes; > if (min_free_kbytes < 128) > min_free_kbytes = 128; > - if (min_free_kbytes > 65536) > - min_free_kbytes = 65536; > + if (min_free_kbytes > 262144) > + min_free_kbytes = 262144; Would it be any better to at least use symbols, instead of numbers, in the routine? Like this: diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 3c4eb750a199..e705636bb644 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -149,6 +149,9 @@ DEFINE_STATIC_KEY_FALSE(init_on_free); #endif EXPORT_SYMBOL(init_on_free); +static const int MIN_FREE_KBYTES_LOWER_LIMIT = 128; +static const int MIN_FREE_KBYTES_UPPER_LIMIT = 262144; + static int __init early_init_on_alloc(char *buf) { int ret; @@ -7865,10 +7868,10 @@ int __meminit init_per_zone_wmark_min(void) if (new_min_free_kbytes > user_min_free_kbytes) { min_free_kbytes = new_min_free_kbytes; - if (min_free_kbytes < 128) - min_free_kbytes = 128; - if (min_free_kbytes > 65536) - min_free_kbytes = 65536; + if (min_free_kbytes < MIN_FREE_KBYTES_LOWER_LIMIT) + min_free_kbytes = MIN_FREE_KBYTES_LOWER_LIMIT; + if (min_free_kbytes > MIN_FREE_KBYTES_UPPER_LIMIT) + min_free_kbytes = MIN_FREE_KBYTES_UPPER_LIMIT; } else { pr_warn("min_free_kbytes is not updated to %d because user defined value %d is preferred\n", new_min_free_kbytes, user_min_free_kbytes); thanks, -- John Hubbard NVIDIA > } else { > pr_warn("min_free_kbytes is not updated to %d because user defined value %d is preferred\n", > new_min_free_kbytes, user_min_free_kbytes); >