Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp734591ybt; Wed, 24 Jun 2020 09:55:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyICidoo5+Ye7H5M93zoeJZQnUsog+tXIuYNVO0buLn/2eDUHbLVUdWlCdmig/tpTV8OpId X-Received: by 2002:aa7:c245:: with SMTP id y5mr28271351edo.189.1593017707898; Wed, 24 Jun 2020 09:55:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593017707; cv=none; d=google.com; s=arc-20160816; b=ybKrwJGWywHYZWq1I2SKsbZXrYkXIWIZlQpE+fgMfYKAsW9A6Zs3FHcyTD4pBKztxH +OoMFsQwVxmXVwEucc4sHdYFjN490HuML+S9NoPEtg0LlUbHnM4UwRTAl50VxZbZ7yLq 4NTK21R1oqazuEej3PRW5Hln9gPMJxO4D28wahgcoJwWQqU/kNppfAgGI+3eZ7Fk1QCx rk1pnccELvTco0z7zKSrb5eXtRU/T3bm8tSQKzxn6VIITFK53vVenUg+alY2Ejg4OLda bSBZfi6+pY5wm5r1CPxma0+h45hjf5z/M8Ncq9ZuM4uXY3eHM6H4JlrQVioXMnT0bojN uASQ== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=YgOG3Qn9UrbkC82Csvd2S1YBbX7wsXZhXBrd7kB7GaE=; b=CY6/rLzaEf8U4ebY8vwdzx+t/7dPElAUL3HlIVnTzdtUHuf8z4562tY2wqNJRnUZ0+ +GheLcRmARJ2fkHchNHDAX6MZa5OBWjsE8q4ZC3QCu02loR3swinIs4uOPRt7clLr5yZ +/XINAjngT/TpIgQEbBmt8q+No/qhY2e/FVhocqU2KmicRmsIltGI1MoPIn11nMANxgp 6EGIL/11mtaqqdNsOBaFyT/JisA1/Z9O/+v9QOkML/YOLlpqbfgnYeeO2XM82KsJAnwp x7WDXn2l40NAKZJ+/wsUoj5rWDHlitIlmzgImE23hTTXv+3yVo3QrjIt8qJNo6PlflbR cKaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=C3Aq1EOx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 18si11950133ejv.611.2020.06.24.09.54.43; Wed, 24 Jun 2020 09:55:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=C3Aq1EOx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405271AbgFXQw2 (ORCPT + 99 others); Wed, 24 Jun 2020 12:52:28 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:35974 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2404017AbgFXQw1 (ORCPT ); Wed, 24 Jun 2020 12:52:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1593017546; 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=YgOG3Qn9UrbkC82Csvd2S1YBbX7wsXZhXBrd7kB7GaE=; b=C3Aq1EOxuQXfzCxHMRimNJ+GXjogDz2LvE7uonKeZwnQqWLNMMHAX240bo06L360qLJeia Jwk+i62GJ9eAnMeMb6grGCoAwCgKEGzplRcDWuIMUUH4W6CSnuSZFLUcOcva+7RkFK/1BO NtL/Pd57oecoq0dB17BNYgTunDsYClw= 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-299-9XDBz30yN5y-jP_osSf3Ow-1; Wed, 24 Jun 2020 12:52:24 -0400 X-MC-Unique: 9XDBz30yN5y-jP_osSf3Ow-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AE81A107ACF4; Wed, 24 Jun 2020 16:52:22 +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 C8C552B4AB; Wed, 24 Jun 2020 16:52:18 +0000 (UTC) From: Joel Savitz To: linux-kernel@vger.kernel.org Cc: Joel Savitz , Vlastimil Babka , John Hubbard , Andrew Morton , Rafael Aquini , Fabrizio D'Angelo , linux-mm@kvack.org Subject: [PATCH v2] mm/page_alloc: fix documentation error and remove magic numbers Date: Wed, 24 Jun 2020 12:49:43 -0400 Message-Id: <20200624164943.32048-1-jsavitz@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. changes from v1: - declare constants via enum instead of separate integers Suggested-by: John Hubbard Suggested-by: Vlastimil Babka Signed-off-by: Joel Savitz --- mm/page_alloc.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 48eb0f1410d4..733c81678b0e 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,8 @@ void setup_per_zone_wmarks(void) * 8192MB: 11584k * 16384MB: 16384k */ +static enum { MIN_FREE_KBYTES_LOWER_BOUND = 1 << 7, MIN_FREE_KBYTES_UPPER_BOUND = 1 << 18 }; + int __meminit init_per_zone_wmark_min(void) { unsigned long lowmem_kbytes; @@ -7862,10 +7864,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); -- 2.23.0