Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp1464676lqj; Tue, 4 Jun 2024 02:19:33 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVM3F/jrpp3dyAMWzu4yK3XGIV+1x9w6OUpxHAKr15Pqht9knCFr5CH85pUCy1RHu5qY5Sz6Dn35zkDWWUKusWrOX3x6rK0pXMxDpQsGQ== X-Google-Smtp-Source: AGHT+IE77FZYAwIE3yIslqjCME21x5di+6+n9oGEr8y3LOscJ03o4s85r0jPagMCIs3BDPoEYr3V X-Received: by 2002:a05:6a20:5a9f:b0:1b2:2ed2:b80a with SMTP id adf61e73a8af0-1b26f30dcbdmr9594586637.61.1717492772839; Tue, 04 Jun 2024 02:19:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717492772; cv=pass; d=google.com; s=arc-20160816; b=sh22nrXg6zo5lt5DcMbg2EIz/jPqfBOnb9lrC09BMRXN2zUEsGevLKIUSEuYm+/lQe y1NJCw6MqQ0UmIWO8J6wfIi6kV900uJ2mcsEuPcu/9Q9G3qBxotL0jeC9jdBsbrazpHU fUxBhRo9AlV9GuXb1w/Max8wE1TBTK8E+Qk8p6A2aft3upDW7Z4fLJ4BJ33NeVK7brti OkM9eV9P59ofIr93mIcGBNFLDw7JFd+cPS6rpx8ugRbpPGB8bFq+GMng6G32dYYx1SKb M1dVgmWL6b7iiUcpnd1I9Yf/Re9/5fL6sap+vezXbaf0tPKzg9NcxefUEc9Jrm4Clb7l s73A== 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=HwBsgjYa0IXOImdBe/4+bRIQcCY8SgWsOwsbDkpj0Qk=; fh=6au94f79XIzWNA97SCeG1d2ZS3GualUnCSqX5GfvnmM=; b=FVq1wVTN9SrnmzvCm+qTTMehGam0omlpZLjxH2XGBghjdEWkXLOIYtIY+bRboTIR30 zQfhVJ84eD3PP5xyWf1Kopp6dMFAwggOiUa6/R8hpq17TkXXHvIJVv+qbREDLr7hoXh0 FKw7pEYEWkS3ucuoLzxEudl83n446wLl0bLvO4ulmSHy898wSNEmQDErcZZGxrdBV/na 00qLvO26ZxMnx9z3x7b00ZvVJLP0edObMeL8SQVYUrBgTnEWIrWB7HiBIYSyqZCWJdCH UDqMvhii0mx/VfuQZ4vRU/PloB5zC+yYPgD+faq0m+NCuSFme2eZobcNf/gTVfJRqq8X 3bXQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ionos.com header.s=google header.b=G9yMqb+5; 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-200319-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-200319-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=ionos.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id 41be03b00d2f7-6c35a0e70b3si7992447a12.261.2024.06.04.02.19.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 02:19:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-200319-linux.lists.archive=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=G9yMqb+5; 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-200319-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-200319-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 8A020B23B3D for ; Tue, 4 Jun 2024 09:10:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2BBE2144D3F; Tue, 4 Jun 2024 09:09:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ionos.com header.i=@ionos.com header.b="G9yMqb+5" Received: from mail-ej1-f48.google.com (mail-ej1-f48.google.com [209.85.218.48]) (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 485351448FA for ; Tue, 4 Jun 2024 09:09:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.48 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717492161; cv=none; b=YK5CVSpUMN8puR6ee4fkFX5DhhiQgLemKRhV1IOly3E1osjX1Lt1xyzHyB+bLF1SyxBDHstCb2d0XCQn1DwvGm6CZymIMLJ6szk7xqy+r6uoiD8IABU28igQD8lkabJtUZaa5it84++cUZtQFLNhj3StQRgHNgVeTTuqaZ0p0uI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717492161; c=relaxed/simple; bh=Cd4N3ppnIKo96UjuDYKqNAWCqoo7sSNwgSH8lYyi25w=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=f+f+zvXaeny9aQHjTcAV+3iDhe3vyCXpW6nrr8NvCVowdZEaoafIkpEFD2vVVQnzdM6ufz039ecHzR7cyFX9iaG62G1d88jtoPD1kzBrdHTXZ9EMZ7A78IfX8OwDR7wW7mf/Gt31LIXOu/SpvPOz40iosS6XjeArFU2ehvlvvZA= 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=G9yMqb+5; arc=none smtp.client-ip=209.85.218.48 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-f48.google.com with SMTP id a640c23a62f3a-a6265d3ba8fso75046666b.0 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=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=HwBsgjYa0IXOImdBe/4+bRIQcCY8SgWsOwsbDkpj0Qk=; b=G9yMqb+5y+fskP0M+Dp9D2JAnx5D8aYx6BCHwZ11OJr63fw0LbLiW79W8MpJHI1EeS /1Sj3Qg/sginyzX/kOyj8Pzszf7n3BZpDu/M8OnKRvlsD96QxTACULYN4rybY5zayT6o EPYXI4dZREftrLIz6fzv6jvSsG55lCpOcBRWKinTSpmKDLL7GdF0SO9u2VeCB0YCyR63 L0q3NNaz2y1K9xR4lCXg/mtylQHeIxMt6UmlHJG0rD6GnSIvJTe4M9UDeKOm017tWpiU VO1gHdwbTJyrU59cGsbT2KiWrVzDlLmki+0zqBipRA5lCHKI/oG9jGAY3vsnNRTKAnGh ptow== 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=I/8ca5HqSmI8ZrvaA0g0So9IVudomKv619mOXAdVimx7jgQ4vrL90gjSjpcgjltsnd PZ+mnR5G0jzKR39cjF6WyCuKL8NJs9Vl1mSmYK/4YpxVQZIFI4NptQtRKrrNg7k2Hr5J UVfheR5niZPfGH4JflaFJPbc2zmGYfjIRDUvQ+WdbFXr3ZFXUwGIhxkJ9E8w0Z0tEoWB WBpOFkWatFHl4JmTjMe7g6vLuvmmJmBLK0DuygPG3CRU+Y8f9Gxte5uKG2ds1zYOPKNT 6Bo4FfZ9NZkycKYQuNHzZgJxvyL5MGXdAitSQzwi07P0FXSFivW7rnu3wU9LRbUZ/Pyf d14Q== X-Forwarded-Encrypted: i=1; AJvYcCUkXEDPqSNvAVs1hi+Tgjmhr7VdA/d+wew0ErHZ+irEnHkcH9cOfyX/hbIL71uYZhHofBFmZtVlZrETUgV6Eo8gTNu782a6jGx7C73h X-Gm-Message-State: AOJu0YyalvCPU5UP1LCm3x2ywC4h8QPnjji7or51JRhn4GOR84zJFUA9 vsTeHopnlxRLTjsEgjpgwEdRGzlxH5TUaRjE4Lc1kxkUvXH3DwT484qrRocrWG0= 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> 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 | 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 */ -- 2.39.2