From patchwork Thu Feb 22 11:50:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 13567168 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 B2F45C48BEB for ; Thu, 22 Feb 2024 11:51:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 359F76B0083; Thu, 22 Feb 2024 06:51:13 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 293436B0087; 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 F14A76B0083; Thu, 22 Feb 2024 06:51:12 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id CCC266B0081 for ; Thu, 22 Feb 2024 06:51:12 -0500 (EST) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id A440680D93 for ; Thu, 22 Feb 2024 11:51:12 +0000 (UTC) X-FDA: 81819273984.19.2BFC4C7 Received: from mail-lj1-f174.google.com (mail-lj1-f174.google.com [209.85.208.174]) by imf12.hostedemail.com (Postfix) with ESMTP id B68B840011 for ; Thu, 22 Feb 2024 11:51:10 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b="L1UxO/mH"; dmarc=pass (policy=quarantine) header.from=ionos.com; spf=pass (imf12.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.208.174 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708602670; 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=B9RcqoFubCuQScg9fnwnkgqqvXJKp60zqkqXexg+avE=; b=u+eYp1E39I2jTzIbURUz/te0yzrADk6L+YLLjgEP0xXujRji7Pbxu+KJRbdDE23i8MZbKH jvqpU49GY5TbbTV0k8Tv8BFJtgsyBQr6BRoMEAuUvlYG8K5q/q89ec/0GdqNKtYVHn/wll rmdU90U8m1aOv+xuhsecqpz0GuO0pMI= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b="L1UxO/mH"; dmarc=pass (policy=quarantine) header.from=ionos.com; spf=pass (imf12.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.208.174 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708602670; a=rsa-sha256; cv=none; b=008ARiK6A8Z8LsaSmwauX7RCZidBxAcJyjZ6N8ud78/BLoip9ChCSeor+GZJGJOTlLOchv +i68JZqlli75CABz0pn7ktI3qBKlxhF/56ZaVZwAz08x46vJhbChA/YmDexTPDnU0l8P/B fKjqenYXh5MmY4OOwBOCcqevrL57qOo= Received: by mail-lj1-f174.google.com with SMTP id 38308e7fff4ca-2d26227d508so5279881fa.2 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=B9RcqoFubCuQScg9fnwnkgqqvXJKp60zqkqXexg+avE=; b=L1UxO/mHPYpeimDVcBNl8/jL1vZotIhfxT9pnmnI1CaCxoMuiGRYkg+IYC/7V8n8xQ 7OcBiFRgjAa9T2I3WetVlTdzb8B6Dp6X4uyDw/xQL6BMyicWyU+EG4RPt87hp9tP0xcQ S+nW43nQIH5zGOtvZBL6sRr4aazNgMGiPO2ss5X3Xy/w/ZHK+KJQSxbqJ6F4yWEqS+YL dtNOgRH+QKxx+YRVjnTE39QcXbyC6wVfYzP8TfmE+Q2pnuEWPUZ7MbfXa+retzGI9UPo SJZvCOzjfxvLkUd7BFjcXmY5Lifx9P+Yp218H30sXYs/YuCKrHkLfd7osGMPTQrzVBqK dneg== 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=B9RcqoFubCuQScg9fnwnkgqqvXJKp60zqkqXexg+avE=; b=MDg2cUMPU0kNOgu+RTWNw16Lx4egs0CH/aSIukklku36shmc3GBwV37y71md0PKSoO MJhJ7PQsDoDLfQMnW/TBhVrGRP5pcm6zy8z4UNwDVfSH2BqsHb3/69WN1i/d+L0I619S 66b2eV0B5JjKjxmfQzfmmRHDw5VbJtQw0ZuOyJ0mjZCzIOs+uSTcNKr5S6LepV3cC9N/ Cv1Hnk2/WbC3iEWlB7NcVvBvdcCRL7gNzUk0+vx6Um8Xg0SfZTsHHpZfUkEyRO7oXtPw jJZUCtW2JmBnNmsSerRb6yE3BB4+WbzgqI04PD1fQU7ODBShKtkYO5CizNcPnj4Ze1bA oIIA== X-Forwarded-Encrypted: i=1; AJvYcCV5di1lKQTI65yKGgoRic6IeGHGc+8x2/Nyn+JawEVH3a9gmxnfIQgaNoF5hFxY3FcHNaWYI2bhCAGgTPY5/OXnbh8= X-Gm-Message-State: AOJu0YygFZlyw24whhntsDQ5RaVA63b3pT2enZI7NA99sravCAgH39mz RwzQWU+GfU8Cy+2+Q5yolzE63JOaDh3DqvSUtIl7jCJi1V7j3KJZYyRw3X+vD0Q= X-Google-Smtp-Source: AGHT+IGYV+VkpS2jnAWZLT/C7Reb89sTXA/vTqKXcqskIPNbelgHAHgf9vgjrOTAJQbjmnMw0na1/w== X-Received: by 2002:a2e:968e:0:b0:2d2:43fd:391b with SMTP id q14-20020a2e968e000000b002d243fd391bmr6042449lji.26.1708602668784; Thu, 22 Feb 2024 03:51:08 -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:08 -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 07/14] linux/mm.h: move folio_next() to mm/folio_next.h Date: Thu, 22 Feb 2024 12:50:48 +0100 Message-Id: <20240222115055.1172877-8-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: B68B840011 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: 8w8s4opafsedfught18e89b5qjea3ber X-HE-Tag: 1708602670-612110 X-HE-Meta: U2FsdGVkX18kttiuWJ8kKAFDI1jItIHF6ngM/Og3yf39IOyPFZFyWKG/OZpyWhmrDMZNMVorxYf6CZboskzAQcEy/oaegOCEqEljxCNJtuZEiLCP4bBtRZl5U+ZAzHaB0oydfVJ9AKLLBCa6nwfF+Iy9bOYy5AIbxUMXA7gsYTcBIq9VYRA04HG1KGkbd3pd4cs23GVIiJlbX4zZY6KIcxWfrJ5sT3sHjGFaxwqwNaBE/qf1WvHaQkqcQuHhMGir1PjhpsokaL5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anSp6ecFZcNs2KXiMbevutYee6MWXYIaQRDR86t+CIb4svIoNpdl7ogSXpT+0lZeYH4IINQsBo5Sq63/t6iIwd9QfaqTCcc5fwV8AyDPo5rDVR5x/8g== 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. 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 9dea6477b4ac..7d83d6d64f30 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 @@ -1907,25 +1908,6 @@ static inline void set_page_links(struct page *page, enum zone_type zone, #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 */