From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 55B2DC433E0 for ; Sun, 21 Jun 2020 19:56:53 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E90C023380 for ; Sun, 21 Jun 2020 19:56:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZDl4pfBU" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E90C023380 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 4B6438D002B; Sun, 21 Jun 2020 15:56:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 467908D001E; Sun, 21 Jun 2020 15:56:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 37D4A8D002B; Sun, 21 Jun 2020 15:56:52 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0247.hostedemail.com [216.40.44.247]) by kanga.kvack.org (Postfix) with ESMTP id 206DB8D001E for ; Sun, 21 Jun 2020 15:56:52 -0400 (EDT) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id BD1DC824805A for ; Sun, 21 Jun 2020 19:56:51 +0000 (UTC) X-FDA: 76954277022.11.pear93_46180ac26e2c Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin11.hostedemail.com (Postfix) with ESMTP id 64818180F8B80 for ; Sun, 21 Jun 2020 19:56:51 +0000 (UTC) X-HE-Tag: pear93_46180ac26e2c X-Filterd-Recvd-Size: 7039 Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by imf47.hostedemail.com (Postfix) with ESMTP for ; Sun, 21 Jun 2020 19:56:50 +0000 (UTC) Received: by mail-wr1-f68.google.com with SMTP id b6so14582854wrs.11 for ; Sun, 21 Jun 2020 12:56:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=zObDvLUMswNwhUW02zT5yK+sp9mpBr1EUjN7mrnt77Q=; b=ZDl4pfBUtctCnhhlx9zDx2Hk+w2sMpu1UA3aPxX+HmitTirspwdVQ6eD4/2BHrG77k OJjC1JkTCzIXVxzCGzZjnvoNYmqtXk/Sirekgtw1R/ygsAgpnlnyxjjOAkwk2DC850iu IPmYgNMeYwmxe1nj8dd4KoyJypPTvgfZyxKFvwBnV7gtszkZ75cy+E8/v6Mk5ScAVmVL UW9b1LZiJAe3/BXjQL4XWO+hxGn70TDNH9TtQxUjD/NLg8BIbRJLLPLo8Lruq469/BRT 68Wn9SwjcqWXOK9x1SJ4i5jfq/Xi72Czl57A6GSObOftOHLXJvFyGY/CT1sa1B3WPhN8 BSUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=zObDvLUMswNwhUW02zT5yK+sp9mpBr1EUjN7mrnt77Q=; b=mYV5/ar2QoDtd2bAyp5PkmB0gxW3rNwxdFM/S5zBj0U7g5mW9myrlBkp4dB5hvx4Fn SsLZRPzehW9js/8f8772GG3fV5BaZX+BEVy/KEyA/2T5iZbTd1W5TNfrpkRLrF5YpQpT LykPZq996FgOJszpTYG+FSQIVRjDgyuoOY2LyZrQC8QUEypaw6yuWWPX1la/g1p/NbRC d2wZ5r+beoHSVWUsKnXSBsvGvS3EKYoLuB0xxrjHvDya+nORPF4AgUK5j/dRUuWpvPl5 c93iBBeLuMxgz8z9N0ccsPC8dwuP+inr/IdSSbe4VMqXmCXaKN9+OMz5nLe2UhT7vRvy FK6Q== X-Gm-Message-State: AOAM5335w1nAqdxBUOH83BmCz5YIAs62oQlblw/r6mmsk3JxVtfhH2U6 SjZgnoBPnVt5CB0Y4KLlcH51dSlBfhq7Sp4fWFs= X-Google-Smtp-Source: ABdhPJznTkWlBLkF9J/5Y5X/cRZv0feLeO89ynKHcgU9a5BptQlj9/BWePCGHnYd8XhpEK8u+tv0Gr9YvfRabys3qq8= X-Received: by 2002:a5d:5310:: with SMTP id e16mr13177181wrv.289.1592769409735; Sun, 21 Jun 2020 12:56:49 -0700 (PDT) MIME-Version: 1.0 References: <20200619132410.23859-1-david@redhat.com> <20200619132410.23859-2-david@redhat.com> In-Reply-To: <20200619132410.23859-2-david@redhat.com> From: Pankaj Gupta Date: Sun, 21 Jun 2020 21:56:38 +0200 Message-ID: Subject: Re: [PATCH v1 1/2] mm: drop vm_total_pages To: David Hildenbrand Cc: LKML , Linux MM , Andrew Morton , Johannes Weiner , Michal Hocko , Huang Ying , Minchan Kim , Wei Yang Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 64818180F8B80 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 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: > The global variable "vm_total_pages" is a relict from older days. There > is only a single user that reads the variable - build_all_zonelists() - > and the first thing it does is updating it. Use a local variable in > build_all_zonelists() instead and drop the local variable. > > Cc: Andrew Morton > Cc: Johannes Weiner > Cc: Michal Hocko > Cc: Huang Ying > Cc: Minchan Kim > Cc: Wei Yang > Signed-off-by: David Hildenbrand > --- > include/linux/swap.h | 1 - > mm/memory_hotplug.c | 3 --- > mm/page-writeback.c | 6 ++---- > mm/page_alloc.c | 2 ++ > mm/vmscan.c | 5 ----- > 5 files changed, 4 insertions(+), 13 deletions(-) > > diff --git a/include/linux/swap.h b/include/linux/swap.h > index 4c5974bb9ba94..124261acd5d0a 100644 > --- a/include/linux/swap.h > +++ b/include/linux/swap.h > @@ -371,7 +371,6 @@ extern unsigned long mem_cgroup_shrink_node(struct mem_cgroup *mem, > extern unsigned long shrink_all_memory(unsigned long nr_pages); > extern int vm_swappiness; > extern int remove_mapping(struct address_space *mapping, struct page *page); > -extern unsigned long vm_total_pages; > > extern unsigned long reclaim_pages(struct list_head *page_list); > #ifdef CONFIG_NUMA > diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c > index 9b34e03e730a4..d682781cce48d 100644 > --- a/mm/memory_hotplug.c > +++ b/mm/memory_hotplug.c > @@ -835,8 +835,6 @@ int __ref online_pages(unsigned long pfn, unsigned long nr_pages, > kswapd_run(nid); > kcompactd_run(nid); > > - vm_total_pages = nr_free_pagecache_pages(); > - > writeback_set_ratelimit(); > > memory_notify(MEM_ONLINE, &arg); > @@ -1586,7 +1584,6 @@ static int __ref __offline_pages(unsigned long start_pfn, > kcompactd_stop(node); > } > > - vm_total_pages = nr_free_pagecache_pages(); > writeback_set_ratelimit(); > > memory_notify(MEM_OFFLINE, &arg); > diff --git a/mm/page-writeback.c b/mm/page-writeback.c > index 28b3e7a675657..4e4ddd67b71e5 100644 > --- a/mm/page-writeback.c > +++ b/mm/page-writeback.c > @@ -2076,13 +2076,11 @@ static int page_writeback_cpu_online(unsigned int cpu) > * Called early on to tune the page writeback dirty limits. > * > * We used to scale dirty pages according to how total memory > - * related to pages that could be allocated for buffers (by > - * comparing nr_free_buffer_pages() to vm_total_pages. > + * related to pages that could be allocated for buffers. > * > * However, that was when we used "dirty_ratio" to scale with > * all memory, and we don't do that any more. "dirty_ratio" > - * is now applied to total non-HIGHPAGE memory (by subtracting > - * totalhigh_pages from vm_total_pages), and as such we can't > + * is now applied to total non-HIGHPAGE memory, and as such we can't > * get into the old insane situation any more where we had > * large amounts of dirty pages compared to a small amount of > * non-HIGHMEM memory. > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index 0c435b2ed665c..7b0dde69748c1 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -5903,6 +5903,8 @@ build_all_zonelists_init(void) > */ > void __ref build_all_zonelists(pg_data_t *pgdat) > { > + unsigned long vm_total_pages; > + > if (system_state == SYSTEM_BOOTING) { > build_all_zonelists_init(); > } else { > diff --git a/mm/vmscan.c b/mm/vmscan.c > index b6d84326bdf2d..0010859747df2 100644 > --- a/mm/vmscan.c > +++ b/mm/vmscan.c > @@ -170,11 +170,6 @@ struct scan_control { > * From 0 .. 200. Higher means more swappy. > */ > int vm_swappiness = 60; > -/* > - * The total number of pages which are beyond the high watermark within all > - * zones. > - */ > -unsigned long vm_total_pages; > > static void set_task_reclaim_state(struct task_struct *task, > struct reclaim_state *rs) Reviewed-by: Pankaj Gupta