From patchwork Mon Nov 11 23:37:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Axboe X-Patchwork-Id: 13871485 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 A118DD3ABFA for ; Mon, 11 Nov 2024 23:48:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 31C9E6B00D6; Mon, 11 Nov 2024 18:48:54 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2C7A96B00D8; Mon, 11 Nov 2024 18:48:54 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 07BAA6B00D9; Mon, 11 Nov 2024 18:48:53 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id D24EC6B00D6 for ; Mon, 11 Nov 2024 18:48:53 -0500 (EST) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 5C76F1A1C2D for ; Mon, 11 Nov 2024 23:48:53 +0000 (UTC) X-FDA: 82775455770.12.1E16292 Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) by imf07.hostedemail.com (Postfix) with ESMTP id D2DC240002 for ; Mon, 11 Nov 2024 23:47:53 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=HKXq4SsM; spf=pass (imf07.hostedemail.com: domain of axboe@kernel.dk designates 209.85.210.173 as permitted sender) smtp.mailfrom=axboe@kernel.dk; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1731368759; 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=U6r/JEXN4p6sDL2Jl85tuSl4cdRaIwaG6I/xjxiFUjwPAFeJVXE6cfu4JfzqcZAKOE0bSn OydcnJJJysvUIxGSCPU1lKTIQwqYawwITGb2lV4RJ+cD2DJ5uydqqZJ7jEl0rB1grOuAx3 Gnnreclnj8kFKytYqNywEmG0YzpBhKM= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=HKXq4SsM; spf=pass (imf07.hostedemail.com: domain of axboe@kernel.dk designates 209.85.210.173 as permitted sender) smtp.mailfrom=axboe@kernel.dk; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1731368759; a=rsa-sha256; cv=none; b=K+brqu111E69B5OY62lfUSYvHJRA+MJUoqsdZY82jGfaZV/z9W2Rs322cL/3dBwzNrbBQi pNadAAPMCYdnWr8F0FUggZmpfHZIxzrsjWjIYD7UtA7acU89hylmzXQ9UErqDMLYzYHjU/ fdTEN+1U5Cj/4ThrxkMBG0EubFO765U= Received: by mail-pf1-f173.google.com with SMTP id d2e1a72fcca58-71e681bc315so3584258b3a.0 for ; Mon, 11 Nov 2024 15:48:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20230601.gappssmtp.com; s=20230601; t=1731368930; x=1731973730; 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=HKXq4SsMROa9tKq1a8On5DGnQdsy93t++oM1FHY2SeStcVTJ7xiAoQhuP8ndj1ZJow eFt3A8IRM5c7c2r4KedZugGn44Ovp3jjogLu1Pyewfpq6RGrRiMM1mhqwumKwW7rYHYR XL7SPDSdhRJ2E5wivI1wVy2kPnEHTHISXaP8Qeb3TdqjAFz/uVRDzMyhVOaZ/uoWr40O FM0EhHy9NSDKIDCq3e7oL62ISR71Zp7sW9z5HnaKOHSdXi2cIEI3ddHz/ioaTv52wmD3 jrXaehYtJy84+EjqSrOHvD81FIK0tyMliP1UzS3rSqqP8XM2XflYisRV+Viwq/xhHKcz iOmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731368930; x=1731973730; 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=RAFZnaddl5ikcBDhKCcRk00ztxE1MyUCfgoi74T+eKVtAv+LmaGxCj/vVnaWO9LemI PvpxFuYxVQ0vZojzR+Fmn8CMVFoBRd9+tzbSroVwZ5aG3SVTXeEOxDFFDAQO1IleQMVp jNX9BwPhcYkATPesuhlild+UkfAb5a68ZZZ+8TwX+xImZKqGp8F1xxxuEkhxxH2pPLLU pRk0asFF+2gRUD8SQl4lO9ySFi62/+6DQ/y+f0NTRhd73fBqOaYWZJpmfof4Ilj9F6FW 8H5VMFvijt7cwIo/EkPt+qOCICywBQVteExME1x6GHW/oDz4j6Pv3EHIhmgQpXD+4L8j Z8EQ== X-Gm-Message-State: AOJu0YyNw8hCwYd24N1uOZQbkFtO/0j0QOeUTFTksJ4LwMexmGMEgyDk 223Xl4c3ae8cg3y0CwNFkndg6skARISSE6KF56xRsigbkn6gSa3OwoCBBpSJBkhZEn17CUnjalD 2tPM= X-Google-Smtp-Source: AGHT+IFIT751yc6PWfScZ6t4wwtYiUFG2/DBhEvJ8IDhssjBxrF1+5xRFKTmZX93Ms0bG2KlEc/8GA== X-Received: by 2002:a05:6a00:1801:b0:71e:427e:e679 with SMTP id d2e1a72fcca58-7241223447dmr25540831b3a.4.1731368929963; Mon, 11 Nov 2024 15:48:49 -0800 (PST) Received: from localhost.localdomain ([198.8.77.157]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-724078a7ee9sm10046057b3a.64.2024.11.11.15.48.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Nov 2024 15:48:49 -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, Jens Axboe Subject: [PATCH 02/16] mm/readahead: add folio allocation helper Date: Mon, 11 Nov 2024 16:37:29 -0700 Message-ID: <20241111234842.2024180-3-axboe@kernel.dk> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241111234842.2024180-1-axboe@kernel.dk> References: <20241111234842.2024180-1-axboe@kernel.dk> MIME-Version: 1.0 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: D2DC240002 X-Stat-Signature: i6b5ajf4nkng5xwazyjkahineqm1i6uq X-Rspam-User: X-HE-Tag: 1731368873-589269 X-HE-Meta: U2FsdGVkX1/8uZVRSrW3yYQVjPbwC867EIYQTyXA3RXiQA/A7HkB5Kqdjx2yVy1N/y3VSY8UvaIKUCrClQH2QzIM5eJkcJ6mqNmnpyhyGptveojy2CLzagS6UUMAgRiaN6k+SSwmQ/KfWRrQq5g/L97heXBHjfACfLbElXbe+AO/hHLzGACtn+zw79KHznRX7qvHSDOI2EbCqYtHGfaNNPTrR2M4DI53rOBL9LjB3Fjv868KYwMFX5oPtIvQM1onSwbvur5x83J24hd1tpN+q3m3+86MXpJP6IPyCg2ILGigbY0LDp0vhUu9mRZvBYp3tY+JLjJR6CGx064Se4VIG3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ender: 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 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;