From patchwork Wed Jun 24 03:27:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Savitz X-Patchwork-Id: 11622257 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DA25813B1 for ; Wed, 24 Jun 2020 03:27:55 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A61F020823 for ; Wed, 24 Jun 2020 03:27:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="ipacoM1s" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A61F020823 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id A83776B0005; Tue, 23 Jun 2020 23:27:54 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id A34426B0007; Tue, 23 Jun 2020 23:27:54 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 922C46B0008; Tue, 23 Jun 2020 23:27:54 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0237.hostedemail.com [216.40.44.237]) by kanga.kvack.org (Postfix) with ESMTP id 7B4B56B0005 for ; Tue, 23 Jun 2020 23:27:54 -0400 (EDT) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id DBF1E3499 for ; Wed, 24 Jun 2020 03:27:53 +0000 (UTC) X-FDA: 76962671226.08.offer20_54140fb26e40 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin08.hostedemail.com (Postfix) with ESMTP id B78571819E76B for ; Wed, 24 Jun 2020 03:27:53 +0000 (UTC) X-Spam-Summary: 1,0,0,,d41d8cd98f00b204,jsavitz@redhat.com,,RULES_HIT:30034:30051:30054:30064,0,RBL:207.211.31.81:@redhat.com:.lbl8.mailshell.net-62.18.0.100 66.10.201.10;04ygwgppgobn5aoetrbcod9twbm9xoc1stdye7exs7pc5gdys4bntm8gry5re5k.giio95y18mxb6hb7mtfz817myk477yqg3i4d7io6m77z8hxf9uy3wyzjbou5izs.h-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:ft,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:24,LUA_SUMMARY:none X-HE-Tag: offer20_54140fb26e40 X-Filterd-Recvd-Size: 4102 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by imf50.hostedemail.com (Postfix) with ESMTP for ; Wed, 24 Jun 2020 03:27:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592969272; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=LuTtoSGXJewNeG9sj4V/BG+fVb0iM20PQFKrLVPrSAI=; b=ipacoM1stEqjc/0SmMzYTQuYGyIdl9P7ArLtSeSRPKijV4ALW/LXqZJuxEKxuQbqgGN6Cn 4yolIuc6tqnTJUD4bg9uCtkLSYPlJaouIuaLzwYzxZxTbDz172TQCh77dKwFgOuMOCJrWI cKd4Z/LZy+IFH7dbbSyF4gxCcnfCAjc= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-369-P7bqO8BOPtCyaMwSwRWzoQ-1; Tue, 23 Jun 2020 23:27:51 -0400 X-MC-Unique: P7bqO8BOPtCyaMwSwRWzoQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9DB65464; Wed, 24 Jun 2020 03:27:49 +0000 (UTC) Received: from jsavitz.bos.com (ovpn-112-219.rdu2.redhat.com [10.10.112.219]) by smtp.corp.redhat.com (Postfix) with ESMTP id F115A60C1D; Wed, 24 Jun 2020 03:27:45 +0000 (UTC) From: Joel Savitz To: linux-kernel@vger.kernel.org Cc: Joel Savitz , Vlastimil Babka , John Hubbard , Andrew Morton , Rafael Aquini , linux-mm@kvack.org Subject: [PATCH] mm/page_alloc: fix documentation error and remove magic numbers Date: Tue, 23 Jun 2020 23:27:12 -0400 Message-Id: <20200624032712.23263-1-jsavitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Rspamd-Queue-Id: B78571819E76B X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam03 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: When I increased the upper bound of the min_free_kbytes value in ee8eb9a5fe863, I forgot to tweak the above comment to reflect the new value. This patch fixes that mistake. In addition, this patch replaces the magic number bounds with symbolic constants to clarify the logic. Suggested-by: John Hubbard Suggested-by: Vlastimil Babka Signed-off-by: Joel Savitz --- mm/page_alloc.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 48eb0f1410d4..f725addc2748 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -7832,7 +7832,7 @@ void setup_per_zone_wmarks(void) * Initialise min_free_kbytes. * * For small machines we want it small (128k min). For large machines - * we want it large (64MB max). But it is not linear, because network + * we want it large (256MB max). But it is not linear, because network * bandwidth does not increase linearly with machine size. We use * * min_free_kbytes = 4 * sqrt(lowmem_kbytes), for better accuracy: @@ -7852,6 +7852,9 @@ void setup_per_zone_wmarks(void) * 8192MB: 11584k * 16384MB: 16384k */ +static const int MIN_FREE_KBYTES_LOWER_BOUND = 1 << 7; +static const int MIN_FREE_KBYTES_UPPER_BOUND = 1 << 18; + int __meminit init_per_zone_wmark_min(void) { unsigned long lowmem_kbytes; @@ -7862,10 +7865,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 > 262144) - min_free_kbytes = 262144; + if (min_free_kbytes < MIN_FREE_KBYTES_LOWER_BOUND) + min_free_kbytes = MIN_FREE_KBYTES_LOWER_BOUND; + if (min_free_kbytes > MIN_FREE_KBYTES_UPPER_BOUND) + min_free_kbytes = MIN_FREE_KBYTES_UPPER_BOUND; } 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);