From patchwork Mon Feb 19 06:27:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13562203 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6FDEEC48260 for ; Mon, 19 Feb 2024 06:27:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F2CE18D0007; Mon, 19 Feb 2024 01:27:36 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id EA7278D0006; Mon, 19 Feb 2024 01:27:36 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D94068D0005; Mon, 19 Feb 2024 01:27:36 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id C1FF98D0001 for ; Mon, 19 Feb 2024 01:27:36 -0500 (EST) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 93CAF80187 for ; Mon, 19 Feb 2024 06:27:36 +0000 (UTC) X-FDA: 81807572112.10.79CF6E1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf05.hostedemail.com (Postfix) with ESMTP id 8B709100003 for ; Mon, 19 Feb 2024 06:27:33 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=o0EtrNd8; dmarc=none; spf=none (imf05.hostedemail.com: domain of BATV+994827af29a55d2021e7+7484+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+994827af29a55d2021e7+7484+infradead.org+hch@bombadil.srs.infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708324055; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=IGlT4PlWbZpkcMxkrjhe0P1uDfgYrW+CfMT58/K5QjU=; b=kloREP1AkpVMcy61zrarIkn4ZRA9JTEgIjAj3zMPU5gnV7zYYSj4LNxiQ5s2/yZBBXfmwr 2sw7Yrc0obXcfohmk1eS3p+wS5A0WPzkmkufhN24kujttUU4Jvs1/LLNIF1akXHzOojFfw vtk87XhU/4AzIZTbGvUvm3A4SGrXdtY= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=o0EtrNd8; dmarc=none; spf=none (imf05.hostedemail.com: domain of BATV+994827af29a55d2021e7+7484+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+994827af29a55d2021e7+7484+infradead.org+hch@bombadil.srs.infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708324055; a=rsa-sha256; cv=none; b=X3/Q0p7MnPgFnTNyz3aX4sK/1b6MZ0Vk3iMisnEq9/Bc5+ObRGg44j62qRKH4+PKfXZHvn WDcB/ebAGavx5GC4Ao9qQdjkzs1sJuP0bfhJYYrfvwYVPlqfxcIfah4K7Ijxa9AZh2TOok vEja40ybzcqTRU+2ls5wyGmWNCt3a5U= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; 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=IGlT4PlWbZpkcMxkrjhe0P1uDfgYrW+CfMT58/K5QjU=; b=o0EtrNd8SJNNdeLSG2ZNs0BML1 OtsQZjSd8igrS57WzP6+ylJmDfLZoIRil/TiGd523WMu51mUeJnnUr2YDp8MS8grJZi/8K3WHBX1O Rhc8T0BGQDv6kdWEuCMQexZ2r0sDkavWcYLhDdHLdQmriWocYxMyI1+bvkK40ahrs4ezHEc/balS/ fEa6djNPr4HxUqWvrQDP5fmjCZoMjeGhVzrWPFs7N6Gg2UVWKgjo9YK2822oqTizGQIE9hyyuQS9D Rb/xszANs5QziVLR9/uEVezp124zDmWqx2024qddTKXvW/3ZAkDZPGbOFydxTiGtYTIjZjdZgVNcW Sz4oarcw==; Received: from 2a02-8389-2341-5b80-39d3-4735-9a3c-88d8.cable.dynamic.v6.surfer.at ([2a02:8389:2341:5b80:39d3:4735:9a3c:88d8] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rbx7f-00000009F5F-2FJX; Mon, 19 Feb 2024 06:27:27 +0000 From: Christoph Hellwig To: Chandan Babu R , "Darrick J. Wong" , Hugh Dickins , Andrew Morton Cc: Hui Su , linux-xfs@vger.kernel.org, linux-mm@kvack.org, Matthew Wilcox Subject: [PATCH 01/22] mm: move mapping_set_update out of Date: Mon, 19 Feb 2024 07:27:09 +0100 Message-Id: <20240219062730.3031391-2-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240219062730.3031391-1-hch@lst.de> References: <20240219062730.3031391-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Rspamd-Queue-Id: 8B709100003 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: kufompz1f7kfrn3wweo1oqku65wga5g5 X-HE-Tag: 1708324053-634085 X-HE-Meta: U2FsdGVkX19CUxaJI9/DhF4jtRfFmFyWVm4xi21NtKPe88EpVHtON34Yi/qwvmaYgyCy4z5mBFL+yoFQZxav9x7SpzamYDzfBsMFDDYVe772H9rDho31h+RzFP3BP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== 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: List-Subscribe: List-Unsubscribe: mapping_set_update is only used inside mm/. Move mapping_set_update to mm/internal.h and turn it into an inline function instead of a macro. Signed-off-by: Christoph Hellwig Reviewed-by: Matthew Wilcox (Oracle) --- include/linux/swap.h | 10 ---------- mm/filemap.c | 9 +++++++++ mm/internal.h | 4 ++++ mm/workingset.c | 1 + 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/include/linux/swap.h b/include/linux/swap.h index 4db00ddad26169..755fc64ba48ded 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -350,16 +350,6 @@ void *workingset_eviction(struct folio *folio, struct mem_cgroup *target_memcg); void workingset_refault(struct folio *folio, void *shadow); void workingset_activation(struct folio *folio); -/* Only track the nodes of mappings with shadow entries */ -void workingset_update_node(struct xa_node *node); -extern struct list_lru shadow_nodes; -#define mapping_set_update(xas, mapping) do { \ - if (!dax_mapping(mapping) && !shmem_mapping(mapping)) { \ - xas_set_update(xas, workingset_update_node); \ - xas_set_lru(xas, &shadow_nodes); \ - } \ -} while (0) - /* linux/mm/page_alloc.c */ extern unsigned long totalreserve_pages; diff --git a/mm/filemap.c b/mm/filemap.c index 750e779c23db74..6c8b089f00d26a 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -124,6 +124,15 @@ * ->private_lock (zap_pte_range->block_dirty_folio) */ +static void mapping_set_update(struct xa_state *xas, + struct address_space *mapping) +{ + if (dax_mapping(mapping) || shmem_mapping(mapping)) + return; + xas_set_update(xas, workingset_update_node); + xas_set_lru(xas, &shadow_nodes); +} + static void page_cache_delete(struct address_space *mapping, struct folio *folio, void *shadow) { diff --git a/mm/internal.h b/mm/internal.h index f309a010d50fb6..4398f572485f00 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -1266,4 +1266,8 @@ static inline void shrinker_debugfs_remove(struct dentry *debugfs_entry, } #endif /* CONFIG_SHRINKER_DEBUG */ +/* Only track the nodes of mappings with shadow entries */ +void workingset_update_node(struct xa_node *node); +extern struct list_lru shadow_nodes; + #endif /* __MM_INTERNAL_H */ diff --git a/mm/workingset.c b/mm/workingset.c index 2260129743282d..f2a0ecaf708d76 100644 --- a/mm/workingset.c +++ b/mm/workingset.c @@ -16,6 +16,7 @@ #include #include #include +#include "internal.h" /* * Double CLOCK lists