From patchwork Tue Jun 22 12:15:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthew Wilcox (Oracle)" X-Patchwork-Id: 12337145 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=-16.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 19568C48BDF for ; Tue, 22 Jun 2021 12:23:24 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BFF1361351 for ; Tue, 22 Jun 2021 12:23:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BFF1361351 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 62AF76B0082; Tue, 22 Jun 2021 08:23:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5B4A36B0083; Tue, 22 Jun 2021 08:23:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 456C56B0085; Tue, 22 Jun 2021 08:23:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0106.hostedemail.com [216.40.44.106]) by kanga.kvack.org (Postfix) with ESMTP id 13A3A6B0082 for ; Tue, 22 Jun 2021 08:23:23 -0400 (EDT) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id A304DA2AA for ; Tue, 22 Jun 2021 12:23:22 +0000 (UTC) X-FDA: 78281275044.10.414D2B5 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf19.hostedemail.com (Postfix) with ESMTP id 4BFE59002399 for ; Tue, 22 Jun 2021 12:23:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=KXQr0EAW/6qWp7RwS3LzL0O1c0N0V+KkSoypTfpOEJk=; b=Nd27ewMZUH6hAeUH5oUcVoVF07 XaOtNq/Tqdm213DT0dkiXcq0lSpcL/Hv6Dlg5/UoyG32BBDNAqOtxGfjULvZ9gWVmphaiCI7a+c+K b28CfeFpJeSGGFKZg6zvqRybWyZzPaxp8PeV3yHZRhIsTbKJkWThLbL17gW7yWFkbHxkrLTZiiZRz DLgStHgQn6+NHJgfYwAwuqzK/fmlnLfkzgHrmkHI0irrXDQBORZtsSpGIfp/usYuqNl7/gJMRyrZP LaSInss0kXykGs6C87pw7vduIVuBh5nyFGLwtqRwEFwUmMJmMMx/+Qowx6G2wfooURGjEkG75pU+J qi5SK74Q==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1lvfPJ-00EGb6-87; Tue, 22 Jun 2021 12:22:04 +0000 From: "Matthew Wilcox (Oracle)" To: akpm@linux-foundation.org Cc: "Matthew Wilcox (Oracle)" , linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 07/46] mm/workingset: Convert workingset_activation to take a folio Date: Tue, 22 Jun 2021 13:15:12 +0100 Message-Id: <20210622121551.3398730-8-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210622121551.3398730-1-willy@infradead.org> References: <20210622121551.3398730-1-willy@infradead.org> MIME-Version: 1.0 Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=Nd27ewMZ; dmarc=none; spf=none (imf19.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org X-Stat-Signature: bnk5jejia9ab5d7qj4ba5pkkh9h7ki3m X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 4BFE59002399 X-HE-Tag: 1624364602-429744 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 function already assumed it was being passed a head page. No real change here, except that thp_nr_pages() compiles away on kernels with THP compiled out while folio_nr_pages() is always present. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig --- include/linux/swap.h | 2 +- mm/swap.c | 2 +- mm/workingset.c | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/linux/swap.h b/include/linux/swap.h index 76b2338ef24d..8e0118b25bdc 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -324,7 +324,7 @@ static inline swp_entry_t folio_swap_entry(struct folio *folio) void workingset_age_nonresident(struct lruvec *lruvec, unsigned long nr_pages); void *workingset_eviction(struct page *page, struct mem_cgroup *target_memcg); void workingset_refault(struct page *page, void *shadow); -void workingset_activation(struct page *page); +void workingset_activation(struct folio *folio); /* Only track the nodes of mappings with shadow entries */ void workingset_update_node(struct xa_node *node); diff --git a/mm/swap.c b/mm/swap.c index b01352821583..00d1d781c1c3 100644 --- a/mm/swap.c +++ b/mm/swap.c @@ -447,7 +447,7 @@ void mark_page_accessed(struct page *page) else __lru_cache_activate_page(page); ClearPageReferenced(page); - workingset_activation(page); + workingset_activation(page_folio(page)); } if (page_is_idle(page)) clear_page_idle(page); diff --git a/mm/workingset.c b/mm/workingset.c index b7cdeca5a76d..37cdcda96afd 100644 --- a/mm/workingset.c +++ b/mm/workingset.c @@ -390,9 +390,9 @@ void workingset_refault(struct page *page, void *shadow) /** * workingset_activation - note a page activation - * @page: page that is being activated + * @folio: Folio that is being activated. */ -void workingset_activation(struct page *page) +void workingset_activation(struct folio *folio) { struct mem_cgroup *memcg; struct lruvec *lruvec; @@ -405,11 +405,11 @@ void workingset_activation(struct page *page) * XXX: See workingset_refault() - this should return * root_mem_cgroup even for !CONFIG_MEMCG. */ - memcg = page_memcg_rcu(page); + memcg = page_memcg_rcu(&folio->page); if (!mem_cgroup_disabled() && !memcg) goto out; - lruvec = mem_cgroup_page_lruvec(page, page_pgdat(page)); - workingset_age_nonresident(lruvec, thp_nr_pages(page)); + lruvec = mem_cgroup_folio_lruvec(folio); + workingset_age_nonresident(lruvec, folio_nr_pages(folio)); out: rcu_read_unlock(); }