From patchwork Wed Nov 21 10:14:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mel Gorman X-Patchwork-Id: 10692275 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E9BDC13BB for ; Wed, 21 Nov 2018 10:14:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D88F82B8C6 for ; Wed, 21 Nov 2018 10:14:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CCEA92B8CA; Wed, 21 Nov 2018 10:14:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 137DF2B8C7 for ; Wed, 21 Nov 2018 10:14:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EE8586B25AC; Wed, 21 Nov 2018 05:14:17 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id E71646B25AE; Wed, 21 Nov 2018 05:14:17 -0500 (EST) 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 D39086B25AF; Wed, 21 Nov 2018 05:14:17 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by kanga.kvack.org (Postfix) with ESMTP id 75FD76B25AC for ; Wed, 21 Nov 2018 05:14:17 -0500 (EST) Received: by mail-ed1-f70.google.com with SMTP id s50so2762318edd.11 for ; Wed, 21 Nov 2018 02:14:17 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references; bh=gjo02eaG+7h35smRKujujQhu9q5uu0t/PqIXWwn0i9U=; b=FBcMvbrS8Ncsq7tW92rEHHIR1g7v2EVPc5H4EcJj/nIJOwZRrjd3ICdyDSjXiwPE/n TM/Fd0YBsMvQAlXfyGR6wboW726S0HjYCjhrBUVwYBKV6NWC3yiC+ZMk3a6+HcxKwXUH 89VMAfV5K3iO7D8WOvP7wVg5gcqNie/fUfyCKICOfPRYFhSwUxjGFRtsIWymeBrahkKj 12qK6Ke0OgxZAvo+fPl2Ix84MqDG9X+YM/iUbDeSxgah55vwt/j1SwYdAKnsM89fFN6K c2nzabvZSMCbhZj5SwE5itsjYKaQhUfwHHFvuaSYrcTiy4NYDdhEitNJg/uevf6GUoCD VFKA== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of mgorman@techsingularity.net designates 81.17.249.35 as permitted sender) smtp.mailfrom=mgorman@techsingularity.net X-Gm-Message-State: AA+aEWb/5wIrwoQXj0WYWdBeN999rCwQyiimYQPFY6gaOa3fiOPBb/nh BHJFit0KgXLajgCY83UfoZNU5XA1qLzOBEu5bhsoqzIoqjWu437X8p7kgJJtD1EXEsfOEN5CWfr yJKcXq1gnDjpmvodc4YtQ6O75Ksttd6Jw0E25B5LBfOtHLpTwi42Ma0/SNe2I+bYzgw== X-Received: by 2002:a50:e789:: with SMTP id b9-v6mr5070799edn.275.1542795256968; Wed, 21 Nov 2018 02:14:16 -0800 (PST) X-Google-Smtp-Source: AFSGD/X6oD5ozKQ07PMOsNuH/hnWfdR2h1sEAgid1ndMn6lrcvEvaWv9Af23v45T3BqJl2tWBnZ9 X-Received: by 2002:a50:e789:: with SMTP id b9-v6mr5070749edn.275.1542795255829; Wed, 21 Nov 2018 02:14:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542795255; cv=none; d=google.com; s=arc-20160816; b=egxZrImbeKsNwO+uFM30Xq3/YPEHh33Hl0Rxn7SMe4f6dGJyFKPp1ocAnG1TNubQ4w 0UTUS7oQe2SYC8x01SO98hL/w3669hbnP/uwsXxutNzcQTVufoeLwNiFNQ4A5D3LTpvi 1hKzU3j21WMiZhGb52uyTQK2qLLlau1XQhLgGQN8nwnISPeX7bmksdg+DTJr9ufNFTU4 VOLNCmIPNgRgRivBcWLKQe8mv3daBheOhax4G0D0YxqB0EX7SB0iMAEC39bbJNBwHj/z 21+78TVXMdX76KfuyVdGvcjH0O/dKTKfhcMxH4wilXvD2kMETXTtZ8b/oz54KUhjP+P9 +oqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from; bh=gjo02eaG+7h35smRKujujQhu9q5uu0t/PqIXWwn0i9U=; b=f7tGDyHtbD4DbOh9DNmZQOjfk9IAbJTSj9cKHZgkuYvXTnNYuSsHELpQuw4Tb94uXS sSYtCoXgMoP1g3ZrbmUPFFq06wfIESv/6ci156QW661vD1i/G9BXn0FVmqkb6za+/vsI xwdAm2BJO0XJsYivBSIX9akNxQleKZPdDwdfzxyIM/eOGVf75K4LkFJNIiuPycN63SUY WaH/CSqKyXGQwLGUk6iLEiOexFoFXZO+W+iNeORXV8ic3bsdPn1tRrzIit8DoWmhf3/G 28rkNjmlNvjCmVnBBHKpi1c9kbs7Tj3fXc2ylg1rOe7OmVOLqJ1srCHGuVyw2UzpqYXW kgHQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of mgorman@techsingularity.net designates 81.17.249.35 as permitted sender) smtp.mailfrom=mgorman@techsingularity.net Received: from outbound-smtp04.blacknight.com (outbound-smtp04.blacknight.com. [81.17.249.35]) by mx.google.com with ESMTPS id z44si2575313edd.279.2018.11.21.02.14.15 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Nov 2018 02:14:15 -0800 (PST) Received-SPF: pass (google.com: domain of mgorman@techsingularity.net designates 81.17.249.35 as permitted sender) client-ip=81.17.249.35; Authentication-Results: mx.google.com; spf=pass (google.com: domain of mgorman@techsingularity.net designates 81.17.249.35 as permitted sender) smtp.mailfrom=mgorman@techsingularity.net Received: from mail.blacknight.com (pemlinmail01.blacknight.ie [81.17.254.10]) by outbound-smtp04.blacknight.com (Postfix) with ESMTPS id 5CA1C989DF for ; Wed, 21 Nov 2018 10:14:15 +0000 (UTC) Received: (qmail 19887 invoked from network); 21 Nov 2018 10:14:15 -0000 Received: from unknown (HELO stampy.163woodhaven.lan) (mgorman@techsingularity.net@[37.228.229.69]) by 81.17.254.9 with ESMTPA; 21 Nov 2018 10:14:15 -0000 From: Mel Gorman To: Linux-MM Cc: Andrew Morton , Vlastimil Babka , David Rientjes , Andrea Arcangeli , Zi Yan , Michal Hocko , LKML , Mel Gorman Subject: [PATCH 2/4] mm: Move zone watermark accesses behind an accessor Date: Wed, 21 Nov 2018 10:14:12 +0000 Message-Id: <20181121101414.21301-3-mgorman@techsingularity.net> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20181121101414.21301-1-mgorman@techsingularity.net> References: <20181121101414.21301-1-mgorman@techsingularity.net> 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: X-Virus-Scanned: ClamAV using ClamSMTP This is a preparation patch only, no functional change. Signed-off-by: Mel Gorman Acked-by: Vlastimil Babka --- include/linux/mmzone.h | 9 +++++---- mm/compaction.c | 2 +- mm/page_alloc.c | 12 ++++++------ 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 847705a6d0ec..e43e8e79db99 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -269,9 +269,10 @@ enum zone_watermarks { NR_WMARK }; -#define min_wmark_pages(z) (z->watermark[WMARK_MIN]) -#define low_wmark_pages(z) (z->watermark[WMARK_LOW]) -#define high_wmark_pages(z) (z->watermark[WMARK_HIGH]) +#define min_wmark_pages(z) (z->_watermark[WMARK_MIN]) +#define low_wmark_pages(z) (z->_watermark[WMARK_LOW]) +#define high_wmark_pages(z) (z->_watermark[WMARK_HIGH]) +#define wmark_pages(z, i) (z->_watermark[i]) struct per_cpu_pages { int count; /* number of pages in the list */ @@ -362,7 +363,7 @@ struct zone { /* Read-mostly fields */ /* zone watermarks, access with *_wmark_pages(zone) macros */ - unsigned long watermark[NR_WMARK]; + unsigned long _watermark[NR_WMARK]; unsigned long nr_reserved_highatomic; diff --git a/mm/compaction.c b/mm/compaction.c index 7c607479de4a..ef29490b0f46 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -1431,7 +1431,7 @@ static enum compact_result __compaction_suitable(struct zone *zone, int order, if (is_via_compact_memory(order)) return COMPACT_CONTINUE; - watermark = zone->watermark[alloc_flags & ALLOC_WMARK_MASK]; + watermark = wmark_pages(zone, alloc_flags & ALLOC_WMARK_MASK); /* * If watermarks for high-order allocation are already met, there * should be no need for compaction at all. diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 828fcccbc5c5..9ea2d828d20c 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -3370,7 +3370,7 @@ get_page_from_freelist(gfp_t gfp_mask, unsigned int order, int alloc_flags, } } - mark = zone->watermark[alloc_flags & ALLOC_WMARK_MASK]; + mark = wmark_pages(zone, alloc_flags & ALLOC_WMARK_MASK); if (!zone_watermark_fast(zone, order, mark, ac_classzone_idx(ac), alloc_flags)) { int ret; @@ -4790,7 +4790,7 @@ long si_mem_available(void) pages[lru] = global_node_page_state(NR_LRU_BASE + lru); for_each_zone(zone) - wmark_low += zone->watermark[WMARK_LOW]; + wmark_low += low_wmark_pages(zone); /* * Estimate the amount of memory available for userspace allocations, @@ -7416,13 +7416,13 @@ static void __setup_per_zone_wmarks(void) min_pages = zone->managed_pages / 1024; min_pages = clamp(min_pages, SWAP_CLUSTER_MAX, 128UL); - zone->watermark[WMARK_MIN] = min_pages; + zone->_watermark[WMARK_MIN] = min_pages; } else { /* * If it's a lowmem zone, reserve a number of pages * proportionate to the zone's size. */ - zone->watermark[WMARK_MIN] = tmp; + zone->_watermark[WMARK_MIN] = tmp; } /* @@ -7434,8 +7434,8 @@ static void __setup_per_zone_wmarks(void) mult_frac(zone->managed_pages, watermark_scale_factor, 10000)); - zone->watermark[WMARK_LOW] = min_wmark_pages(zone) + tmp; - zone->watermark[WMARK_HIGH] = min_wmark_pages(zone) + tmp * 2; + zone->_watermark[WMARK_LOW] = min_wmark_pages(zone) + tmp; + zone->_watermark[WMARK_HIGH] = min_wmark_pages(zone) + tmp * 2; spin_unlock_irqrestore(&zone->lock, flags); }