From patchwork Tue Dec 3 15:31:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Axboe X-Patchwork-Id: 13892619 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 9BC01E64ABB for ; Tue, 3 Dec 2024 15:32:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 55A3E6B0088; Tue, 3 Dec 2024 10:32:52 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4423E6B0089; Tue, 3 Dec 2024 10:32:52 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 296D66B008C; Tue, 3 Dec 2024 10:32:52 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 063BC6B0088 for ; Tue, 3 Dec 2024 10:32:52 -0500 (EST) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id A759EC0A01 for ; Tue, 3 Dec 2024 15:32:51 +0000 (UTC) X-FDA: 82854039744.09.5801185 Received: from mail-oi1-f181.google.com (mail-oi1-f181.google.com [209.85.167.181]) by imf01.hostedemail.com (Postfix) with ESMTP id A6C134000C for ; Tue, 3 Dec 2024 15:32:39 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=iGaGUsAi; dmarc=none; spf=pass (imf01.hostedemail.com: domain of axboe@kernel.dk designates 209.85.167.181 as permitted sender) smtp.mailfrom=axboe@kernel.dk ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1733239963; 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=5mQz2vdNaN9LdJ9L4qyJBm7ibQRSfX5SzH0nqDyaIZA=; b=aizupOTEF7MXDv27zlO5cMuL6iX6dGKOEoJq5tHNQKndm9DgqkMsZ2g93TbXouSVRntcUW Lu2jlRKlZiiwZmqbufG0K+hDSTWFVfRHFTGtgFJA8SdznRF63hUOtp3oLT3hL6w31zBbGT gzSQ+LqO7GYKtb+tFgzUeZwn8hc2rm0= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1733239963; a=rsa-sha256; cv=none; b=yRpZ2GX5dvwgAAT65Dllqq9V3BWXPSSL40nNJqQcSTUglm7Ozx/Nnvgmneh/A4ZsTrryb6 W6ZlmqMjSlUvFxwtzX4/1UUrH2FJJnqVDCzaz5jjGSwQoWf0i3mmtrWhi+J5ZkEwLuSA/7 hxdhBeqCExzo5Om1tDg8fsDXrXdD57Y= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=iGaGUsAi; dmarc=none; spf=pass (imf01.hostedemail.com: domain of axboe@kernel.dk designates 209.85.167.181 as permitted sender) smtp.mailfrom=axboe@kernel.dk Received: by mail-oi1-f181.google.com with SMTP id 5614622812f47-3ea552bb91aso2362576b6e.1 for ; Tue, 03 Dec 2024 07:32:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20230601.gappssmtp.com; s=20230601; t=1733239968; x=1733844768; 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=5mQz2vdNaN9LdJ9L4qyJBm7ibQRSfX5SzH0nqDyaIZA=; b=iGaGUsAiPGqpwrCDD4+5nkz4d7R49osJBn+6IF39ckasruGOFWBwnNv89bB74Tbf63 brdlx7q9U0fC6kDQWQUZqffDRt7Wyfbrcz0FiQSkk02nnGT+F0+EvVo8DsOb+vLrjNTB Hz/DM0WrsrBPZ+EdjO/igKxlXlncIZ5YQf1IoBe3bJq8PELwet/rvLrnjeTQoyeKEIf2 ls5YtSmZbed6zv2K1bvggFqMzEWg9ylSAmLBYAllyiL4yRx+wKJBMyqruDBmALsA/Vpb +kQ/eCK+zTagtLaV+LnvJrmRLCIAOeQwm72Ul9EeYN2QYGddR8ej/z8y9rKM+lywjdaO kiCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733239968; x=1733844768; 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=5mQz2vdNaN9LdJ9L4qyJBm7ibQRSfX5SzH0nqDyaIZA=; b=RC+e2JFObEKXH/FWXHjz5cDiGKhPHMiHlyAN/RZ0JoFANNPyAVZurrCY52vYtrdU8e v6vI7hyEyxty0EK47F1V+EsWgTVVb9DXb8DD7sSJEqArbSFoCIurZOfxkwbODrehCe0K yEgcLcb5mTbLGvoKtjgxtBdco5dzCcT//oLzUP+XjIeIX9QMMd7l5eEGQOL+A/0zDWvv 6Twttb+5G9EN8DomIw4uq2qqfcdNnQf9qTjIO1w2iQsG7v2lVORSZjGNVuG85ezzt0FI u4tdz6JfKidNDIj6OwiRZdBDW/SAaWwKxd0/IRu3i9ooktc7kvvno8ma6UgM2QS6D84v cFnA== X-Gm-Message-State: AOJu0YzmFBBWZDlZL+LcLjz/jal8GskHE0zUrJj9Kvgxz1utFOEwuVhh 45p3rhx6y+R9Sp0UPuVcrWTNtqqo9A5JtgMwLzbNirqESfrwUwfxaeQrb/L2YlNa7Jumocmghzr G X-Gm-Gg: ASbGnctxdKtUJKifeVBhbVuWFgIL2SzcvphNP0o5BgliOIndyoGvSuYC7txak4T3AYn u9kPh2gp4rPUYyc1P0a9dvNb6XwVh+8EV6vtubUAbxsVQ57O4gGoUmyUY7lGqb9gfz+wGzwhYOR KWZ5YZnyX47dprnmGiWnIjn1BEej8evAJr71iN3fVptoywEiSImZg8sYHOOFToaZyF3glA4ObN5 sErr8utg+MslnBUIjxWqyqQonp2+lQqs9gmYGSEx4KtK0jv9l6s7nIidtc= X-Google-Smtp-Source: AGHT+IFPC3QIjfGmFueYpArbFjHsCE/nJs1cTRfjgQkZc7hdX+t3EH5eMgGO4h5vvPNqW5LyAgQfEA== X-Received: by 2002:a05:6808:1454:b0:3ea:45d1:de13 with SMTP id 5614622812f47-3eae499b2b5mr1606169b6e.11.1733239968341; Tue, 03 Dec 2024 07:32:48 -0800 (PST) Received: from localhost.localdomain ([130.250.255.163]) by smtp.gmail.com with ESMTPSA id 5614622812f47-3ea86036cbbsm2891878b6e.8.2024.12.03.07.32.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Dec 2024 07:32:47 -0800 (PST) From: Jens Axboe To: linux-mm@kvack.org, linux-fsdevel@vger.kernel.org Cc: hannes@cmpxchg.org, clm@meta.com, linux-kernel@vger.kernel.org, willy@infradead.org, kirill@shutemov.name, bfoster@redhat.com, Jens Axboe Subject: [PATCH 02/12] mm/readahead: add folio allocation helper Date: Tue, 3 Dec 2024 08:31:38 -0700 Message-ID: <20241203153232.92224-4-axboe@kernel.dk> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241203153232.92224-2-axboe@kernel.dk> References: <20241203153232.92224-2-axboe@kernel.dk> MIME-Version: 1.0 X-Stat-Signature: afis7rwwauezhkzo8m98axwtyjigzyuq X-Rspamd-Queue-Id: A6C134000C X-Rspam-User: X-Rspamd-Server: rspam01 X-HE-Tag: 1733239959-814584 X-HE-Meta: U2FsdGVkX18zgXsAAy42QRGJfVmQ/+b4sStUI4wLdzxwjIPJeeDm3SC/2wYhfKst1dfqW4LVql7iVLA85teqVW/GGT/Z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eeLTtW62x5Zu6bitE5UFk/sp2X/8K5Uvma7nlv6UlhhxbNh8pbA9jZrc3GoVmg7Bq0oDKZxBPDoQPbaUPBE0S4/J33DbkQr0IM+QKTz3wBNXpvQBstSFHs21Ya7g1qQotv4= 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: Just a wrapper around filemap_alloc_folio() for now, but add it in preparation for modifying the folio based on the 'ractl' being passed in. No functional changes in this patch. Signed-off-by: Jens Axboe --- mm/readahead.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/mm/readahead.c b/mm/readahead.c index 8f1cf599b572..8424bf1b67e2 100644 --- a/mm/readahead.c +++ b/mm/readahead.c @@ -188,6 +188,12 @@ static void read_pages(struct readahead_control *rac) BUG_ON(readahead_count(rac)); } +static struct folio *ractl_alloc_folio(struct readahead_control *ractl, + gfp_t gfp_mask, unsigned int order) +{ + return filemap_alloc_folio(gfp_mask, order); +} + /** * page_cache_ra_unbounded - Start unchecked readahead. * @ractl: Readahead control. @@ -265,8 +271,8 @@ void page_cache_ra_unbounded(struct readahead_control *ractl, continue; } - folio = filemap_alloc_folio(gfp_mask, - mapping_min_folio_order(mapping)); + folio = ractl_alloc_folio(ractl, gfp_mask, + mapping_min_folio_order(mapping)); if (!folio) break; @@ -436,7 +442,7 @@ static inline int ra_alloc_folio(struct readahead_control *ractl, pgoff_t index, pgoff_t mark, unsigned int order, gfp_t gfp) { int err; - struct folio *folio = filemap_alloc_folio(gfp, order); + struct folio *folio = ractl_alloc_folio(ractl, gfp, order); if (!folio) return -ENOMEM; @@ -751,7 +757,7 @@ void readahead_expand(struct readahead_control *ractl, if (folio && !xa_is_value(folio)) return; /* Folio apparently present */ - folio = filemap_alloc_folio(gfp_mask, min_order); + folio = ractl_alloc_folio(ractl, gfp_mask, min_order); if (!folio) return; @@ -780,7 +786,7 @@ void readahead_expand(struct readahead_control *ractl, if (folio && !xa_is_value(folio)) return; /* Folio apparently present */ - folio = filemap_alloc_folio(gfp_mask, min_order); + folio = ractl_alloc_folio(ractl, gfp_mask, min_order); if (!folio) return;