Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp627506ybt; Wed, 24 Jun 2020 07:28:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyDc5MRhq1I283DQ3q0PF3WaQljcsCqCdbSIUFQY3TgQEoRXjShiXe3l8OfP5DRs0ADaJ66 X-Received: by 2002:a17:906:5418:: with SMTP id q24mr24937395ejo.266.1593008891584; Wed, 24 Jun 2020 07:28:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593008891; cv=none; d=google.com; s=arc-20160816; b=HuV72aqP4Vorq3VpPvK4zaEhNFxoJbgv07HjUvNQfiSnGB45KN6fA2d+lxzcnr0goR +w0wHjWRtSbY15xyqXe73I3Z0cFd0flcl9aJx0IwjJh5iLj5H9cfIkN55mYii5WB4I0F aFC9la6ll2pBWol4iclHiKDnCDOuM4czWvGEo5CNyJ/yJmQhDLWHYPgNi2U1OTClH7/X d19FYD68iyfbAcyT1j7ZQ8gP6JsknYWSgqpYYZu8lZDH0nU1rGOwH/Y9nbcweaTim0Yk EebzKgs9ixCM5r8H0PKOAAVL5u5/dXC326A0B5Sg4X2Ou5o8hVk//UBVfejcnlN4btLc XZ+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=Asd6KB19RKXQe2oHJ11QoHr6ke20Niq5tDtEhqotynY=; b=PwWJzSVztp2osv02ZhecksEXx23lpWMzYBaXf3zUsz0h5x91yeLd6o8eSc1bT/kRPk OIyUvtjST9ueULrOER8JBrFCZqlNyXt1UcDhQfo0sRcR4LzTrVaIjeDaqtnmHMnfLbob sCJv+bz+7tb4sx1hzJMLnjXOviFu6mslcrqZ1RSdJY1YGSVCjzaS7yYqlY6VGC/tL9OA UTl5nn/NtTsa6wbR+OxI9sf1XHWtXJvYRhOt3cqxbDqaxxC8XPYTBdq6Gf5p4xBw4QDT rrgfBREu1e0l/avrBkvUuYGAsK684IgxJifwUYK0Z1qmgl90wsbnEnbjRIXlDRz863G+ wlVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=gPbd36yj; 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 s23si13970077edr.605.2020.06.24.07.27.46; Wed, 24 Jun 2020 07:28:11 -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=gPbd36yj; 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 S2390351AbgFXO0g (ORCPT + 99 others); Wed, 24 Jun 2020 10:26:36 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:42622 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388115AbgFXO0f (ORCPT ); Wed, 24 Jun 2020 10:26:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1593008794; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Asd6KB19RKXQe2oHJ11QoHr6ke20Niq5tDtEhqotynY=; b=gPbd36yjuw9c9LZ/p6LOywnNIC+HkS31YE7OxATBp1lA4dS4iOZ0etLqEqrz4xTwBbr+46 w6MA8ib99/Vy1Pbc5qoADMM8yZBHhuOOAWLM9nSENNsipv64KjHatslFXXybQ8Cvn+6zi0 9hyO3iNeB3/TC6sMsUYOiIBncBdeV+Q= 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-439-bZdIp3mNNWW456JCtacMtA-1; Wed, 24 Jun 2020 10:26:32 -0400 X-MC-Unique: bZdIp3mNNWW456JCtacMtA-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3766218A8221; Wed, 24 Jun 2020 14:26:31 +0000 (UTC) Received: from optiplex-lnx (unknown [10.3.128.9]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 65B775D9DC; Wed, 24 Jun 2020 14:26:29 +0000 (UTC) Date: Wed, 24 Jun 2020 10:26:26 -0400 From: Rafael Aquini To: Matthew Wilcox Cc: Joel Savitz , linux-kernel@vger.kernel.org, Vlastimil Babka , John Hubbard , Andrew Morton , linux-mm@kvack.org Subject: Re: [PATCH] mm/page_alloc: fix documentation error and remove magic numbers Message-ID: <20200624142626.GB1987277@optiplex-lnx> References: <20200624032712.23263-1-jsavitz@redhat.com> <20200624111255.GL21350@casper.infradead.org> <20200624140727.GA1987277@optiplex-lnx> <20200624140958.GN21350@casper.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200624140958.GN21350@casper.infradead.org> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 24, 2020 at 03:09:58PM +0100, Matthew Wilcox wrote: > On Wed, Jun 24, 2020 at 10:07:27AM -0400, Rafael Aquini wrote: > > On Wed, Jun 24, 2020 at 12:12:55PM +0100, Matthew Wilcox wrote: > > > On Tue, Jun 23, 2020 at 11:27:12PM -0400, Joel Savitz wrote: > > > > In addition, this patch replaces the magic number bounds with symbolic > > > > constants to clarify the logic. > > > > > > Why do people think this kind of thing makes the code easier to read? > > > It actually makes it harder. Unless the constants are used in more > > > than one place, just leave the numbers where they are. > > > > > > > @@ -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; > > > > + > > > > I think these constants would look better if declared as an enum. > > Why does having to look in two different places make the code clearer? > It might not make it clearer in this particular case, because it was easy to take the meaning from the code, but it also doesn't make it harder to read, so I don't have any strong opinion on this case. Joel's approach, however, makes sense if you consider it's generally a good practice to get rid of the unnamed magic numbers anti-pattern. Cheers, -- Rafael