From patchwork Fri Nov 8 17:43:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Axboe X-Patchwork-Id: 13868795 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 ED6D7D64072 for ; Fri, 8 Nov 2024 17:45:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D7EA96B00AB; Fri, 8 Nov 2024 12:45:19 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D08696B00AE; Fri, 8 Nov 2024 12:45:19 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BA87D6B00D6; Fri, 8 Nov 2024 12:45:19 -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 932476B00AB for ; Fri, 8 Nov 2024 12:45:19 -0500 (EST) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 4AE2B80EA4 for ; Fri, 8 Nov 2024 17:45:19 +0000 (UTC) X-FDA: 82763652468.01.C549FF4 Received: from mail-oi1-f179.google.com (mail-oi1-f179.google.com [209.85.167.179]) by imf19.hostedemail.com (Postfix) with ESMTP id 2070E1A0009 for ; Fri, 8 Nov 2024 17:44:30 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=h5wSqiFA; dmarc=none; spf=pass (imf19.hostedemail.com: domain of axboe@kernel.dk designates 209.85.167.179 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=1731087832; 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=br8jgxnQmgT2WwT5MKI14vCxulhwnuEXuJqbR3APlapGNNz3O+6WjTw5J/OBfihyw8hAZv Hvhlx5SSPzzqjMkKGsIQ3V9/L2MbiCrHh202UeOBJnO+lF0DyjSYy0H2fBFwLX+WDOePoc Y6uO3F2Yq3M2dKtT8eK26zpYP7OKQ50= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=h5wSqiFA; dmarc=none; spf=pass (imf19.hostedemail.com: domain of axboe@kernel.dk designates 209.85.167.179 as permitted sender) smtp.mailfrom=axboe@kernel.dk ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1731087832; a=rsa-sha256; cv=none; b=Ft5DCzWPt9xjBhF+vf6z2tglwfjTjPLhw5iYJDtX49g6Zt4mRBGRIFUmZH6K6JMRv04wlc r3wfDz7kVkz/edZQ7WfGJqm7p7HGihHJBTY4A4T4wagyIZPsyiHUWpvHpU4Do6kASzXda8 ngRIDVgSOSVQETBvyDUE7N2oTBoZfY8= Received: by mail-oi1-f179.google.com with SMTP id 5614622812f47-3e6105886dfso1775814b6e.0 for ; Fri, 08 Nov 2024 09:45:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20230601.gappssmtp.com; s=20230601; t=1731087916; x=1731692716; 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=h5wSqiFAb6hCta567snjsCpCzBVM3Lm+3UgbzSi4xuz8xp36TgA4pnKBQogi8b3kkm yMa2fk7ZfP4UVW8Va5kZJEofcyrnBozyVtOcbxQ6oiwMdE062bE8SHw3+jWwQN2DWusa C0jc7SZvC7IXIbIX2JDLQHbhASiiOzhiOuZ+s5EwIN5Pfppx/qYef13nBPRp+ay/0fE8 /KuFhwJSm0hbOokJ/J3Cb2H0WC8AgHqRWt6e1X51TjWDQVxHLdeT4Y0sKzYcKMyNOBHR z5EgNXIe5eeZZ3pebgsYUUxkbPzKVdQsrBK4b7Mhyq2vtEbMZuhu0PfT3+FrnRjb2rp4 KRmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731087916; x=1731692716; 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=XW743CRzAs/oA7br+RO7ItlsH5M+LgXR9W/I4AECXKYWW43aa2L0GDImBs+NzYBAG6 9iwDp/1VwcYJCd4QDa/RHGcN8Of58EyFLNJRBzUpMvW7PtDfmHfXaOjARc1DwDQ3uyXq nPyCotw1EJrX+17pjBZ2WPMUjGP/OE3W7B+yOv23iiVA264sexSbWLXn9necop7hoBVJ AjVj6YSRHMVXITsOQWfo0PQqtS/FnozVk6meXrUERYsVb3ahUVrVwGqf9jOzMl7rq/kk x2iQBRBPHoGJjM5Bcsr5Wi75eKLwIhZ72s2PQhd3GBQIXi1voEq2GqTwtt/lIOu6iI8n YMtA== X-Gm-Message-State: AOJu0Yyv4lqL7EGD/byWkBBUZgZZB4HGV7kOgQEr8CywHuHVGc1PLUe4 CbDY+2Dyj0/vjrJ/v0+LudcVZB1Wj32uNzKE6LMXFdulO5Nidgd/Ys/fvzMWzz3mCM9DRogER2l op/g= X-Google-Smtp-Source: AGHT+IE9yyGg7trloxg8/sxB/5Qab0oFpLsLqTwz8oiFcGSIzzHT5q20m9z/5W6tquS0Nz/aDzjCkA== X-Received: by 2002:a05:6808:148f:b0:3e5:f9e9:43c4 with SMTP id 5614622812f47-3e794dc5b57mr2378031b6e.18.1731087916223; Fri, 08 Nov 2024 09:45:16 -0800 (PST) Received: from localhost.localdomain ([96.43.243.2]) by smtp.gmail.com with ESMTPSA id 5614622812f47-3e78cd28f80sm780969b6e.39.2024.11.08.09.45.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Nov 2024 09:45:15 -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, Jens Axboe Subject: [PATCH 02/13] mm/readahead: add folio allocation helper Date: Fri, 8 Nov 2024 10:43:25 -0700 Message-ID: <20241108174505.1214230-3-axboe@kernel.dk> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241108174505.1214230-1-axboe@kernel.dk> References: <20241108174505.1214230-1-axboe@kernel.dk> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 2070E1A0009 X-Stat-Signature: yry36g1nisyqu7tzswfgt778kupikij5 X-HE-Tag: 1731087870-448471 X-HE-Meta: U2FsdGVkX1+HwrDDmS4IviAcz1XZeXldXrhlB6sbND2xegm8wZuYp42cukJVC1XzV4kDpCRIZGTEZzouitvVEYx0rQ65B8+TorYvQyfAQQlZ5Qyvg+J99m7ya1TUxUMs/E3OYfnyplD0fMU5WqvK2sXjUzBKX+q5nbVXpTrBmNyiKoU3qQvgvb+5s164O0t9zXjdPI7lljG0DLcUi3R9siJj0RIGs92MTYL8wUBrGkN7QeCq+7ya738X/ZHc5QKYr3l6Cs0AZh+wHng58CspZMv79U7RwcKAGyiJ9/vY3f88LwXG0vpbgU8R05W0RrkWWM+y+lt8ODwUW8O53ra+8GTmLGCOcDeuOOa/oF9uSD6AT/KV0t7AxGXp2h8yOB0fnxOLln/xv5gJ/Sr2iv6t6LS1UlI41Ax1fazFnqo/7bvjt13PpJCs3QTDmM7A0oSyj0AuX5Ug6XtPEEED75mEIdppVGekXCzx3EanMumZvgvVAGOEjP5nCCI97se166QaAuy/gX4485XFvtZGu4cefoA59KU/d2A3uj1a4Z+qMO1p6fD64IbQFQaX8CMN+jOq4Jo8CuPRgM8KRbBmCrsBEjE26qI7mlP7QvZOQBE8exVvPH6tg80CCoV+BUCKocL0lJ8DKkd6B9CUtKf+eSXkXa6LjzYef2xLTN198+NzNftqU7xgUEBiSAhkDeI+fE98d8hUyI5LP1YWN2IJSCjSTY/YYsF412gKi8wMbx4VN/9F3DKuXueamHGeCH52fK/I3eTXIgcuei760m3eHEB3MJ9kvdYZ2XiZrPByFmkvNwfKzJJLOqKJutnFhOJ5RZPniJls1rAP31S1VaRHi1DJT+efWn/EeGfPsCYvATlVez4mrccP6c9hhSjERuJNh7xGdUpLKSzFeISsCwj4aCVLYv7RRtaMOGEQARaxSz5eYRSalFeqFxD3lL6n/ij8H8C5fVCHdbHmvCVm2fY/wli QfduXMt0 eNRRlUIvXigm+J9uhSCJDfUOTkg2ijsmeIgulhm35culgXIwX09PzHxwrTsQuAItmljQH2HbngJLS/sk+3TsA+FLlxWvvJqMCRyK8t3JT/P/UTyRLQrUcZwxBLPsVfGwkOAXuDMWOvVVodyyFvmSBgSW9Xe+8BgCfzTXQaxW8qTx6+u1K1dLP2Me8Flqyzpr4MwzCyq04hskbUVIKWbLlKPwcIhopabrnSFLLwSMncEh0NzgW/stHxuNIRaXEGA/hua00rC2gHBvRWvzmimC7ogLxZRdJLYcczxfjIUtjQotP+IU= 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 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;