From patchwork Wed Oct 16 22:53:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fengguang Wu X-Patchwork-Id: 11194571 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 B6AE814ED for ; Wed, 16 Oct 2019 22:53:33 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 842F5207FF for ; Wed, 16 Oct 2019 22:53:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 842F5207FF Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id B3FDF8E0005; Wed, 16 Oct 2019 18:53:32 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id AF0FF8E0001; Wed, 16 Oct 2019 18:53:32 -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 A06878E0005; Wed, 16 Oct 2019 18:53:32 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0099.hostedemail.com [216.40.44.99]) by kanga.kvack.org (Postfix) with ESMTP id 7AE608E0001 for ; Wed, 16 Oct 2019 18:53:32 -0400 (EDT) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with SMTP id E1C4E40C6 for ; Wed, 16 Oct 2019 22:53:31 +0000 (UTC) X-FDA: 76051151022.27.fold49_3bcb4d51dca52 X-Spam-Summary: 1,0,0,,d41d8cd98f00b204,fengguang.wu@intel.com,::akpm@linux-foundation.org:dave.hansen@intel.com:fengguang.wu@intel.com:jingqi.liu@intel.com:linux-kernel@vger.kernel.org,RULES_HIT:30054:30064:30070,0,RBL:134.134.136.126:@intel.com:.lbl8.mailshell.net-62.18.0.100 64.95.201.95,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:ft,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:28,LUA_SUMMARY:none X-HE-Tag: fold49_3bcb4d51dca52 X-Filterd-Recvd-Size: 2763 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by imf44.hostedemail.com (Postfix) with ESMTP for ; Wed, 16 Oct 2019 22:53:30 +0000 (UTC) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Oct 2019 15:53:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.67,305,1566889200"; d="scan'208";a="199097059" Received: from xiaoboma-mobl1.ccr.corp.intel.com (HELO wfg-t570.sh.intel.com) ([10.254.214.50]) by orsmga003.jf.intel.com with ESMTP; 16 Oct 2019 15:53:27 -0700 Received: from wfg by wfg-t570.sh.intel.com with local (Exim 4.89) (envelope-from ) id 1iKsAY-0003HH-1Q; Thu, 17 Oct 2019 06:53:26 +0800 Date: Thu, 17 Oct 2019 06:53:26 +0800 From: Fengguang Wu To: Linux Memory Management List , Andrew Morton Cc: Dave Hansen , Wu Fengguang , Liu Jingqi , LKML Subject: [PATCH] mm: trivial mark_page_accessed() cleanup Message-ID: <20191016225326.GB12497@wfg-t540p.sh.intel.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) 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 avoids duplicated PageReferenced() calls. No behavior change. Signed-off-by: Fengguang Wu Acked-by: Vlastimil Babka --- mm/swap.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/mm/swap.c b/mm/swap.c index 38a52b9..c55720c 100644 --- a/mm/swap.c +++ b/mm/swap.c @@ -373,9 +373,15 @@ void mark_page_accessed(struct page *page) page = compound_head(page); inc_node_page_state(page, NR_ACCESSED); - if (!PageActive(page) && !PageUnevictable(page) && - PageReferenced(page)) { - + if (!PageReferenced(page)) { + SetPageReferenced(page); + } else if (PageUnevictable(page)) { + /* + * Unevictable pages are on the "LRU_UNEVICTABLE" list. But, + * this list is never rotated or maintained, so marking an + * evictable page accessed has no effect. + */ + } else if (!PageActive(page)) { /* * If the page is on the LRU, queue it for activation via * activate_page_pvecs. Otherwise, assume the page is on a @@ -389,8 +395,6 @@ void mark_page_accessed(struct page *page) ClearPageReferenced(page); if (page_is_file_cache(page)) workingset_activation(page); - } else if (!PageReferenced(page)) { - SetPageReferenced(page); } if (page_is_idle(page)) clear_page_idle(page);