Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp942779lql; Tue, 12 Mar 2024 02:44:49 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUaCT70Bo7DKtiOhHRjvlEKCYiv6lwENVWav2fap+MlpLvSoQrB9PCUY5d28hdQPSMu2kNyNgMp3Tv2AdQk3GutxSteK4Uzb728f5rdWA== X-Google-Smtp-Source: AGHT+IHNcMS+/iCYmy1GrG4oGcj7yvV6391/Z1M2zgcbMXR5WVdZN0NVZ6M+Qo9rhdigMKcDKhQg X-Received: by 2002:a05:620a:1343:b0:788:2f11:4851 with SMTP id c3-20020a05620a134300b007882f114851mr10416058qkl.41.1710236689040; Tue, 12 Mar 2024 02:44:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710236689; cv=pass; d=google.com; s=arc-20160816; b=fDZPS/WBNdTnKoVHl0yawjE6xy5zjWN1cvseiZGx6ivSQHNbZcw4nvEUiGZzVkPFOm Fc+G9SRJ3LE73hTw+oThfW5kw1SkSs6maNPN5m5WHdkezKvNDifH4eLIQhYG+e+HllOy 4F0/k2uNdW7kMLoG1xr71as/aXFK5tRWUcSxZyEjwJa6QK7WXiPs5yjmGTKQRiWViVJb +DKg94mdEsXpeazx/lM9VHQ831zIh6wmKHWbfy0QpXY2pu0ai8FYCotWdNqQNiyJQ82h 6anxgppi7w+nb+VnTGmxlXeV/g/tSS6vi35447u+9faulonTswthUVuV3IQSWCmkklpf ZrdA== 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=tPRAHmknVEgQF0+eI0cWSAplWfhzwY2EyeY5NbL7yXE=; fh=wvWzxv0gVRoI3YuFz0CdrBMfXpyaIxBLUtJx7Gtf+oE=; b=No4VSVMIDu8Y4pOxT1Fmb3dgN6EZ/b+GOSmHGgX2ykhkJXTlhF8P0tYxU0vIFT42hb uUL+ONgKKb0rwJFpNI0QwX00fUYmRvfOq+55lTcUL7/GuLAXIULJ86bUUCJiStaBL/yQ eLJSJOkxK0E9JhLHQpk5tB1iBxi72xzvQblBIQF6q/8vnsrmvqWDkiHiCB9v7EEJwBDB BRJxXCEFLOj2Nogoa/RWpaa22g8D939TfciihwWZkxh39tj3gNbxeXTzFLM4sCXgDcRf M3y1bDbtckzFkxZHMhgx/GGqDXJ2FI33oZ8ULd8oYy15ljvdAIZn1+dd4wHJ9/ni2esj Qq5w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ionos.com header.s=google header.b=RspeanrF; 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-100048-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-100048-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=ionos.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id eb12-20020a05620a480c00b007881d5bc2f8si7426860qkb.665.2024.03.12.02.44.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 02:44:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-100048-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@ionos.com header.s=google header.b=RspeanrF; 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-100048-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-100048-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id B213E1C21365 for ; Tue, 12 Mar 2024 09:44:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 374CE7B3D3; Tue, 12 Mar 2024 09:42:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ionos.com header.i=@ionos.com header.b="RspeanrF" Received: from mail-ej1-f49.google.com (mail-ej1-f49.google.com [209.85.218.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 12FED78662 for ; Tue, 12 Mar 2024 09:41:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710236521; cv=none; b=uifIwy06lYilxAUXMqo2pir4ome99wBc2Sk++jhgQDBs5bdtUANP1BxIT3a20vz7iueihzLRmgDFRlg7hDm+U24Vj4lvKebUopsDbKPdTR3OhDKfIbBXWmIYnI/tZjgXoFrUisDXhzpmAq2PIG0VMNKOWD/7vOh2Q0lM+xi7+ws= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710236521; c=relaxed/simple; bh=vokolUNNjWemvOpIVyP0bPJJZO5YFTXD/1zFkqXp+GE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=HvRJW69+ELHKEJk7z6fHvN7J6J/35HzkQlGDHEiQJ2ZDi8VjH771/87DcY75BRHn+fCLGvFHvPGXhzuuOdFjrRuSKPwwTg6llsOEpfHxLMVPfVlnvx2D5I3TZp34WYpkbdyXrxpQOuMy2W5+q9+tqy/G3LkAPoWpONUkCUJ5c6Y= 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=RspeanrF; arc=none smtp.client-ip=209.85.218.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-ej1-f49.google.com with SMTP id a640c23a62f3a-a3ddc13bbb3so1131195266b.0 for ; Tue, 12 Mar 2024 02:41:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1710236517; x=1710841317; 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=tPRAHmknVEgQF0+eI0cWSAplWfhzwY2EyeY5NbL7yXE=; b=RspeanrFD/iO01lBT5nrw8I7iMYd3NbB9Ceo6iyTNq4H9h3B54jDqJb8vIXDRy0G5r 7u4VIZ+lLArqMMNqdxoCP23kpuW9/9zF5BoKINhqnopqf3jPLYEh20XD8y0XZFGTl1y6 +0C259SkRzjizGfVG2+gFXlZ5PuseDNBpPqHnOUJo1J8csUYEq2Ww44E72GFEi2hAB2U 1KTkPl7MbtmAtIJHlsTSF+zRB0soTTgECmU2GWmBhYJJyTwqc5ChAVqdxHq9p46h40rw 8OeBd1CQtNr/7+hcAYp5D/DAn/7XLGG8OcKLvnNVda6vi2Ubv2xVgCXwHv/SJPPXOX9p 7IsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710236517; x=1710841317; 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=tPRAHmknVEgQF0+eI0cWSAplWfhzwY2EyeY5NbL7yXE=; b=VASNjpZI4IwDCzKw0pCKRZp9kd38WUaUCPqgj4NrJBYXbrJNOqCmHJ4WKOUJ/4P9hk OGjMstnCuZp5fS4zkiqgMXQng0AfenD/IbiCs8DPFbCL7wtZl0m7nQu8iyXjp36IwuOU Z8dbNmDvm4f/YTMY+F/jf073sIF8Q/fpuTG0CSlBDUmuVAokXTuJfz7C2hBzWP2934wf +mhIoNlSa0rr2ybe7GEdlpbQHWpe6yNx+ScmRMBQ7iCbQbe7ok+RPn0sUi2sdPaKT2/s XLB/uzY8AGZDN4yXy4x/cTQn0K+9t0blvLft7jPKhL2yR3tCbXsR00oaHv3P2VU04HHc S0oA== X-Forwarded-Encrypted: i=1; AJvYcCV8y0CZlOAc0wik9wKE8G0QjiGLIcOulMD6h4uhk+SpkoOPabo0W+5VeqZK5j3OzvXvduBGdVaaIeEndSluZnWLSNUFLLl6rkJ3i8LG X-Gm-Message-State: AOJu0Yypa/obI3+r5rU81shum0HTpCLqOo2wwR4brVsrE7Bn74ZHuGcs teecdsEKpzN9KkdqPOx/5x3L6hQvlwOIh6B+ccyDqUUsjtPwov8dF5SBjBc7p6Gp6IT/o5bSfQY Y X-Received: by 2002:a17:907:868a:b0:a45:b616:29fc with SMTP id qa10-20020a170907868a00b00a45b61629fcmr9967232ejc.0.1710236517463; Tue, 12 Mar 2024 02:41:57 -0700 (PDT) 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 jw22-20020a170906e95600b00a4623030893sm2091961ejb.126.2024.03.12.02.41.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 02:41:56 -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, Max Kellermann Subject: [PATCH v4 08/15] linux/mm.h: move folio_next() to mm/folio_next.h Date: Tue, 12 Mar 2024 10:41:26 +0100 Message-Id: <20240312094133.2084996-9-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240312094133.2084996-1-max.kellermann@ionos.com> References: <20240312094133.2084996-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. folio_next() is used by linux/bio.h. Moving it to a separate lean header will allow us to avoid the dependency on linux/mm.h. Signed-off-by: Max Kellermann --- include/linux/mm.h | 20 +------------------- include/linux/mm/folio_next.h | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 19 deletions(-) create mode 100644 include/linux/mm/folio_next.h diff --git a/include/linux/mm.h b/include/linux/mm.h index 0d291ff61db3..e6c2df977abc 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 @@ -1922,25 +1923,6 @@ static inline void set_page_links(struct page *page, enum zone_type zone, #define MAX_FOLIO_NR_PAGES MAX_ORDER_NR_PAGES #endif -/** - * folio_next - Move to the next physical folio. - * @folio: The folio we're currently operating on. - * - * If you have physically contiguous memory which may span more than - * one folio (eg a &struct bio_vec), use this function to move from one - * folio to the next. Do not use it if the memory is only virtually - * contiguous as the folios are almost certainly not adjacent to each - * other. This is the folio equivalent to writing ``page++``. - * - * Context: We assume that the folios are refcounted and/or locked at a - * higher level and do not adjust the reference counts. - * Return: The next struct folio. - */ -static inline struct folio *folio_next(struct folio *folio) -{ - return (struct folio *)folio_page(folio, folio_nr_pages(folio)); -} - /** * folio_estimated_sharers - Estimate the number of sharers of a folio. * @folio: The folio. diff --git a/include/linux/mm/folio_next.h b/include/linux/mm/folio_next.h new file mode 100644 index 000000000000..7016e303439c --- /dev/null +++ b/include/linux/mm/folio_next.h @@ -0,0 +1,27 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_MM_FOLIO_NEXT_H +#define _LINUX_MM_FOLIO_NEXT_H + +#include // for folio_nr_pages() +#include // for nth_page(), needed by folio_page() + +/** + * folio_next - Move to the next physical folio. + * @folio: The folio we're currently operating on. + * + * If you have physically contiguous memory which may span more than + * one folio (eg a &struct bio_vec), use this function to move from one + * folio to the next. Do not use it if the memory is only virtually + * contiguous as the folios are almost certainly not adjacent to each + * other. This is the folio equivalent to writing ``page++``. + * + * Context: We assume that the folios are refcounted and/or locked at a + * higher level and do not adjust the reference counts. + * Return: The next struct folio. + */ +static inline struct folio *folio_next(struct folio *folio) +{ + return (struct folio *)folio_page(folio, folio_nr_pages(folio)); +} + +#endif /* _LINUX_MM_FOLIO_NEXT_H */ -- 2.39.2