From patchwork Fri Jan 26 13:28:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13532564 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 82AA4C47422 for ; Fri, 26 Jan 2024 13:29:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1B6AE6B007D; Fri, 26 Jan 2024 08:29:19 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 167A96B007B; Fri, 26 Jan 2024 08:29:19 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 02E866B007D; Fri, 26 Jan 2024 08:29:18 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id E88D46B0078 for ; Fri, 26 Jan 2024 08:29:18 -0500 (EST) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id AD390140EF4 for ; Fri, 26 Jan 2024 13:29:18 +0000 (UTC) X-FDA: 81721543596.18.C270349 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf15.hostedemail.com (Postfix) with ESMTP id 14247A000D for ; Fri, 26 Jan 2024 13:29:15 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=vCE7GgAB; spf=none (imf15.hostedemail.com: domain of BATV+8230b42af99c397292d7+7460+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+8230b42af99c397292d7+7460+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706275756; a=rsa-sha256; cv=none; b=E2LtLvvM0KSaKxBYdo+ujBKcDRPLfrKsDER7l0ZZCyEAIj2cREs5dgkV40m6hA9d0ejwTc P6YMw5demE9QbMhlyTJaBcKGAPk6pcD3LlUXWK4y4Xz3CJ2PrkiUnoMCciH4t5+CmCQgZ/ wbscwbRN57Hd7xBY7EgDhDvszbthRTU= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=vCE7GgAB; spf=none (imf15.hostedemail.com: domain of BATV+8230b42af99c397292d7+7460+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+8230b42af99c397292d7+7460+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1706275756; 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=owr/vlw+gG+D7l+zahUOl4d4YuUBj7TuMNS/fLNtya0=; b=PZH5u7fmP9FzXllrLh4S7wELH37Y9nyTR84MKpoHlUqY+TOhUH/fxU/CSZOxWWjS3vnDBU RDrkgwktedgTzSvmgnEbHDeAq4D4lV96yhIchZR3Gznr3MrTHpygVRT4f8ZgOXDgRkepcw NloLfg2FsbbrRFaaExI2P+e5MSJF1aM= 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=owr/vlw+gG+D7l+zahUOl4d4YuUBj7TuMNS/fLNtya0=; b=vCE7GgABB7RKVc1xXrUquxSSXo Tm+y/gatJCRztthVwTFX3SDm2qMdDX0H9Thx0vNKqlDHrYiujhIH01vgp8bPJnMONQLQtpo0i6vgv x1yYUuD9Ot9Y1TKfMA5v/DA5EVQqQheYxTNJqa5WwdSY6AEMsWVdj3o0LFDp8Ua8w0z0EzQZ0iggj AmfKZ5m4Wh5/BXsHh9PDc+zQbJR/WBnxBWhK57cN00I4ZU3vuQC/1GjPVOe8L9nxGd/uO3Bb4/Iij HVf+QMAqRxy2vhFzbk1LGoP1mEKMcN3fqwMDJbkcNcszTPMwEg6HDROIvSZx558PCexj78+7vTL/G lW15wIiQ==; 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 1rTMGe-00000004Ca1-0B1C; Fri, 26 Jan 2024 13:29:12 +0000 From: Christoph Hellwig To: Chandan Babu R , "Darrick J. Wong" , Hugh Dickins , Andrew Morton Cc: linux-xfs@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 01/21] mm: move mapping_set_update out of Date: Fri, 26 Jan 2024 14:28:43 +0100 Message-Id: <20240126132903.2700077-2-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240126132903.2700077-1-hch@lst.de> References: <20240126132903.2700077-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-Server: rspam08 X-Rspamd-Queue-Id: 14247A000D X-Stat-Signature: adeb3kub9jhptyqku4j451wk4gqp4ezw X-Rspam-User: X-HE-Tag: 1706275755-750085 X-HE-Meta: U2FsdGVkX19nScSCmeHLUuV42F2zZiF5F3pHdPPHe5zRApzEZFwlZdRXzUSiZLr6TtiuaDiGaFlyoguy2hofbgUr6WsqwrGW+CAT2abNPeVk3CsHSgGt7zENW3W7BhHQcBL5Bntlh11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CaYrZqvDXwSQhSDnuxMk0CVc7IE0jLzcwD9peeZNhdBsPr3j8Cc/YaKp/0zri/7OtSMYz5ZgHbEU7Sit7kmNrwSHfO3dC8wm2wCWxtXhHWpHbhKENQBU3754oKBMrukuY9oCNQw601v5EinAFU2oAcAJLp1zNJTTatkL0VJo3AepuBnnGzAjJ9S2vtg7VgO3NFiM8LKkmeGS8qeYS4FzDemWPvsOk6/iFAC6XJtRVVCpmgq2Y= 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 ++++ 3 files changed, 13 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 */