From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2A2CC432C0 for ; Sun, 1 Dec 2019 01:50:02 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 968902086A for ; Sun, 1 Dec 2019 01:50:02 +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 968902086A 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) Received: by kanga.kvack.org (Postfix, from userid 40) id 3FE946B027C; Sat, 30 Nov 2019 20:50:02 -0500 (EST) 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-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-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); _