From patchwork Tue Jun 4 09:08:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 13684921 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 D1C3EC25B78 for ; Tue, 4 Jun 2024 09:09:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9CF2A6B00A1; Tue, 4 Jun 2024 05:09:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 97DBF6B00A4; Tue, 4 Jun 2024 05:09:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 785656B00A3; Tue, 4 Jun 2024 05:09:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 57C606B00A1 for ; Tue, 4 Jun 2024 05:09:21 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id D707A1A01F3 for ; Tue, 4 Jun 2024 09:09:20 +0000 (UTC) X-FDA: 82192632480.20.955356B Received: from mail-ej1-f51.google.com (mail-ej1-f51.google.com [209.85.218.51]) by imf04.hostedemail.com (Postfix) with ESMTP id 09A8040008 for ; Tue, 4 Jun 2024 09:09:18 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b="C5/TR+/k"; spf=pass (imf04.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.218.51 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=1717492159; 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=HwBsgjYa0IXOImdBe/4+bRIQcCY8SgWsOwsbDkpj0Qk=; b=30khMOwnR+NQCHA0dMeBMGpXIXkkdxlDwYHeGN+qZBvcGBJn526tSFHGCkQ4QNbkAHfKeZ 8PwP/qFqOKLJ7fpYy2z9ELVZ97OrynH7QzuFj0782yGWp+odExgsyXACgBV1k3RtgdSRAL esxvidvb1zwUC1kn8GrX6/HxwK38NLI= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b="C5/TR+/k"; spf=pass (imf04.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.218.51 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com; dmarc=pass (policy=quarantine) header.from=ionos.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1717492159; a=rsa-sha256; cv=none; b=mHqEQgIQjIPX//dtRsXktZ4VJNSoAaezyA50/rox8NjUEE8vRkX3pFBuQ+cZA55qrmTX/3 7fu6NJYxtOjGgYnAEQznQcGJhyvZ/j12wR57rjKoA5zwpu7LOqsflvCtU7mPNjX31BLK3o gywqb6rI+MxVBasSBPWCokNXAvRmNRc= Received: by mail-ej1-f51.google.com with SMTP id a640c23a62f3a-a68c2915d99so74908866b.2 for ; Tue, 04 Jun 2024 02:09:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1717492157; x=1718096957; 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=HwBsgjYa0IXOImdBe/4+bRIQcCY8SgWsOwsbDkpj0Qk=; b=C5/TR+/klTOJFH9n3XOeIBMpQ30ArFoSWtghTQTeQiazyOYky9AD4B9GN/CE1g2Ceg vE6vwEpdhichCOC+dJ4fk/KRxSO7yd5GlYFjna8YeZ1xcUsHpwPnUjY0n4h8tj2ZVOln 0d5B+tN3jvW7JCxF1Dbuj9MYinAySR91/dQ1pho7aXSWXiF2hCW/e7den92041T3+2QQ 3QkVLcR+B80Um4RNb1T3/rIyJKp1fAQS5lRHOz/j8uGibJfJw3HiJ7UEOVDXF5i/8aZT 7FCY7tqyWqHkYYRc2bXjZXPYKMV2hdyPbMhmEYODUMD/m680P8oZLWH7PHm/VUDb/kdA KnPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717492157; x=1718096957; 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=HwBsgjYa0IXOImdBe/4+bRIQcCY8SgWsOwsbDkpj0Qk=; b=qN8x1POLMi9zMPy+CgTiWqNyE2pnBqzjKZwA6JmGe3iHP0MEz1OCoPc13CCR923Ghj BNrH1QVgLIxJYc4un0ersTuI4fj381UTbaSU4Cy8DxLAaMEaoBNbr1IWOVoANLTyhWPE CsufAdjWk3BFd+Q47aoX/do9SI7sbEgrDqUemecXP69lDMxwJSh9PCX6KFENSOwFX6+M DQqomblPxns2rt1bHbK4ZT2Tb1u2KnHnmYF798h3XWcRMQxj7n6GWF6MjbMYN2AT3314 7AzedihEWygcaSVUYb4lF2nLx3EMlTpt8zbTBtPluF+H/FGBGYkQuGRpORmz0V3kNiks YP9A== X-Forwarded-Encrypted: i=1; AJvYcCU3gstRlDSv5ZQnbdLpAQNK52VxnCQQSPZPZC7jNmrWyCC8flg7nETEFW34wdIhvOSf05fjz9uKzLdEcmVwW72jYzw= X-Gm-Message-State: AOJu0YwN/FlC543zELLTNkCJELTazRLqjlcAOU0RgJfknDPdOjeUTg/Y huL2JBLKDYXDzQOsnJkZOvyEnXy3x+qvxNKrMMvS13ehSyNidkO8Is3fKzm6q88= X-Google-Smtp-Source: AGHT+IHIJT2BE+IHPYnFS/7wmnu2XAw4mULYk5HJdR9W0oN6DhpUIE6zi6XQ1spmCyvvSqUKhBaXJg== X-Received: by 2002:a17:906:4f0d:b0:a68:c6e5:3574 with SMTP id a640c23a62f3a-a68c6e5360bmr467546066b.75.1717492157591; Tue, 04 Jun 2024 02:09:17 -0700 (PDT) Received: from raven.blarg.de (p200300dc6f4f9200023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f4f:9200:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a68fa49e66fsm328376766b.129.2024.06.04.02.09.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 02:09:17 -0700 (PDT) From: Max Kellermann To: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: willy@infradead.org, sfr@canb.auug.org.au, david@redhat.com, Max Kellermann Subject: [PATCH v6 09/15] linux/mm.h: move devmap-related declarations to mm/devmap_managed.h Date: Tue, 4 Jun 2024 11:08:39 +0200 Message-Id: <20240604090845.2182265-10-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240604090845.2182265-1-max.kellermann@ionos.com> References: <20240604090845.2182265-1-max.kellermann@ionos.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 09A8040008 X-Stat-Signature: jt8inpd96h9uuwz56aadzao64zpg91k7 X-HE-Tag: 1717492158-821105 X-HE-Meta: U2FsdGVkX18UN2stmao0yDac3c7cn+5DqYUy7pI+GjTp++PFM62EmA8T28iUNWcBunJgF2muTKwlae8OHF8J+uB6dFvM6hF1z/9sqF4MchDnDoQac47in/X8qPQ65eQTu7o5nyjQJkWUHirAxDOjz5E02OwkQHSGnN9B4ZHSY6ysZ3Am9xS+twoKNFAi0BQ/5N636BzQmbsqh9nu+lpXJFUCV1iFVKM8KvB8lCD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Gpd6/h96GGQPBytdbSJnAI/jTMF5X6lZrJVhKl6o3g3sWchRpPQFu2w3Q0CtCLOHeR95wM57/nb3L9jOz859lvETLrAKOzMrJ+nY+tmzmBVpGgcvf7Owf7Ews= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000004, 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 | 20 +------------------ include/linux/mm/devmap_managed.h | 32 +++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 19 deletions(-) create mode 100644 include/linux/mm/devmap_managed.h diff --git a/include/linux/mm.h b/include/linux/mm.h index 7be75960e7e1..6ae6961e83bf 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2,6 +2,7 @@ #ifndef _LINUX_MM_H #define _LINUX_MM_H +#include #include #include #include @@ -1354,25 +1355,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_folio_refs(struct folio *folio, int refs); -static inline bool put_devmap_managed_folio_refs(struct folio *folio, int refs) -{ - if (!static_branch_unlikely(&devmap_managed_key)) - return false; - if (!folio_is_zone_device(folio)) - return false; - return __put_devmap_managed_folio_refs(folio, refs); -} -#else /* CONFIG_ZONE_DEVICE && CONFIG_FS_DAX */ -static inline bool put_devmap_managed_folio_refs(struct folio *folio, int refs) -{ - return false; -} -#endif /* CONFIG_ZONE_DEVICE && CONFIG_FS_DAX */ - /* 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..50357b304d68 --- /dev/null +++ b/include/linux/mm/devmap_managed.h @@ -0,0 +1,32 @@ +/* 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 // folio_is_zone_device() + +DECLARE_STATIC_KEY_FALSE(devmap_managed_key); + +bool __put_devmap_managed_folio_refs(struct folio *folio, int refs); +static inline bool put_devmap_managed_folio_refs(struct folio *folio, int refs) +{ + if (!static_branch_unlikely(&devmap_managed_key)) + return false; + if (!folio_is_zone_device(folio)) + return false; + return __put_devmap_managed_folio_refs(folio, refs); +} +#else /* CONFIG_ZONE_DEVICE && CONFIG_FS_DAX */ +static inline bool put_devmap_managed_folio_refs(struct folio *folio, int refs) +{ + return false; +} +#endif /* CONFIG_ZONE_DEVICE && CONFIG_FS_DAX */ + +#endif /* _LINUX_MM_DEVMAP_MANAGED_H */