From patchwork Thu Aug 27 23:42:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yu Zhao X-Patchwork-Id: 11741985 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9D762739 for ; Thu, 27 Aug 2020 23:42:13 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6795120848 for ; Thu, 27 Aug 2020 23:42:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="g4pcl2Gm" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6795120848 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 9604A6B0007; Thu, 27 Aug 2020 19:42:11 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 898B06B000A; Thu, 27 Aug 2020 19:42:11 -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 789FB6B0008; Thu, 27 Aug 2020 19:42:11 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0088.hostedemail.com [216.40.44.88]) by kanga.kvack.org (Postfix) with ESMTP id 5DB7D6B0006 for ; Thu, 27 Aug 2020 19:42:11 -0400 (EDT) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 23DE1824556B for ; Thu, 27 Aug 2020 23:42:11 +0000 (UTC) X-FDA: 77197974462.27.fact13_1517fee27071 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin27.hostedemail.com (Postfix) with ESMTP id EBFF13D663 for ; Thu, 27 Aug 2020 23:42:10 +0000 (UTC) X-Spam-Summary: 1,0,0,f407ce6a7ca8f002,d41d8cd98f00b204,30urixwykchw3z4mftlttlqj.htrqnsz2-rrp0fhp.twl@flex--yuzhao.bounces.google.com,,RULES_HIT:41:152:355:379:541:800:960:966:973:988:989:1260:1277:1313:1314:1345:1359:1437:1516:1518:1535:1542:1593:1594:1711:1730:1747:1777:1792:2196:2198:2199:2200:2393:2559:2562:3138:3139:3140:3141:3142:3152:3354:3865:3866:3868:3871:3872:4250:4321:4385:4605:5007:6117:6119:6261:6653:7903:9969:10004:10400:10450:10455:11026:11473:11658:11914:12043:12296:12297:12438:12555:12895:14181:14394:14659:14721:19904:19999:21080:21444:21451:21611:21627:21990:30004:30045:30054,0,RBL:209.85.219.201:@flex--yuzhao.bounces.google.com:.lbl8.mailshell.net-66.100.201.100 62.18.0.100;04yfinzaikkbphtzbuzdab3r6z871yczch4b3rqomz37u54fwi6t3zy8mdsk7ew.deqoio4gm8i9dekmqq14npb6wud4mbb8toc7q1jsjy8zqdyn4dcooa19qhoek7t.o-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0, LFtime:2 X-HE-Tag: fact13_1517fee27071 X-Filterd-Recvd-Size: 5601 Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) by imf47.hostedemail.com (Postfix) with ESMTP for ; Thu, 27 Aug 2020 23:42:10 +0000 (UTC) Received: by mail-yb1-f201.google.com with SMTP id e1so9641776ybk.14 for ; Thu, 27 Aug 2020 16:42:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to:cc; bh=0Hnjgxs1FODqIFSLlA6dKst+CBRSb6xS7lVECFzeV8Y=; b=g4pcl2Gm0G1W3HdUB3pJZJjDi4Cz5qZuTb1AWrvOuVmZ/b+ZtAsmcca10al2XPG0RJ MFYHAkFPLZ6glOxCEydRuZnX5SUdcpziRl9r+xBx3O1NiptTb1KM4rlk4vFggAfcVBpb 3t3wW2+oP08BeIq0ZOzkr64I5ZR+dqAsR7CshISuWG4SDPrC8r82As9LQfg+TVvRibQM jLHmz3cXCgAri5RUkYTBky9qf4f7Bl08voRCMf/K9Za8rYMIUzr9gjr+/wd9fbfCP73Q YDp5mFpZKC6Z1bemplKD77ZBUMs9Qbx1QPIs7TuiYfGxewXHEeSeVx7X3s9u6TvfGvm1 2XHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=0Hnjgxs1FODqIFSLlA6dKst+CBRSb6xS7lVECFzeV8Y=; b=IViUZhqvgsUg+CN8OdNBmc/MFQorjaIU3rreHZUaX7u0itqxFzn6ouedXxSkVLUzWE eQSPHoVmaZpOJM8rcE6ZwidYGhJDXuDzAgH02RDFFHc6OFmtEbOPJ0xCL/74DPkaPQik CqpOF5mHRqO3DDrrGxUvoChr/fSxiKUhmqkXnbgXGCr1vMuq5uIWE1RPH4fP/WftKDaw yYowt9HC31sfEStnA26HVc19ZEQ0VwJQpDT6ywgbGnS1KGEvX2y695TtLzlWoQ1A54T6 NbHNt/OWYN/UW27A5ajSqMomFQoIW4aPyS9FGvL86DkcgrAI+Pui/aI+PV/X4klykzjq NmRg== X-Gm-Message-State: AOAM533619xzGWwM+R81Ct39Ub+glNRKdFhei4RseMQvqNljj5eBWmmo pIwzoXbC+NDkFaCd9/rqWmWMckfj78c= X-Google-Smtp-Source: ABdhPJx+jlYfgffMXl8kCT6JKh0xS8rZOWY5VAiBeGbHusL3uPkAsSinSwCcoCJaZ7MyUpnglnLYHh7ZeK0= X-Received: from yuzhao.bld.corp.google.com ([2620:15c:183:200:7220:84ff:fe09:2d90]) (user=yuzhao job=sendgmr) by 2002:a25:a143:: with SMTP id z61mr33466264ybh.468.1598571729777; Thu, 27 Aug 2020 16:42:09 -0700 (PDT) Date: Thu, 27 Aug 2020 17:42:02 -0600 In-Reply-To: <20200827234202.4027996-1-yuzhao@google.com> Message-Id: <20200827234202.4027996-2-yuzhao@google.com> Mime-Version: 1.0 References: <20200827234202.4027996-1-yuzhao@google.com> X-Mailer: git-send-email 2.28.0.402.g5ffc5be6b7-goog Subject: [PATCH 2/2] mm: use self-explanatory macros rather than "2" From: Yu Zhao To: Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Yu Zhao X-Rspamd-Queue-Id: EBFF13D663 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam03 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: This is a trivial clean-up patch. Take it or leave it. Signed-off-by: Yu Zhao --- include/linux/mmzone.h | 12 ++++++++---- include/linux/vmstat.h | 2 +- mm/vmscan.c | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 8379432f4f2f..be1cdbf8317f 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -266,6 +266,8 @@ static inline bool is_active_lru(enum lru_list lru) return (lru == LRU_ACTIVE_ANON || lru == LRU_ACTIVE_FILE); } +#define ANON_AND_FILE 2 + enum lruvec_flags { LRUVEC_CONGESTED, /* lruvec has many dirty pages * backed by a congested BDI @@ -283,8 +285,8 @@ struct lruvec { unsigned long file_cost; /* Non-resident age, driven by LRU movement */ atomic_long_t nonresident_age; - /* Refaults at the time of last reclaim cycle, anon=0, file=1 */ - unsigned long refaults[2]; + /* Refaults at the time of last reclaim cycle */ + unsigned long refaults[ANON_AND_FILE]; /* Various lruvec state flags (enum lruvec_flags) */ unsigned long flags; #ifdef CONFIG_MEMCG @@ -406,6 +408,8 @@ enum zone_type { #ifndef __GENERATING_BOUNDS_H +#define ASYNC_AND_SYNC 2 + struct zone { /* Read-mostly fields */ @@ -525,8 +529,8 @@ struct zone { #if defined CONFIG_COMPACTION || defined CONFIG_CMA /* pfn where compaction free scanner should start */ unsigned long compact_cached_free_pfn; - /* pfn where async and sync compaction migration scanner should start */ - unsigned long compact_cached_migrate_pfn[2]; + /* pfn where compaction migration scanner should start */ + unsigned long compact_cached_migrate_pfn[ASYNC_AND_SYNC]; unsigned long compact_init_migrate_pfn; unsigned long compact_init_free_pfn; #endif diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h index 91220ace31da..d5431c1bf6e5 100644 --- a/include/linux/vmstat.h +++ b/include/linux/vmstat.h @@ -28,7 +28,7 @@ struct reclaim_stat { unsigned nr_writeback; unsigned nr_immediate; unsigned nr_pageout; - unsigned nr_activate[2]; + unsigned nr_activate[ANON_AND_FILE]; unsigned nr_ref_keep; unsigned nr_unmap_fail; unsigned nr_lazyfree_fail; diff --git a/mm/vmscan.c b/mm/vmscan.c index b479ced26cd3..c4ddb2a88b07 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -2231,7 +2231,7 @@ static void get_scan_count(struct lruvec *lruvec, struct scan_control *sc, struct mem_cgroup *memcg = lruvec_memcg(lruvec); unsigned long anon_cost, file_cost, total_cost; int swappiness = mem_cgroup_swappiness(memcg); - u64 fraction[2]; + u64 fraction[ANON_AND_FILE]; u64 denominator = 0; /* gcc */ enum scan_balance scan_balance; unsigned long ap, fp;