Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2222569ybt; Sun, 21 Jun 2020 12:59:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJznjHXwsLsLXLzxj3LTH5T2/3SxcieIAxXkNLPB2D9L5Q97vdgCLwJ6JNLiYDCbVkAkt+tp X-Received: by 2002:a17:906:9381:: with SMTP id l1mr13202172ejx.380.1592769558527; Sun, 21 Jun 2020 12:59:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592769558; cv=none; d=google.com; s=arc-20160816; b=won2+5O6qCZu5dDjN1u/RhFQ2MYPbMDXyhYo50nCJ0d3Cj6NuuaNLor5LF59KmufnB JRcety4jlAHbE/uJSN3NdE/P5iyhY2gzizAVd6WRZmRRERoHmrTkCjWCGJpZqZ1Oo94P f0iLoUXPa4AdnsTatDO9nCKJoTe85BuU/aios3BED6TIFNr/YBfv06G0GO5afSqT6q7k xzXTN5zUgCZXZtbyvnSHqPRMCJF3/7lpHwZy5Bsb6XKGnlTL+pJO0ZeENFRdKFjK8lxN c63UGp7DB87H6k/8IV7cR9Zp8MXtrXjQI+Asff4hnXArBqBj6rBvglbKUGXANHSqI2Cl NVCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=zObDvLUMswNwhUW02zT5yK+sp9mpBr1EUjN7mrnt77Q=; b=WsFR49tIVryPhHHiZJV9D4C9RZEGzyG6iXMwWQGWZ5GxaCzWbn8I3mAFDoaHPLTj+X EpAAQ/1U2JjG98pj8ZsV4uYSFA/0l0+j0hVxoHNBrId0mkmB+EW7erJyJLYrDS0JJKeF m+VpKqzmSWcxFqpxgmfB/dps4whdTeThicYtgHsfqZKkkRjEwZeV2zNDDGxBAd4d/2gX pJl1rMGkR2fcJDZHVT7fPrtyuCE+AtnkzCId+by6yn++fRNqqeShNdWfqCPgIx0qHs2r B9Or9Ee/z/2BhHOgl8dXWD8AS8aLaUt4BJnb7i1C41aHJyWnijYAZbHzf13PvAb0yCCo FApQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ZDl4pfBU; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n19si8043624edr.152.2020.06.21.12.58.55; Sun, 21 Jun 2020 12:59:18 -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=@gmail.com header.s=20161025 header.b=ZDl4pfBU; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730577AbgFUT4x (ORCPT + 99 others); Sun, 21 Jun 2020 15:56:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730288AbgFUT4w (ORCPT ); Sun, 21 Jun 2020 15:56:52 -0400 Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07973C061794 for ; Sun, 21 Jun 2020 12:56:51 -0700 (PDT) Received: by mail-wr1-x443.google.com with SMTP id k6so2135167wrn.3 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=uZhKSzxlBgyd4VH6NsNEfkZWDrlueUbBQifQQA2DFG+quqZ0KY2wxN0thFxPN10MvB AJPDvKTcRl5tU+2HGJjL4bRRbwfUsDN32GMhsrn56bVt8cjJ2qWuWMC1mqXuFW666SYK WQVfMgt2RoycYjl8kZ3XwIZa7FTnQkbpIDdRJgWhof/k7Cfe63wQSsGDWbV/miguRbLv 1lVdA1L2ifaF0HxQzajhGT+zUQV5BZS3G9QGHrnZD2pS9OZDzX/DFKnawBkxJp21vg4Z k/KYe1csz/Y5IsptcgcmjAB2RbMaXC83EYPrgx4VA6vzhTy6Ox1ZSe1PWIEpCZK6YEtO tpvw== X-Gm-Message-State: AOAM531iTJ72oU3eHfrGyKr8j/ZQpdfzm3aV3w3tDN+zTixQ4F/bfESI 45xMx10AbSLDGsLmd6geyF7qBAOPYJYi88ujKTQ= 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" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > 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