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=-8.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable 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 72EE0ECE599 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 3FD26207FF for ; Wed, 16 Oct 2019 22:53:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3FD26207FF 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) Received: by kanga.kvack.org (Postfix, from userid 40) id AF0FF8E0001; Wed, 16 Oct 2019 18:53:32 -0400 (EDT) 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-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-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-Type: text/plain; charset=us-ascii 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 --- 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); -- 2.7.4