Received: by 2002:a89:2c3:0:b0:1ed:23cc:44d1 with SMTP id d3csp265627lqs; Tue, 5 Mar 2024 01:01:56 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWKE19+haLGcaAnZJ56yuOC+KocRyEIy49fvElGi3UUvvm1qTlnllxaCNRQlcYBVfYGymT4Fb+o+xsrNciqwi8E9CKWSt1aJHJ7aI4NUA== X-Google-Smtp-Source: AGHT+IFjg9T1V5guvxRHBnYoEowgQ0fpnsRzyQmrljjJAKvT3V6/6OBEJ1KrU50dIeFLGr9oCQDA X-Received: by 2002:a17:906:f911:b0:a44:7bbe:d774 with SMTP id lc17-20020a170906f91100b00a447bbed774mr7623754ejb.9.1709629316225; Tue, 05 Mar 2024 01:01:56 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709629316; cv=pass; d=google.com; s=arc-20160816; b=lsOJLq5Cjlr5jhaBDiHjP1RcgkHeAQaUbIojhyUfDntKgfMHAlgunU8e0Ed9xCfYg7 gVLpZ46Q9pOUewt27fLoVVtFWj301rM2uXAhr7Qc2wAFffQiwcqgEP70Opbnp9Egfhyd teu3w5wJs0ydXUukr4F+KdEDNZDHytSxNTyUX8mm6d/h6HKBrKWjlEoOfkB41xFXXii/ dxJmva6/kIPi4hgijf+rJE942fkXntb52TEvnvTxjUJrdf0Oy5S64xcJfsVq3vNtRLEM pLw9GQne2Vszuukc9pz7kKqm/9fAmzlkB0qGfblOkRs7v9VXmUzw1te+YAP/qD3Ipfan kKDQ== 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=TT7smv1j1+eH6dLDpyJyxapeCn0BRAoD8ideYTGL8g4=; fh=FswIJSmZHoRQHA+TMehTiiTgbAhW/q7twOmsxnA2w2s=; b=PZcP7JAIsjW69UJJ6NrNc6GsJ2K0NReRTu0M6awSYBaJbu4vVLo5MFbAOFoqvbq+J4 8OdnPCV5r8YttrBNyPLa4CUPKtdc+VYOOEbTUcegH5JlejSfItPCkSee+JMATw2/JTP0 gr1cRnsjY5kEa8w0EEKgj1uvcAON7Z/qt1HdWN4kOrHGIQfizswH3iZJEqLaDyno/tpf WOXUJDwtmsfqTyF7fHm6uQDK4SFKmVRrmTw9KIufdqi4FPxIVfz+i0pT4acyhqnNwwQ1 bGOBwM1ug0GD1GBBuhof4dpKR64O8LkKAasTjq6drc55Th0T8Rv9MdZPif2NB+YGetN4 0klg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ionos.com header.s=google header.b=MS0YRrc3; 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-91940-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-91940-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=ionos.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id go42-20020a1709070daa00b00a43efa48475si4944860ejc.818.2024.03.05.01.01.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 01:01:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-91940-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@ionos.com header.s=google header.b=MS0YRrc3; 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-91940-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-91940-linux.lists.archive=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 am.mirrors.kernel.org (Postfix) with ESMTPS id 8AD211F227D3 for ; Tue, 5 Mar 2024 09:01:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4F6F054F8C; Tue, 5 Mar 2024 08:59:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ionos.com header.i=@ionos.com header.b="MS0YRrc3" Received: from mail-ej1-f46.google.com (mail-ej1-f46.google.com [209.85.218.46]) (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 76626548EB for ; Tue, 5 Mar 2024 08:59:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709629187; cv=none; b=Nw63A8I01OcGLnGrtgh9OLCkKuHrEaAwW9kr3MaMBb3dJpvJsDxeZpl4YIhwDAuCZiCiN1BRxlKZrt0jOoYmxbZrIQxWc8okz38d6xikySnuLAHkrDs5FZ4i1sfQQH2zXYfSPqgk85e9Uo4fJXG2B1NguFYJdcvEwWX8e9HeUH0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709629187; c=relaxed/simple; bh=MIHkIFvab96I9R+obMDPY3PJG78+nlUxbYh17e4Y/Ic=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=th2oFXtNEZ9nbFQnnvLtRRAGvz/IVKgCPh92w6ur2HKKLSTZcOSqDo/vJQRaAEjrYhx6GOr8hyDXzIP7x2aOnnGDiIjhI7+uyVQMPqrajzH/lo9YrQHiFICpaYpYmfTuTQWxddnv+SA756tnPc4tgbfoiPanrQsx+02gGKRM3+E= 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=MS0YRrc3; arc=none smtp.client-ip=209.85.218.46 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-ej1-f46.google.com with SMTP id a640c23a62f3a-a4499ef8b5aso388710166b.0 for ; Tue, 05 Mar 2024 00:59:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1709629184; x=1710233984; 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=TT7smv1j1+eH6dLDpyJyxapeCn0BRAoD8ideYTGL8g4=; b=MS0YRrc3yW10g1NPSI7oFkqq3W3SgNf1fZQ8YhgkJlKKsrGz87H+V6sjCCAjMrmX4h 3YybXiFpjxY7av378YGn+8+7yi7H20nYfXAElGcFrXLdH3fsTKTc/C/IaaWSH38Vcgcj Dm8gc5RWKs46SXMQjdFxJyZ1Ae95If6jTNoLSJERA/lwFJGVe/j9xbZy/ojRs/TVztyI wseCFP9jOmyWNfHWkVAvsOKXK3Ct3LRDq/OVWq32bfBiqEZ+ONOGLKLInqijYBiIpnAZ g3pM6vxnicvYY4KtzcCoAwEJjtiZovVzMHIeEPdOLTqw9Uoihq/1jt+a3pMML3MhJa5t JVJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709629184; x=1710233984; 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=TT7smv1j1+eH6dLDpyJyxapeCn0BRAoD8ideYTGL8g4=; b=M71IFGax0eifmh+ftQYHUpHheDqBKLWzWipgS7w1wUoX1oOm8iLo4a+kOaa8BKbSBy taNPLPpENmOqwmP17DErBej9wY01QWBt3QaKUqz7/1gtdkMLOlu+XQ54oGGWiArHJV9T d1Lsr5DJUR2hgkkaYQRuPb7d3k0ktyvVo7jDUjosP4aVL4+KyjlFcETLdQUW/s+wEWFZ qdDeuhT3PFzimsYcnqwRv7POWXMhhAAP6uwppmE6ydwd4dKJBg7VTp9muwEgB91846LT ZLLlrYSjHmoUosBzqtpY8ISWehBnKFUwwQBG/0oLPIjpXrK/tV2SY6OKuIoiRzb7eX3s q3Ew== X-Forwarded-Encrypted: i=1; AJvYcCWRtAeYUvrvAUzvlPDhwpNsiOapsOn8wadPm9K1FgbDkfPsxQ4Rh+MJfYzUnmF7upFW5xTA+Odqie3eR00iboxQ786PezFs/KzEDmgU X-Gm-Message-State: AOJu0Ywl+9wQXdgPDNBSzpTeFryLenlKZ2k7jm/BHOEskikkt+UOqY1D vBQ5YAscwpJDl3qZ1th8aSwLZCkEBrHIIocIXwEgs85l+soFeuibJq/HE3XU784= X-Received: by 2002:a17:906:c7c3:b0:a3e:34e8:626f with SMTP id dc3-20020a170906c7c300b00a3e34e8626fmr8169467ejb.66.1709629183860; Tue, 05 Mar 2024 00:59:43 -0800 (PST) Received: from raven.blarg.de (p200300dc6f010900023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f01:900:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id gs4-20020a170906f18400b00a449d12cdc5sm4453005ejb.119.2024.03.05.00.59.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 00:59:42 -0800 (PST) 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, Max Kellermann Subject: [PATCH v3 08/14] linux/mm.h: move devmap-related declarations to mm/devmap_managed.h Date: Tue, 5 Mar 2024 09:59:13 +0100 Message-Id: <20240305085919.1601395-9-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240305085919.1601395-1-max.kellermann@ionos.com> References: <20240305085919.1601395-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 Content-Transfer-Encoding: 8bit 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 | 25 +-------------------- include/linux/mm/devmap_managed.h | 37 +++++++++++++++++++++++++++++++ 2 files changed, 38 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 e6c2df977abc..61f1312a626e 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 @@ -1357,30 +1358,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 */ -- 2.39.2