From patchwork Wed Oct 31 16:06:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mel Gorman X-Patchwork-Id: 10662891 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 0A3D41751 for ; Wed, 31 Oct 2018 16:06:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EF0B426D08 for ; Wed, 31 Oct 2018 16:06:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E207D2929C; Wed, 31 Oct 2018 16:06:52 +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 670A326D08 for ; Wed, 31 Oct 2018 16:06:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 234D16B0269; Wed, 31 Oct 2018 12:06:49 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 1E5E16B026A; Wed, 31 Oct 2018 12:06:49 -0400 (EDT) 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 063436B026C; Wed, 31 Oct 2018 12:06:48 -0400 (EDT) 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 8798B6B0269 for ; Wed, 31 Oct 2018 12:06:48 -0400 (EDT) Received: by mail-ed1-f70.google.com with SMTP id k17-v6so11024363edr.18 for ; Wed, 31 Oct 2018 09:06:48 -0700 (PDT) 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=47NV/eSAsgivwMtEcSAchPKAX6gtitBeIucoqSw9wVo=; b=Sii9J4LmabUMCapJuD7YRQYDqoE8C0aK+5LpapS69kIrqX3Qo8RFB0PPNmSNiP817i o+hV4OA2gUl25/HGsdyf5B87vibg5QIHN+FhaTsEgvVzubYNCxAgp9nQNFd4CqMjcPDX ogONjkq23dwJuhfBuTkmmdGH78jj8b9axNjYLj9asg5k1d1HuuEDRnGI2Bf9SvSct+7K BX6CEKHGdDLzTT6OtIEbYfhg3OigzPJgyZNw/SRM3awaVkcGSbl2Km2ONk0IVMz8167f JynEUwX80pphbGXb3ToZyVXqsk/7VY0eU9nt/zw6gQIqipBP2J1YtGifpjdqLPrdxiX3 yPLQ== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of mgorman@techsingularity.net designates 81.17.249.8 as permitted sender) smtp.mailfrom=mgorman@techsingularity.net X-Gm-Message-State: AGRZ1gJmaIoFcd34ux8dS2mOyViL8pRcP3SJj0mCxIxZMOOM7l+1oNZO xD8hQ7iuY8TQDqa/J+OJiPqwy7VLyjlO7cOEV/nVDoBGZDu5Fa6kEAcwLsBgtSZFhVRRFU6AKIV gbeuCBDklppvoisgUJGobtwNde7wddeT2ZBzsUzfwpCJCdi2emgR2ompaj0aIvzogTg== X-Received: by 2002:a17:906:64c:: with SMTP id t12-v6mr1997045ejb.113.1541002007943; Wed, 31 Oct 2018 09:06:47 -0700 (PDT) X-Google-Smtp-Source: AJdET5cgOfJgTVyoCvhLNr81/CmZqGYlTMKfbSkem1g69zeFlyrc9G68ySxhyJMwxSYqNKo23rSL X-Received: by 2002:a17:906:64c:: with SMTP id t12-v6mr1996996ejb.113.1541002006859; Wed, 31 Oct 2018 09:06:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541002006; cv=none; d=google.com; s=arc-20160816; b=KbzU1otJveLxZ8CoNvZxJO0ydIfVIxB+aw3kL/tEFhVtyGFVLfQyWaOxpEHjdmfq4i XJONQzWE6NgGBBhyZrNnGkufMgOVMGt+9uPB2VoRtjyOBz0pyMWRZirSd5J7m/pzW/iz xhrcNh1JaR/6AnoCteJ1jJKz+CjEznMDQsZ1TEW4Iipk9lU/g/6UyXYqwua6mzT2hboU I7xbYTxj6eRlv7K34LaXzGno7CkmxPKtjM+RgzsdXX+9DDyKRqXWC3sP9J649wndPMoK CUGwS9NWbJG9Wvm6GpbHaW5ckT0pY5NKDT6rBtrTYKXPZyf8zORm3a1TGWfgnbZgQebT vOMw== 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=47NV/eSAsgivwMtEcSAchPKAX6gtitBeIucoqSw9wVo=; b=ndp/ef/wLi8N1zoJhZJ6iBamxnELOXJy/W8KVbjzWgL7qPvn5xfYwxuDY9sYWWLtM7 m8TboLAJTnKotsvIt04FFv30RqB9ZJatdpCRycZ4BVJ1XJdexdItYrGZp3o1jfZ7vBGu GuL+ZyLbxxFMyyISdQYEHdwr96sl1J/iAxdE+I+3pF5N0vlHmH3sPwL0RmKYrT4/d8cl rb1X31pYHsYuW17kPjlljZTcFo4RQtjFM13KnO3wEXg+hzSrRTHCCnd6nb0e9q207VdR Fv1LfZxSV8d4kerXIezPQWzACsCmQklB9gm1F3eHs/4ndedsEBYrAP/xcWMCy2uzrF8A XsZw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of mgorman@techsingularity.net designates 81.17.249.8 as permitted sender) smtp.mailfrom=mgorman@techsingularity.net Received: from outbound-smtp02.blacknight.com (outbound-smtp02.blacknight.com. [81.17.249.8]) by mx.google.com with ESMTPS id b12-v6si5575339ejd.100.2018.10.31.09.06.46 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 31 Oct 2018 09:06:46 -0700 (PDT) Received-SPF: pass (google.com: domain of mgorman@techsingularity.net designates 81.17.249.8 as permitted sender) client-ip=81.17.249.8; Authentication-Results: mx.google.com; spf=pass (google.com: domain of mgorman@techsingularity.net designates 81.17.249.8 as permitted sender) smtp.mailfrom=mgorman@techsingularity.net Received: from mail.blacknight.com (pemlinmail04.blacknight.ie [81.17.254.17]) by outbound-smtp02.blacknight.com (Postfix) with ESMTPS id 870B998955 for ; Wed, 31 Oct 2018 16:06:46 +0000 (UTC) Received: (qmail 5573 invoked from network); 31 Oct 2018 16:06:46 -0000 Received: from unknown (HELO stampy.163woodhaven.lan) (mgorman@techsingularity.net@[37.228.229.142]) by 81.17.254.9 with ESMTPA; 31 Oct 2018 16:06:46 -0000 From: Mel Gorman To: Linux-MM Cc: Andrew Morton , Vlastimil Babka , David Rientjes , Andrea Arcangeli , Zi Yan , LKML , Mel Gorman Subject: [PATCH 2/5] mm: Move zone watermark accesses behind an accessor Date: Wed, 31 Oct 2018 16:06:42 +0000 Message-Id: <20181031160645.7633-3-mgorman@techsingularity.net> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20181031160645.7633-1-mgorman@techsingularity.net> References: <20181031160645.7633-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 --- 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 d4b0c79d2924..854d6c188888 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -267,9 +267,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 */ @@ -360,7 +361,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 faca45ebe62d..aa9473a64915 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -1430,7 +1430,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 db5d61868c96..a51887765abc 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -3360,7 +3360,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; @@ -4787,7 +4787,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, @@ -7323,13 +7323,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; } /* @@ -7341,8 +7341,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); }