From patchwork Fri Dec 20 15:47:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Axboe X-Patchwork-Id: 13916934 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 BB577E77188 for ; Fri, 20 Dec 2024 15:48:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0F8E26B0089; Fri, 20 Dec 2024 10:48:43 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0A8196B008C; Fri, 20 Dec 2024 10:48:42 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E15666B0092; Fri, 20 Dec 2024 10:48:42 -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 C14056B0089 for ; Fri, 20 Dec 2024 10:48:42 -0500 (EST) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 6F56B140B37 for ; Fri, 20 Dec 2024 15:48:42 +0000 (UTC) X-FDA: 82915768404.01.84D085E Received: from mail-il1-f181.google.com (mail-il1-f181.google.com [209.85.166.181]) by imf25.hostedemail.com (Postfix) with ESMTP id E9250A0015 for ; Fri, 20 Dec 2024 15:48:15 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=nBCU5czp; dmarc=none; spf=pass (imf25.hostedemail.com: domain of axboe@kernel.dk designates 209.85.166.181 as permitted sender) smtp.mailfrom=axboe@kernel.dk ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1734709704; a=rsa-sha256; cv=none; b=mfX2SPYphpNJICF54s9jowzm4rNt8NNz8KPX4YmlEaveRwdwlCb+qA3SKPnj7+CABAEMlX il4wIsREU3AlcfN4NXpDXBNpKAr6IIDv4pIG3Nm4Aw9o3FcOwTlZEC+EklOJWB4f49NiD/ 5OOsQGzCQWwS63XvJzRPobxAvbRZKTs= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=nBCU5czp; dmarc=none; spf=pass (imf25.hostedemail.com: domain of axboe@kernel.dk designates 209.85.166.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=1734709704; 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=U1i1r3ArZkX2vgdPDoEq+WK9gDY1/MkPULwwiAP9Trg=; b=u8I8pJLSAP2GEYYKpT1RNd3tgvbULfp0FGZvm6T2HtfSJ2JZfBFlKGVzUK00wPIH1228Tt VxqLTqbYmigeN5t5F/YrDXgWxwFqwmoUKP8oweNHoM/i0s8FNvufVxE9R1/5hDhLfWHs+p m1iwCQZFKOrHvQRe3EK0ACQmV529tBc= Received: by mail-il1-f181.google.com with SMTP id e9e14a558f8ab-3a9c9f2a569so14406105ab.0 for ; Fri, 20 Dec 2024 07:48:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20230601.gappssmtp.com; s=20230601; t=1734709719; x=1735314519; 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=U1i1r3ArZkX2vgdPDoEq+WK9gDY1/MkPULwwiAP9Trg=; b=nBCU5czpKD6Sqov21UNXUmeypZSA5OMPvkAEb/bBb556wW3p8NhthQnvcLF5XnMBve BFZqf/mkpWlfkmY3o1cT69SC/mev4ha9137TLupUwTuXe5wYuhckFnirEyp8of5u8WSm YAGpH1aqMI54cIi8wN/Zh1FybH6w0n2caL9OUbFoP5K4Y1BeNh48UR/AJ4ORDmEduNz9 k3DPj8dWSN2QKcaHzJTdcmWO+N18n7XDuMKaiMQK45TWYbfNFsLpVDbzkNMVwfO0qVso c1W20TDrjP0B5jcfqdsn2ZNfMXAF16zCWEk8F9WzZNQbmne/8Tj8VIEzeMZTczLZpves ylHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734709719; x=1735314519; 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=U1i1r3ArZkX2vgdPDoEq+WK9gDY1/MkPULwwiAP9Trg=; b=JzahqpG95W4QWeDLPdtig6c0Cr53+nl3BDa4zmGz4LVl5mhdd83azE26MxGBFhPix0 KN0caYLtQmh/H3BdrSUh4d8VLT3O+z4jp6fVO7YIz2NHihf8Ok3NIuzFrWmk7IdWOeX1 ls6LKLE60WIlHTt4VQDOj/k7+t6g1+8n+9O37GELW+OOPMbR3b8iLPfV9aNQNFFCIhz6 ALqF7hPrJ/nIre+KQJjzZ0c2W0w+BoOcMMvWXTq1UAy5oR4jN9n2azjlchD5QGTc/Up7 9aSJCnfgpKhliA7F5SqdFXna0SDSXBkSCjNDbAifNGe6ppz0MXzwEsLSgQIB1FzxB3/Y 64Hg== X-Gm-Message-State: AOJu0YzN5e7T0HIChEoPMBcVd5FriqKhNXgiPwgbpMvixytYNVCeZDPd CFKjAYfrPZC+nQgDH+y6OouIcURUUKGvfoDmK0i7gBRDraIV+t2z5bGiBAtcYcLIHkl3Z0IoIkd 4 X-Gm-Gg: ASbGncvOhmIDT31af1+gEqlR07Vqhxk27fXZMbC1T2Xd3JqOB0g7Y2Ua+fP4ndI05iR 2XBDEztWXlzoE2Lkiq32dNQPKeh8gwRLRasWrIBOcUKK2AN7DC1K3HTjiYWqJewpQZ+euztvDeD QRCs2UEuaq7d3cRm4kM28dcIwYsw1I41GTNAs4bO2QZLrOXDX7a4gtlr//DvsP/GI9prp3M0MNY UVKKHbC20aU36dlFjo7zwqZ/mNbZMO2zFRD2c5CdHP4bxHL5ECopiJbtzMW X-Google-Smtp-Source: AGHT+IEQ+rQahAFsMNf0wBgiaHc3ybkwynnm3ue1l0Cc7XmizswXF3l+0I9aVhCYoLyroOrTRrUFJg== X-Received: by 2002:a05:6e02:1ca5:b0:3a7:88f2:cfa9 with SMTP id e9e14a558f8ab-3c2d2d50b1emr32075375ab.11.1734709719216; Fri, 20 Dec 2024 07:48:39 -0800 (PST) Received: from localhost.localdomain ([96.43.243.2]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4e68bf66ed9sm837821173.45.2024.12.20.07.48.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Dec 2024 07:48:38 -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 , "Kirill A . Shutemov" Subject: [PATCH 03/12] mm/readahead: add folio allocation helper Date: Fri, 20 Dec 2024 08:47:41 -0700 Message-ID: <20241220154831.1086649-4-axboe@kernel.dk> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241220154831.1086649-1-axboe@kernel.dk> References: <20241220154831.1086649-1-axboe@kernel.dk> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: E9250A0015 X-Stat-Signature: jsqgpoytzmokuogfpxn4jcdyspzryaf7 X-HE-Tag: 1734709695-867528 X-HE-Meta: U2FsdGVkX1/YevE+6+e8v6jpayCotdH9/r5TfQiKnrktiYUE9uabcRxSkZlHHrSfr/WuqPTDF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dpLEacoy0IEbRmLJGOOAvg1zkgSbuxx+LTC3EtjXIS3jPSX/aydeyF9FjUVLHNh2sDb/xqBRcUR9h1Oln6rnEwFQBfLfuTqafT7710aKjQf0hcjr/wT3tAERT9FOmrILUbl/NTgE9RMcllq8elqVwrKQV2PwUBFcVWwFN++aRRVWms= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000072, 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. Reviewed-by: Kirill A. Shutemov Signed-off-by: Jens Axboe Reviewed-by: Matthew Wilcox (Oracle) --- mm/readahead.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/mm/readahead.c b/mm/readahead.c index ea650b8b02fb..8a62ad4106ff 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; @@ -750,7 +756,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; @@ -779,7 +785,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;