From patchwork Mon Nov 25 14:53:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hao Lee X-Patchwork-Id: 11260515 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 2F8BE138C for ; Mon, 25 Nov 2019 14:53:26 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id F12F420748 for ; Mon, 25 Nov 2019 14:53:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="XIpkpEOI" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F12F420748 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 35C0F6B05BF; Mon, 25 Nov 2019 09:53:25 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 2E59A6B05C7; Mon, 25 Nov 2019 09:53:25 -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 1867D6B05DA; Mon, 25 Nov 2019 09:53:25 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0073.hostedemail.com [216.40.44.73]) by kanga.kvack.org (Postfix) with ESMTP id F3EC26B05BF for ; Mon, 25 Nov 2019 09:53:24 -0500 (EST) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with SMTP id CC01C180AD81C for ; Mon, 25 Nov 2019 14:53:24 +0000 (UTC) X-FDA: 76195093128.12.voice21_57f46b6ca5d07 X-Spam-Summary: 2,0,0,609bdc52f8873afb,d41d8cd98f00b204,haolee.swjtu@gmail.com,:akpm@linux-foundation.org:mgorman@suse.de::linux-kernel@vger.kernel.org:haolee.swjtu@gmail.com,RULES_HIT:41:355:379:800:960:973:988:989:1260:1277:1312:1313:1314:1345:1437:1516:1518:1519:1534:1541:1593:1594:1595:1596:1711:1730:1747:1777:1792:2393:2559:2562:2898:3138:3139:3140:3141:3142:3352:3865:3866:3867:3870:3871:3872:4605:5007:6261:6653:7514:8603:9413:10004:10400:11026:11233:11473:11658:11914:12043:12296:12297:12438:12517:12519:12555:12895:13069:13161:13229:13311:13357:13439:13895:14181:14394:14687:14721:21080:21444:21627:21666:21966:30003:30054:30070,0,RBL:209.85.215.196:@gmail.com:.lbl8.mailshell.net-62.50.0.100 66.100.201.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:24,LUA_SUMMARY:none X-HE-Tag: voice21_57f46b6ca5d07 X-Filterd-Recvd-Size: 3899 Received: from mail-pg1-f196.google.com (mail-pg1-f196.google.com [209.85.215.196]) by imf32.hostedemail.com (Postfix) with ESMTP for ; Mon, 25 Nov 2019 14:53:24 +0000 (UTC) Received: by mail-pg1-f196.google.com with SMTP id b10so7317687pgd.4 for ; Mon, 25 Nov 2019 06:53:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=ZoiMBQHXkQbxRss7TAYb2fNUzJGxzT4/8Kr2W4f2ACw=; b=XIpkpEOIPbe9cqE9ANzttj2W6RToIpSEuQPu9qXqzH7H9d70uu6fZkpiReEAdmtpFy 4cYI1C61UQAoRbtuyl5abh8M9s/c3fhQT+wchCrC3eF9h7AcJ+sS7WXdNx2ED3LdFDX8 Wskl9p0jfv9uYie0topaRhW1tPPDfpVQEhCbggSVWXe5rGSfK2ipfYUSIsUoaONH2Zpj Ed4hjgBEvb1JJHiKk3uq+QZZOwucx9CX4xLwXvlZPYoL1IuKv2VeXE3hvF2glMI6CauF o3gNy7pd3DykPeJRhIVtOpgSBCC7xQzS7UVus0SHJVW7Q7EIP1FSPRdIKeDZyyvTLFYW wiRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=ZoiMBQHXkQbxRss7TAYb2fNUzJGxzT4/8Kr2W4f2ACw=; b=RTn2koHA3+TMVwTVTLaxjkrYrqAItVJaClv1yKP/nOFBbTKDIQKQXHKU9vIky4qFIU rFNsgD7sl3CQM3Ls3nGG/2vje/37yj8jjVOWKf01wzgDkGG6cbprzHoMAUV15vQQ8TaF xeIzyPvabpVCgSVNcrAKXx7cCuNbR+YOK8n6tLe+lqHYLuWU/q2j8Z4gvaMI+GevEtNh UinaeRj0yZZmsEeTFOvPIKHOn23XHJVfjDdFUXlmJZnpUFEoSlAYEaUCYy1034wegKV2 mvryUX1f1dsAAS5OpwHwXfMsUSLcxoQlOO5hyjJ3q8LVCO7ttFNlu8uzX3BWEOg4ujh4 cI3g== X-Gm-Message-State: APjAAAWDE1u/mjcfMgi0TEGxXlch3vkVHNyxNPMjigSvN38sMuoTJ8IM CZpyG/0u80VdsH6alQirFAE= X-Google-Smtp-Source: APXvYqxMwG6GEyEMXmp9TXTq2iArwnsZZPz3Dz4w98AvDF4Lv6cC+vNhPausdEFicpUBCQW70J3JfQ== X-Received: by 2002:a63:fb03:: with SMTP id o3mr32668501pgh.378.1574693603111; Mon, 25 Nov 2019 06:53:23 -0800 (PST) Received: from haolee.github.io ([2600:3c01::f03c:91ff:fe02:b162]) by smtp.gmail.com with ESMTPSA id v3sm9009534pfi.26.2019.11.25.06.53.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Nov 2019 06:53:22 -0800 (PST) Date: Mon, 25 Nov 2019 14:53:20 +0000 From: Hao Lee To: akpm@linux-foundation.org Cc: mgorman@suse.de, linux-mm@kvack.org, linux-kernel@vger.kernel.org, haolee.swjtu@gmail.com Subject: [PATCH] mm: use the existing variable instead of a duplicate statement Message-ID: <20191125145320.GA21484@haolee.github.io> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.12.1 (2019-06-15) 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: The address of zone has been stored in variable 'zone', so there is no need to get it again with a duplicate statement. Signed-off-by: Hao Lee Acked-by: Mel Gorman Reviewed-by: David Hildenbrand --- mm/vmscan.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index ee4eecc7e1c2..de4b2d1e66be 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -363,22 +363,21 @@ unsigned long lruvec_lru_size(struct lruvec *lruvec, enum lru_list lru, int zone for (zid = zone_idx + 1; zid < MAX_NR_ZONES; zid++) { struct zone *zone = &lruvec_pgdat(lruvec)->node_zones[zid]; unsigned long size; if (!managed_zone(zone)) continue; if (!mem_cgroup_disabled()) size = mem_cgroup_get_zone_lru_size(lruvec, lru, zid); else - size = zone_page_state(&lruvec_pgdat(lruvec)->node_zones[zid], - NR_ZONE_LRU_BASE + lru); + size = zone_page_state(zone, NR_ZONE_LRU_BASE + lru); lru_size -= min(size, lru_size); } return lru_size; } /* * Add a shrinker callback to be called from the vm. */