From patchwork Thu Feb 15 14:55:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 201562 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:b825:b0:106:860b:bbdd with SMTP id da37csp479536dyb; Thu, 15 Feb 2024 07:32:51 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXf2Mh9qUZhbfm+m41auq1KRX0+FrCXznSY83LZFQmTtmFrwQCduWxAofyZj/gbtqFYwfvONibBA7WQDrzKAiEvocNU/g== X-Google-Smtp-Source: AGHT+IGE0qk4bQ9z/njdyGUsOqPddYa7sn46cajK/Myl5TfdCjzE2k1Ivop2nYP70v5qjAB8Op+m X-Received: by 2002:a05:6a21:3115:b0:19e:a1ae:7a95 with SMTP id yz21-20020a056a21311500b0019ea1ae7a95mr2168256pzb.47.1708011171561; Thu, 15 Feb 2024 07:32:51 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708011171; cv=pass; d=google.com; s=arc-20160816; b=Titld7d6+Gf0/jVwX5byNFXpUI2cpOlLmtfx+uuQU9F6TGRSTPQuPlTL/xffZRwS3H CKVotPqQJPTId6Xyino9E0weM4NQVVrWLIcro8ciTvRaCN13Bh1TXaG16rZA8GjHyfVb +mTx08AnVUnS3X2VUlsFiyndZOIONkST4N2YZC8LXN4FI8WX6XYuIWNrkJqOQKsds3Pv U1JohbaHNlv+qYTtruD8OueMwcu4jdFtqYnyHZ/KvN7vwydkLX3C0X72ChAHn2hVmLHQ GAd23FFNHre9mDdapobKqR5QydpZGgX41TacEYxZyHxjcv6PBPtIAT0lld0Y1j2KJIXR ol1w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=xRvSVsODNSSWpBrjcPj/MUDqCBoUjFcr6NI1MGfkDG8=; fh=qiSgx1pKpaEkhtfiJmXIIBwQMdRiw0W8IgdNDE4iuoQ=; b=anEz3Cv14YXT6OpnHXfb75yXFTD3Nl4m3/rxUDAHgIU5cFdUxaul765zpxgjcfhBkp /NgsvrYqC1HoJQ57v2qjXF42UJfWd/IqomxR/Q5pQCmE0mDNuP6EB07cTf7zS92tyKSU Uj6g57mWUbxx71TUBBqvu7j+qjVOQnQ9qbmBmzvyG7hQIL0IkXfVa3QZ2tDf/iXAr/TW /h381PQEJI+oNon1xs89l38vaPeBrm42nRlScqgwYO0qZHKbMc0LxEucvtjKdnWT06eu c8LHRPNjgzKS3qXmbdY9lcKoMqV6tH7v1gVYhMFzlMBD1lE2mGN1/8foBwgPXydCmVAY p/Hg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ionos.com header.s=google header.b=KRjoka72; arc=pass (i=1 spf=pass spfdomain=ionos.com dkim=pass dkdomain=ionos.com dmarc=pass fromdomain=ionos.com); spf=pass (google.com: domain of linux-kernel+bounces-67119-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67119-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=ionos.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id c16-20020a6566d0000000b005cdfa6ec001si1299326pgw.380.2024.02.15.07.32.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 07:32:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67119-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@ionos.com header.s=google header.b=KRjoka72; arc=pass (i=1 spf=pass spfdomain=ionos.com dkim=pass dkdomain=ionos.com dmarc=pass fromdomain=ionos.com); spf=pass (google.com: domain of linux-kernel+bounces-67119-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67119-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=ionos.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id E1389B26968 for ; Thu, 15 Feb 2024 14:58:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E108313474E; Thu, 15 Feb 2024 14:56:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ionos.com header.i=@ionos.com header.b="KRjoka72" Received: from mail-ed1-f49.google.com (mail-ed1-f49.google.com [209.85.208.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 620C91332AF for ; Thu, 15 Feb 2024 14:56:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708008982; cv=none; b=GljQ9XDo9PrgaqIvlGoea9Kx7yvu65kycUP+0vhYOKvuSGCCNYQKdybI5QP/hWd0/ikjMD1Qtnq2oHoD6eOfBvSIcKdN240F6FdBcyFZei6ZOfzNKFa1gqByuVg6FTYao+jfEvsWPMC57RVmKhON1ALzbP+WBhuHNLgu4MGPq2o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708008982; c=relaxed/simple; bh=pgWmL1/kQ5EKgVkunmoc9kuE+c2QxgAXrDk6ncXpwtk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=XEe4ZUKsViT2OQVtnjtyOSbeP6mgfZVWwbh6JJG12P6UnvwJ9sWCwEgXrd7V8WXt4zaFGtYmY8n+Utqk6+l1YCtcK79Wtc49H2wBORKSePO1uE+5f2YHkc1IOFDThbtCFTJWxUO0zZlt4HbktouV1RNWgNK2ULj1hZtT+tz+lWg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ionos.com; spf=pass smtp.mailfrom=ionos.com; dkim=pass (2048-bit key) header.d=ionos.com header.i=@ionos.com header.b=KRjoka72; arc=none smtp.client-ip=209.85.208.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ionos.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ionos.com Received: by mail-ed1-f49.google.com with SMTP id 4fb4d7f45d1cf-563b7b48b9aso671047a12.2 for ; Thu, 15 Feb 2024 06:56:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1708008979; x=1708613779; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=xRvSVsODNSSWpBrjcPj/MUDqCBoUjFcr6NI1MGfkDG8=; b=KRjoka72HcPUAjsYnRrAisjX86NnCNxsl3ZehjKlPeOT2rCIPoKZGY+WJUg9FiY3BT q3rAtlYOXYC6YUWrFDzocaxcZvYao8gkKymfy33hJBP6dmlUv81ke43cWGPsB8iWYCEH NMOZbc5fbIxMpv52whpGqgWRoLm62pgyH8DfoariqpKslCGdxAGKzDwENkYOtSkM4M+D E8mTouD8XZCvvlQufK5Y1cs7SsI1XeKkwKdrhqkDniuzrbCJ+mRkz1Tfm6+DdBxKclSj eg2+QQFZNcbq8iEHvO/4RG5u6gZ9hQS/7vaL0iZO2iB31NIFu6Dh37EbPt1lZbRkZj3i 9vqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708008979; x=1708613779; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xRvSVsODNSSWpBrjcPj/MUDqCBoUjFcr6NI1MGfkDG8=; b=LI8E+ljRb/rqrZeQu4/K6KACvleVMP7Hs6EP8IBFWgIEaFr46AiBLrdvaQhQj9L8JY HkXakn+3g1dgpTj3XihdeAPnLdCW7VllhXI9t53Km+DpO/vemTd3pDuNFBtZYdFu94Ir Cu8GYuxT0hUxTgGTMYneDV/CjqIBj7b12WZ9zO/ElOJ8s1ofQHZDTIpaLqk/0t3DjgZ4 mS6DdZLOIWpdoI+VzmyKW1rAszT9UaeO54JLQtQMe0CjyQur+sOvymsduhse0t1DeM/G E/rZUbmJPZ17PmNaSExx6pZOWyE++jiUaJJRRX62Esa1X87H4Dvn6tDqOtEU0BnV7n88 rzHg== X-Forwarded-Encrypted: i=1; AJvYcCWQRjzzVrVZxNNzmMb4RLWmkQzv16fpbct9kHnHnNdzaQycP1NosWSNUfu6MaaTl19s4SPsvyri075yRTcmS915ll6/bNMlGDI8cQk6 X-Gm-Message-State: AOJu0YyRJiGa7OX0eag10nhHXTsfWo56RiprcxSdD3RPnh+rCf2/AzGR 9zXE8L3hdjklKLbEQb6jzmOTj5iMFyBjmwdjD6hcC7qd8pwmlG047xYJeMmw6mpM9ekS+vkAibs O X-Received: by 2002:a17:906:bc5a:b0:a3c:875b:f378 with SMTP id s26-20020a170906bc5a00b00a3c875bf378mr1086457ejv.36.1708008978701; Thu, 15 Feb 2024 06:56:18 -0800 (PST) Received: from raven.intern.cm-ag (p200300dc6f267100023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f26:7100:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id s18-20020a170906169200b00a3d1897ab68sm631175ejd.113.2024.02.15.06.56.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 06:56:17 -0800 (PST) From: Max Kellermann To: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Max Kellermann Subject: [PATCH v1 08/14] linux/mm.h: move devmap-related declarations to mm/devmap_managed.h Date: Thu, 15 Feb 2024 15:55:56 +0100 Message-Id: <20240215145602.1371274-9-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240215145602.1371274-1-max.kellermann@ionos.com> References: <20240215145602.1371274-1-max.kellermann@ionos.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790979522158861113 X-GMAIL-MSGID: 1790979522158861113 Prepare to reduce dependencies in linux/mm.h. Signed-off-by: Max Kellermann --- include/linux/mm.h | 24 -------------------- include/linux/mm/devmap_managed.h | 37 +++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 24 deletions(-) create mode 100644 include/linux/mm/devmap_managed.h diff --git a/include/linux/mm.h b/include/linux/mm.h index 680329ec21ba..cb2dd71e2940 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -1345,30 +1345,6 @@ vm_fault_t finish_fault(struct vm_fault *vmf); * back into memory. */ -#if defined(CONFIG_ZONE_DEVICE) && defined(CONFIG_FS_DAX) -DECLARE_STATIC_KEY_FALSE(devmap_managed_key); - -bool __put_devmap_managed_page_refs(struct page *page, int refs); -static inline bool put_devmap_managed_page_refs(struct page *page, int refs) -{ - if (!static_branch_unlikely(&devmap_managed_key)) - return false; - if (!is_zone_device_page(page)) - return false; - return __put_devmap_managed_page_refs(page, refs); -} -#else /* CONFIG_ZONE_DEVICE && CONFIG_FS_DAX */ -static inline bool put_devmap_managed_page_refs(struct page *page, int refs) -{ - return false; -} -#endif /* CONFIG_ZONE_DEVICE && CONFIG_FS_DAX */ - -static inline bool put_devmap_managed_page(struct page *page) -{ - return put_devmap_managed_page_refs(page, 1); -} - /* 127: arbitrary random number, small enough to assemble well */ #define folio_ref_zero_or_close_to_overflow(folio) \ ((unsigned int) folio_ref_count(folio) + 127u <= 127u) diff --git a/include/linux/mm/devmap_managed.h b/include/linux/mm/devmap_managed.h new file mode 100644 index 000000000000..0773529d80b2 --- /dev/null +++ b/include/linux/mm/devmap_managed.h @@ -0,0 +1,37 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_MM_DEVMAP_MANAGED_H +#define _LINUX_MM_DEVMAP_MANAGED_H + +#include // for bool + +struct page; + +#if defined(CONFIG_ZONE_DEVICE) && defined(CONFIG_FS_DAX) + +#include // for DECLARE_STATIC_KEY_FALSE(), static_branch_unlikely() +#include // is_zone_device_page() + +DECLARE_STATIC_KEY_FALSE(devmap_managed_key); + +bool __put_devmap_managed_page_refs(struct page *page, int refs); +static inline bool put_devmap_managed_page_refs(struct page *page, int refs) +{ + if (!static_branch_unlikely(&devmap_managed_key)) + return false; + if (!is_zone_device_page(page)) + return false; + return __put_devmap_managed_page_refs(page, refs); +} +#else /* CONFIG_ZONE_DEVICE && CONFIG_FS_DAX */ +static inline bool put_devmap_managed_page_refs(struct page *page, int refs) +{ + return false; +} +#endif /* CONFIG_ZONE_DEVICE && CONFIG_FS_DAX */ + +static inline bool put_devmap_managed_page(struct page *page) +{ + return put_devmap_managed_page_refs(page, 1); +} + +#endif /* _LINUX_MM_DEVMAP_MANAGED_H */