From patchwork Sun Dec 1 01:50:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 11268211 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 D7F69921 for ; Sun, 1 Dec 2019 01:50:03 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A3CFA208E4 for ; Sun, 1 Dec 2019 01:50:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="N5ELWlwL" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A3CFA208E4 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 44CF66B027B; Sat, 30 Nov 2019 20:50:02 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 3FE946B027C; Sat, 30 Nov 2019 20:50:02 -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 2EEB76B027D; Sat, 30 Nov 2019 20:50:02 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0030.hostedemail.com [216.40.44.30]) by kanga.kvack.org (Postfix) with ESMTP id 1824C6B027B for ; Sat, 30 Nov 2019 20:50:02 -0500 (EST) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with SMTP id BD77A824999B for ; Sun, 1 Dec 2019 01:50:01 +0000 (UTC) X-FDA: 76214891802.18.note21_38c8f690032 X-Spam-Summary: 2,0,0,9255c50bcc8670d6,d41d8cd98f00b204,akpm@linux-foundation.org,:akpm@linux-foundation.org:dave.hansen@intel.com:fengguang.wu@intel.com:jingqi.liu@intel.com::mm-commits@vger.kernel.org:torvalds@linux-foundation.org:vbabka@suse.cz,RULES_HIT:41:355:379:800:960:967:973:988:989:1260:1263:1345:1381:1431:1437:1534:1541:1711:1730:1747:1777:1792:2198:2199:2393:2525:2559:2563:2682:2685:2859:2902:2918:2933:2937:2939:2942:2945:2947:2951:2954:3022:3138:3139:3140:3141:3142:3352:3865:3871:3872:3934:3936:3938:3941:3944:3947:3950:3953:3956:3959:4321:5007:6261:6653:7576:8599:8957:9010:9025:9545:10004:10913:11026:11232:11658:11914:12043:12048:12114:12297:12438:12517:12519:12555:12679:12783:12986:13069:13311:13357:14096:14181:14384:14721:14849:21080:21451:21627:21740:21939:30054:30064:30070,0,RBL:error,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:22,LUA_SUMMARY:none X-HE-Tag: note21_38c8f690032 X-Filterd-Recvd-Size: 2975 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf44.hostedemail.com (Postfix) with ESMTP for ; Sun, 1 Dec 2019 01:50:01 +0000 (UTC) Received: from localhost.localdomain (c-73-231-172-41.hsd1.ca.comcast.net [73.231.172.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 72ED4208C3; Sun, 1 Dec 2019 01:50:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575165000; bh=5x9g57RBH9Ag/aAvkMggeXZm54GrcQeY24Nh4/RaC9E=; h=Date:From:To:Subject:From; b=N5ELWlwLDZIwP2oCn6P5f/SEcy1fv1ISEZTwUxvpyDBxbA8RDDX1ZGEz0iSazHYk9 kdIoavtKra5CL8xBPKCgVg5NeUgIZEkh7T4QtwbS0CWxUdI9Dm6aFxiL3e/I769VA0 tqLtnndx22rGDO7rNsCp8QAh3IMWrQYbcGmYsyo0= Date: Sat, 30 Nov 2019 17:50:00 -0800 From: akpm@linux-foundation.org To: akpm@linux-foundation.org, dave.hansen@intel.com, fengguang.wu@intel.com, jingqi.liu@intel.com, linux-mm@kvack.org, mm-commits@vger.kernel.org, torvalds@linux-foundation.org, vbabka@suse.cz Subject: [patch 017/158] mm/swap.c: trivial mark_page_accessed() cleanup Message-ID: <20191201015000.LheRfuWNR%akpm@linux-foundation.org> User-Agent: s-nail v14.8.16 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: From: Fengguang Wu Subject: mm/swap.c: trivial mark_page_accessed() cleanup This avoids duplicated PageReferenced() calls. No behavior change. Link: http://lkml.kernel.org/r/20191016225326.GB12497@wfg-t540p.sh.intel.com Signed-off-by: Fengguang Wu Reviewed-by: Andrew Morton Acked-by: Vlastimil Babka Cc: Dave Hansen Cc: Liu Jingqi Signed-off-by: Andrew Morton --- mm/swap.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) --- a/mm/swap.c~mm-trivial-mark_page_accessed-cleanup +++ a/mm/swap.c @@ -373,9 +373,16 @@ static void __lru_cache_activate_page(st void mark_page_accessed(struct page *page) { page = compound_head(page); - 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 +396,6 @@ void mark_page_accessed(struct page *pag 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);