From patchwork Thu Nov 14 15:25:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Axboe X-Patchwork-Id: 13875211 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 2C568D68B31 for ; Thu, 14 Nov 2024 15:28:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 25EA76B008C; Thu, 14 Nov 2024 10:28:08 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1E8846B0092; Thu, 14 Nov 2024 10:28:08 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EDEFE6B0093; Thu, 14 Nov 2024 10:28:07 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id D54946B008C for ; Thu, 14 Nov 2024 10:28:07 -0500 (EST) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 70BFF121319 for ; Thu, 14 Nov 2024 15:28:07 +0000 (UTC) X-FDA: 82785080532.16.454D61E Received: from mail-oa1-f48.google.com (mail-oa1-f48.google.com [209.85.160.48]) by imf19.hostedemail.com (Postfix) with ESMTP id 0986C1A0012 for ; Thu, 14 Nov 2024 15:27:09 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=xLgOGZqq; dmarc=none; spf=pass (imf19.hostedemail.com: domain of axboe@kernel.dk designates 209.85.160.48 as permitted sender) smtp.mailfrom=axboe@kernel.dk ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1731597955; a=rsa-sha256; cv=none; b=HgodA5mbVd3VAzK8gQ2puGyAMmJJs0ZAz+XdCXEc2cij1jZa8uwQkypW8xnSeCZ8ClkX/w 589e9Tt1+fDePhSXO4PNyPxaFIaQ2PPC2kIhogj8e3KsNDblY7MQ4CCqXyNsHpYxy6IqJu x+toXhCT6w/PNijU11twvw72gnw9usA= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=xLgOGZqq; dmarc=none; spf=pass (imf19.hostedemail.com: domain of axboe@kernel.dk designates 209.85.160.48 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=1731597955; 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=G7YIma1TSdS4GVKncfhre22V8DGIHalzmKUoqzgwI0E=; b=IqVLl4WluVvxMuI5Ce1aZVxAo0AhXtJIRGOlXh9/VSIvw4ZW/tkI8HjbHX2BvAl7OHhBIm cDiIKZLFsFRvjHdqhb2GSuUfsUSMVjyPFVJEInP5vH5whjVezOXxEV4Fv+0elClmDo3jt1 ibnj8Q5dnvQG4Ag7hILmkmgl0+6XMuQ= Received: by mail-oa1-f48.google.com with SMTP id 586e51a60fabf-28c7f207806so322602fac.3 for ; Thu, 14 Nov 2024 07:28:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20230601.gappssmtp.com; s=20230601; t=1731598084; x=1732202884; 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=G7YIma1TSdS4GVKncfhre22V8DGIHalzmKUoqzgwI0E=; b=xLgOGZqqQa4IzxNpGKjWC9oZ5n9hhWEtTL+sanUUdVqKlIxXP1QT1da0/gnwC1lcpp Ir7+Njrwyz3oh5Sbj1aa75IjI8yNk9u4NlOQ7kPBhKYgWA1EiYRp5Vp8Ubh3w3PEP+MI ekditAE+l3UxpHg9/QF7m6zLsgDknot6CO4tLhOK98GgkdjJMZvoAhrt94i+Bm3hTxIL 4H5G/kDugapP02b5Ie6jwVPX2xLWxo0WvJ3DovKTgfSViXnN+F5YHyyaHOglL2W++knL 74AY9/V4RWxSglii0A3C256K72LSIPkmEHH2n+AeY3K8xn9Bed5dy+gCUHeZvc1WuCOs bjug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731598084; x=1732202884; 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=G7YIma1TSdS4GVKncfhre22V8DGIHalzmKUoqzgwI0E=; b=c80IYsEwXnr8n7uDnKKOTDBxHhqqr3esGoi43sFpMeQ22MhxjYh4CfYOSt1ZCxCH/W ONQfxaFex2o71yghw39VdJ3vbAH9gSEDi3GXVxzo7OoNd8mvkPuD9jdEiN6Ev1K2j796 mOWNIHw5jIlqf1TjLoQC7tLvwF5s0eKRbTuOWgdK7pAn3yc2gkmmS+sapVSm9VH2AZMw bG6HfPPpOyy5BqJ4uxWvfB/epGC/SuweZN0DborufEQzINfLrvU64YUWcsOiaAxVrAyj kiKqeYW2XgC2fNA1m55JebWGB9qq+kJnd1huxRJJkD/YJfki3pVquUaW7Nn9sf13Oyhl za7A== X-Gm-Message-State: AOJu0YxUKJd+39VAf5YD3GUtM8Ab+hgyDqjZZW1gJRZjWCmql2Gxs/iq 2ZX6S66368WruMdh6chw3fxJ8J1KS77QN7ULfFwsMZK680m5fLU+Yodp1oJv/3AZwkcJYcLJ9zH ioj4= X-Google-Smtp-Source: AGHT+IH6odaDwIdA82zwSIWff/OaVLT9OGNonkILORb6hdBpcBvYTtZBZw+TFEiCAtvLZtie7sKouQ== X-Received: by 2002:a05:6870:5d8b:b0:277:e512:f27a with SMTP id 586e51a60fabf-295ccfd9242mr11462005fac.16.1731598084309; Thu, 14 Nov 2024 07:28:04 -0800 (PST) Received: from localhost.localdomain ([96.43.243.2]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5eea026eb41sm368250eaf.39.2024.11.14.07.28.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Nov 2024 07:28:03 -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, linux-btrfs@vger.kernel.org, linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org, bfoster@redhat.com, Jens Axboe Subject: [PATCH 02/17] mm/readahead: add folio allocation helper Date: Thu, 14 Nov 2024 08:25:06 -0700 Message-ID: <20241114152743.2381672-4-axboe@kernel.dk> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241114152743.2381672-2-axboe@kernel.dk> References: <20241114152743.2381672-2-axboe@kernel.dk> MIME-Version: 1.0 X-Rspamd-Queue-Id: 0986C1A0012 X-Stat-Signature: 7ra3rc51pwiw6sprthp5aewbmad6jt1u X-Rspam-User: X-Rspamd-Server: rspam05 X-HE-Tag: 1731598029-9528 X-HE-Meta: U2FsdGVkX1/81vQkJosVEAhzzSh4yXzOXkc0Gc1JtylnezPKSutfcAoBdS0z+HQDs2F6ayMJQEupmtUaITYbRvIOIwTPzwBK+imkwZYkA9Cs8e7tFBoC+U5pdxrQALAPxCza+FQTt/bZU666ityOqQ6UPIwv31jsA/b0aeU/8e+uWb88t+98dshgMoj/4Fs0uh+n2HSIxllsWV4crGLOppsIV2kSjQvHSZcjdIAZDjKe+KXaDstzWmhCZQyUnLURRKoRR7kvv7k/+Out2B1B68t67g3s/DxRutAsFvAX6MIEXGxza3KM+7g3XIW3ocCU+Rp8/9S7g/M387/malfCsIu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m@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 3dc6c7a128dd..003cfe79880d 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. @@ -260,8 +266,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; @@ -431,7 +437,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; @@ -753,7 +759,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; @@ -782,7 +788,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;