From patchwork Fri Nov 23 11:45:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mel Gorman X-Patchwork-Id: 10695661 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 4621C13BB for ; Fri, 23 Nov 2018 11:45:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 35F882C02D for ; Fri, 23 Nov 2018 11:45:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2A4CA2C90C; Fri, 23 Nov 2018 11:45:36 +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 921E52C02D for ; Fri, 23 Nov 2018 11:45:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1F21B6B2CEE; Fri, 23 Nov 2018 06:45:32 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 10DE86B2CF7; Fri, 23 Nov 2018 06:45:32 -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 020DE6B2CF8; Fri, 23 Nov 2018 06:45:31 -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 9ACCE6B2CEE for ; Fri, 23 Nov 2018 06:45:31 -0500 (EST) Received: by mail-ed1-f70.google.com with SMTP id s50so5635150edd.11 for ; Fri, 23 Nov 2018 03:45:31 -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=qNfXbvJcVFYms2l/9ym5kM8vPJaWMK4iR6eR0X2cMP4=; b=mTfB16ZCo8oY+9AMOxAcPZPRaS0mfNOHVagxIYHjwrd24YeB+5ozuTeAs3ZyQtcVgQ KadGU0drdes+IKOm4Qsde7+XxsvpcRqV1WhXPbhVZSNf22jjuXOnK113oSn6Q1H0Uxa2 JwovwGpC53YmfyhcbCM+yVPczL4h/AUeZCfIeVPpFW3A4x7zy4WBfIQZe1g7Ox4GEuvH v7z/82S+nqG76u5v40hIPZ5f8SJR8wxWkU0qIr5oF8E2o5NkTGKWfrQ+D4abDKH7J1E8 gwYRV4V/LxfhIIFqZuwRMAXqNR8bm1GuSBTy/jy8EukOyzwv+aW0NTs6LNvPLR2kyS6s +Hhw== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of mgorman@techsingularity.net designates 46.22.139.13 as permitted sender) smtp.mailfrom=mgorman@techsingularity.net X-Gm-Message-State: AGRZ1gKhz97jxLYNBKmrj0VJztzzNssM/7Eh3qb6urNxvJjfqhZsXW+S PRsqLnAG3nJXaAcJVTmAXvGDgkK1+uDmXvMp0omM31H4psdmO9Q/OWDlsLmf5uacW73wpuTXbSR dlbmzy2UHrqGbGX1aSf6f1VGdaWlWjFGpgFBQgKDkcV851s3zSnl0LkEqkNqFQHI/dw== X-Received: by 2002:a17:906:6212:: with SMTP id s18-v6mr11452004ejk.119.1542973531090; Fri, 23 Nov 2018 03:45:31 -0800 (PST) X-Google-Smtp-Source: AJdET5d4RhJi8iTfEaFhl+ZpWBkthfjfm6kKJ0xDfHyco4sT/xltz1gs/TqjfHUJOv76qs2lj/p+ X-Received: by 2002:a17:906:6212:: with SMTP id s18-v6mr11451952ejk.119.1542973529965; Fri, 23 Nov 2018 03:45:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542973529; cv=none; d=google.com; s=arc-20160816; b=F0T7L3mYSWQ7w9ma+qhfX4OsGgKU/i6fa3SPplMRbiPcfbSp4MBcXf2mcUsra1M/DE ch7gE4JB7cKriD3xLXSB0puUpjoY9vcsxSjtWwScBxDijt/vACcbf2pUl6HMrx5dEjXC lC63WJhHqz2V0D4NVdSSzxg4D0kpUV36vk+IoS+Cf1dXqJY2HNgwoot0JXeCXDIg5BQQ XRhupASOS1GwlKdJU2s0AqbponrRlUF8rU9zYX1N0jfP44xo1VjFpniKJurTVmKk1Ike jNaEPZZ1kObYzxnzEuhuOtO0jNjl6bJ5+snaS8Cujar6XvPCTmJJ/cG4zjcJs040aA3t 0R9g== 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=qNfXbvJcVFYms2l/9ym5kM8vPJaWMK4iR6eR0X2cMP4=; b=bFZuk6QP0KMBWTzAi68jYWn+ZqWvgSQ1cTq2DxtNQZW0NQ/pj6FzF5Cw8Pu1g6nyh0 j11eSdsTEIrQtA913yTI4UrE61rTDTrh8gK0XLLHdeSVLFxHQfwH90Qy1tadatqJwl/5 gJFcAJCn1zO0NQQyxfvZn+DYcLehojXmuevudJt7duOWR5BsRR+8+5/kINfQ9c16+15c HDhS6dh65q01GtVPC36P/cKmaGZPFQqq8yXuwysbUYQ+gbRmd6d8mnq/yiPLuvlGujUi 5h8kZnxwLyiK42NOQmDmiZToEYNT3vtoL1gMMaIz9a4h1CaPfWRWl5V7cSJJtVLL1G7B 221A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of mgorman@techsingularity.net designates 46.22.139.13 as permitted sender) smtp.mailfrom=mgorman@techsingularity.net Received: from outbound-smtp08.blacknight.com (outbound-smtp08.blacknight.com. [46.22.139.13]) by mx.google.com with ESMTPS id l24si321599edr.135.2018.11.23.03.45.29 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Nov 2018 03:45:29 -0800 (PST) Received-SPF: pass (google.com: domain of mgorman@techsingularity.net designates 46.22.139.13 as permitted sender) client-ip=46.22.139.13; Authentication-Results: mx.google.com; spf=pass (google.com: domain of mgorman@techsingularity.net designates 46.22.139.13 as permitted sender) smtp.mailfrom=mgorman@techsingularity.net Received: from mail.blacknight.com (pemlinmail04.blacknight.ie [81.17.254.17]) by outbound-smtp08.blacknight.com (Postfix) with ESMTPS id 9B74C1C2CEA for ; Fri, 23 Nov 2018 11:45:29 +0000 (GMT) Received: (qmail 12299 invoked from network); 23 Nov 2018 11:45:29 -0000 Received: from unknown (HELO stampy.163woodhaven.lan) (mgorman@techsingularity.net@[37.228.229.69]) by 81.17.254.9 with ESMTPA; 23 Nov 2018 11:45:29 -0000 From: Mel Gorman To: Andrew Morton Cc: Vlastimil Babka , David Rientjes , Andrea Arcangeli , Zi Yan , Michal Hocko , LKML , Linux-MM , Mel Gorman Subject: [PATCH 2/5] mm: Move zone watermark accesses behind an accessor Date: Fri, 23 Nov 2018 11:45:25 +0000 Message-Id: <20181123114528.28802-3-mgorman@techsingularity.net> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20181123114528.28802-1-mgorman@techsingularity.net> References: <20181123114528.28802-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 f86638aee96a..4ba84cd2977a 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -3376,7 +3376,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; @@ -4796,7 +4796,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, @@ -7422,13 +7422,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; } /* @@ -7440,8 +7440,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); }