From patchwork Mon Aug 31 17:50:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yu Zhao X-Patchwork-Id: 11746795 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 8632D13A4 for ; Mon, 31 Aug 2020 17:50:55 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 531EB20767 for ; Mon, 31 Aug 2020 17:50:55 +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="HW8I1YgZ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 531EB20767 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 9E4C38E0001; Mon, 31 Aug 2020 13:50:53 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 94A406B005A; Mon, 31 Aug 2020 13:50:53 -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 7734E8E0001; Mon, 31 Aug 2020 13:50:53 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0047.hostedemail.com [216.40.44.47]) by kanga.kvack.org (Postfix) with ESMTP id 5369B6B0055 for ; Mon, 31 Aug 2020 13:50:53 -0400 (EDT) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 13EB6824556B for ; Mon, 31 Aug 2020 17:50:53 +0000 (UTC) X-FDA: 77211604386.06.cars31_021157027091 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin06.hostedemail.com (Postfix) with ESMTP id E16E21003E0C9 for ; Mon, 31 Aug 2020 17:50:52 +0000 (UTC) X-Spam-Summary: 1,0,0,57756a6ee6078b73,d41d8cd98f00b204,3ezhnxwykcciwsxf8memmejc.amkjglsv-kkit8ai.mpe@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.166.74:@flex--yuzhao.bounces.google.com:.lbl8.mailshell.net-62.18.0.100 66.100.201.100;04yffnpe857yp1chgmbg7eyqr6apryczch4b3rqomz37u54fwi6t3zy8mdsk7ew.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,L Ftime:24 X-HE-Tag: cars31_021157027091 X-Filterd-Recvd-Size: 5637 Received: from mail-io1-f74.google.com (mail-io1-f74.google.com [209.85.166.74]) by imf21.hostedemail.com (Postfix) with ESMTP for ; Mon, 31 Aug 2020 17:50:52 +0000 (UTC) Received: by mail-io1-f74.google.com with SMTP id l22so1284899iol.0 for ; Mon, 31 Aug 2020 10:50:52 -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=WJ86J1Rh/9a+OExkI0rJlOFHOUeu/5tIWacuz+P7JAc=; b=HW8I1YgZCnmOLwNMaMPR8Sc9pNUApCmj+dz2XsrVb+X/SNyph/zuGantqb4pgta39U KQGbOfOjQGNePPnYLR/r429Li0FzwweyZvT5M1Sa1B+9AbEtJB5h5ZgK2Rxw+tDUs811 LRSEOdNQyFkBN0CFGhpsfHaFZvif/OtBteR3Zn8ydBzMdEWLEZMvMk/Mm9bu9Om3s6LC k08kYtCBseeOND4PalCgqnwuU3h36DkgbnC6GK7p7jLKda1YL1EkO3iWVnQoUoA4Fl2r PNzBxiLUIfpFOyLhfFyDZQFX17fBelHRHsTiPW0TBMxp3Ge3zXPAbNLMiA2rNLA8Nylv UWxQ== 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=WJ86J1Rh/9a+OExkI0rJlOFHOUeu/5tIWacuz+P7JAc=; b=LC9I+vXN3QyNFOvWcd+YW7KIk1/i93CsRmsl0h7Ff/u1AdG9PAI/x79THFV44nC4Bt kPIGLeLDEqWN2hHYHkALcbi5ILpgmUq8Wwxh4ANPeOTM4T8K1VezzCoeS0abYNBolcxW F4xzF+gkkhGbJxWbyMrmjUIL3WmJo/kCBgbkYJoq2KZQyB9OxVYij3tBjgpgdyf9FaGa c2lfAY3TuCtMPPSoezJzu/aPw5FuZvphX4XqISDZ8xxnxHliCch2TMgMNWZPmEfBi5KI MLr8PWdP202xwNnmfZ6wtMTCHu91hkmnrYGuJsNwrJUtxsz9umA/cXyzG3NCmWUK1YOe UQCQ== X-Gm-Message-State: AOAM533ocKef6YT/IGeT/fOeZYwH4yS67t4UeNgDT4u4nUtvFiudK9QQ vcchohaC58wTOiNUrUeCZtlkV+yjFFY= X-Google-Smtp-Source: ABdhPJyEmB54MPwn+rzZUmhXVP5xIYQCPFUTfjuW/TXcdPEGT6mWsUn1s2ENBY0cwGSp4EbLtkPuNTkDlXQ= X-Received: from yuzhao.bld.corp.google.com ([2620:15c:183:200:7220:84ff:fe09:2d90]) (user=yuzhao job=sendgmr) by 2002:a92:7a0a:: with SMTP id v10mr2027625ilc.99.1598896251830; Mon, 31 Aug 2020 10:50:51 -0700 (PDT) Date: Mon, 31 Aug 2020 11:50:42 -0600 In-Reply-To: <20200831175042.3527153-1-yuzhao@google.com> Message-Id: <20200831175042.3527153-2-yuzhao@google.com> Mime-Version: 1.0 References: <20200831175042.3527153-1-yuzhao@google.com> X-Mailer: git-send-email 2.28.0.402.g5ffc5be6b7-goog Subject: [PATCH v2 2/2] mm: use self-explanatory macros rather than "2" From: Yu Zhao To: Andrew Morton Cc: Alex Shi , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Yu Zhao X-Rspamd-Queue-Id: E16E21003E0C9 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam01 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 1b871c3987e7..b454cc17e5a3 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -2232,7 +2232,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;