From patchwork Thu Feb 22 11:50:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 13567169 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 2090EC48BF8 for ; Thu, 22 Feb 2024 11:51:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 83C656B0081; Thu, 22 Feb 2024 06:51:13 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 775FA6B0085; Thu, 22 Feb 2024 06:51:13 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 355C36B0081; Thu, 22 Feb 2024 06:51:13 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 053666B0081 for ; Thu, 22 Feb 2024 06:51:13 -0500 (EST) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 9D686C0DA6 for ; Thu, 22 Feb 2024 11:51:12 +0000 (UTC) X-FDA: 81819273984.16.03456E1 Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) by imf15.hostedemail.com (Postfix) with ESMTP id DB779A000C for ; Thu, 22 Feb 2024 11:51:10 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=YZXFMNf4; spf=pass (imf15.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.221.46 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com; dmarc=pass (policy=quarantine) header.from=ionos.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708602671; 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=kxFeZ/0ASaJvoJHkw5FuQa0hU1Ih3iAyraY4h2cFePg=; b=xv+FykoiW6klE1lwgZO4bahk/XFBrH6gxgkU41hrUo++3WJZYwSylqv3Wb+9eiAll8L0bX nUHqohbcCyQBbcIpx6MlYqPs90IBFVEWLxyLK6w5yeT9t2NBOLrjFs/Rj4bSUXh9n4UvqV q9dLlUJikqsCONVPOQKzxnR+qL+uu3o= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708602671; a=rsa-sha256; cv=none; b=wLH+PtY7K8b3F7f7kDB2FETok6qYVP3rz4X1IpBPySVrSwCXghHevO2JXz7/oS06WYRPjJ DGoHk6M+xSDIbvQ3ajn0496j/VEEytukLzuCFBAW9ip3TI+KpjHgBxkUwwolgr94ecYW1f Vwu2OSVlzHmtrMwh8dsYBJ9MvRTp2rk= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=YZXFMNf4; spf=pass (imf15.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.221.46 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com; dmarc=pass (policy=quarantine) header.from=ionos.com Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-33d0a7f2424so4694182f8f.0 for ; Thu, 22 Feb 2024 03:51:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1708602669; x=1709207469; darn=kvack.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=kxFeZ/0ASaJvoJHkw5FuQa0hU1Ih3iAyraY4h2cFePg=; b=YZXFMNf42aSRSgroKhSkH3XVQdyAh0qmQWxcRig6BQ182Ew2fE8683hznweT4/nOPA LVzaAHWJw1P0cFbvIwpjjQ2hOR3pbsB8AKi0lmUMaF+tR24nrgGrpiKTorTxrrXQlStm LrWFVWG8anVK6RbzV1uKgKYVJA6QdFpzT3gWkcg559Ykr0w6l0T0XdyS50JNdeOdgSTy 7vaSo4z6RvYMC6poZ86fMgoDdMw3GiSeu8sCgr6NN/4mhZZjQXu3PHSiYE+rRxH8uT4j KgMHdhRJs7S2IDamja0mcMdVAoJOgf6njYsle7p3swCXzWmVe+Db8U45MV1yFn4A8qOJ 6rOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708602669; x=1709207469; 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=kxFeZ/0ASaJvoJHkw5FuQa0hU1Ih3iAyraY4h2cFePg=; b=uTmEYbsnUJ9bSRP4aYvtnYnpgooZ3tVxB99YYM17SbLBp7txnISnPsYTFjvT+rVz/1 +NBixdFvfWGI7eeuqSE7dDoYGqizn0/oPq0Orx6R5N0bJw3XpkNQv29Wg3q/Uko5XaXO c6pCCuyRJ1cMwB0Q47NSCgcY1YykKkW4Oij+yuDkkCQp3UPf5XdUd70l9ZfZb0m1KkJQ 7c+QKchVwUoPX64JPLUjaf26tyZdfXyxPIVHAUYaz5kSrkFZaBza3CQodRf21AFu/BKW klokn3nr1f4j68IUWkv814G2l4+ztkAd2ocVWn+1qaKirRBlq+lHl9O0GV8kZYqLc81G BXTw== X-Forwarded-Encrypted: i=1; AJvYcCWgiN8MFHLfRAXlLDZuABfDC2ijusNqrHFEmXtgNrprvEO5Te2U5RJX7GDCVbFgpPslcoILhFL0J6Ezhb9jd31/MlQ= X-Gm-Message-State: AOJu0YwYj1EEpoNDhEpvi710GsF/GCx0P0TDi56OW2bl4uP1Q9BoKTK9 QrdNr0y5khQl8MjDroDqI2eVyWhdlYORquCUtAV/HOsbrLtvQdjs2ojC2wNaEsE= X-Google-Smtp-Source: AGHT+IEa3C8f7cLy6OU3uEmSmSXgcYIgG0huCWrowteGjGdDCOAsaf2p99NOehd9GQ5cTyTmBUBHRg== X-Received: by 2002:a05:6000:1787:b0:33d:56a0:88e3 with SMTP id e7-20020a056000178700b0033d56a088e3mr8736928wrg.65.1708602669683; Thu, 22 Feb 2024 03:51:09 -0800 (PST) Received: from raven.intern.cm-ag (p200300dc6f010900023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f01:900:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id co18-20020a0560000a1200b0033d4c3b0beesm15044920wrb.19.2024.02.22.03.51.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 03:51:09 -0800 (PST) From: Max Kellermann To: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: willy@infradead.org, Max Kellermann Subject: [PATCH v2 08/14] linux/mm.h: move devmap-related declarations to mm/devmap_managed.h Date: Thu, 22 Feb 2024 12:50:49 +0100 Message-Id: <20240222115055.1172877-9-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240222115055.1172877-1-max.kellermann@ionos.com> References: <20240222115055.1172877-1-max.kellermann@ionos.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: DB779A000C X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: ysqfdpp8oqkek6omin9x4yht6kzzi7zh X-HE-Tag: 1708602670-696645 X-HE-Meta: U2FsdGVkX1+kko/esCdGcze7SNPgCxcLMIXzKY2GsLmdNk4ZDhwugO84F/CT3ow7llFy/ZqHxiTnP+Fify4MGPW7Y2/aCFQMWlzzhkpTc5HSXKIicZOMHC0UBMkuG3pUDHDfUC2hwlxcnb/clZJXMbm0JzkTKtwsGzDe+zZS5EmDhJkbgylgV6pMxy0WHh4/u2mR3h6dBYUXvwtUTzN1nlXRmB657tl7GDdpOGqEqFl0wK7BPEwGudZ/PUSeXZ3972NEJXwsQS1qsW3ZHqFwR8ka7uqbJqb3PUSP6lio3FbZUtyYga2xC3UQYe59U0CTcjcFAQwOB+rOVWczEGY3jvo0samGGnABkpnAx9DApIasYxY1AYbstM9lvc4jyrlW7V7XQ6KOfmDdN7Gz0q8WmrqvV8jxABPLGLrYF3IRx2wRJsILZSHPRuAZQZ2hDRnr5PjJKCuBfwNLr8EWOQQNm9+QJEugax9YHNqHElYgFhenhpUw6OHeoSTCB7PZjhWlw7v3FMUnddaeRNSiOgEVNage8qOJwZFIrTJEKtmQH2tV+E2Yky15GcZs1GtP7YGsvTT8JyOeexsbNR1xsxlT+sG6yXkZvNHEN4QXHCnatujBlO/kOGudETOqWtJM7JppP6hF1XANHRGGIswNd/qnOSmMGDLCx34HIhfTOnyQuLOAdNAEUqhiRgxG00ZlVl428R/OyA+hboILBgleRe5K1K7IJQLgrLjk/3nl7EBnppYuxM9xvVIEvuRrCRSt1lXKCeUujaGJ+33mDo2irIdQYoYhLTblPk2SyX+s5QWSkYTmE+abEI8wSGPtQojPpkEgBzvtVqYZ2K3gdfyOwsCmcC+ajQRhxp4IHYd6rZfqPCmFYXV7FVpbtIqP+q0euWvpkmmXc+CeIV6tUAKRiabR1ERhgspTC2FQ2y6ZhHNd+QL4x43gxjUHb1eq1SgvR1BUOuvwiT7nQvQFXWinDOZ VuKstai9 30zDV2zh0R1lcMZYDF0FTIcXtMHCdGYSMlpM2b+hNlMoE72FqtEMdtplwVs3F3FzozEUSWoNOdBLVcX9mFvQUXySMYjdGM4tT5NBOFW+NnzYaRcHz1E+UQoEpPduLnoGXz4l9h+qxSYJJgHR8lpH3MWH/61z3iULTMjdC 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: Prepare to reduce dependencies on linux/mm.h. put_devmap_managed_page() is called by put_page(). Moving it to a separate header allows us to move put_page() to a separate lean header as well. 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 7d83d6d64f30..7a302da7de24 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -1350,30 +1350,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 */