From patchwork Fri Dec 13 15:55:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Axboe X-Patchwork-Id: 13907399 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 C552DE7717D for ; Fri, 13 Dec 2024 15:56:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 723A16B0085; Fri, 13 Dec 2024 10:56:10 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6ACEE6B0088; Fri, 13 Dec 2024 10:56:10 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 59D746B0089; Fri, 13 Dec 2024 10:56:10 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 2E30E6B0085 for ; Fri, 13 Dec 2024 10:56:10 -0500 (EST) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id CE6E0C0353 for ; Fri, 13 Dec 2024 15:56:09 +0000 (UTC) X-FDA: 82890386250.06.C7B0663 Received: from mail-io1-f45.google.com (mail-io1-f45.google.com [209.85.166.45]) by imf28.hostedemail.com (Postfix) with ESMTP id E616DC0022 for ; Fri, 13 Dec 2024 15:55:38 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=FBnYR459; spf=pass (imf28.hostedemail.com: domain of axboe@kernel.dk designates 209.85.166.45 as permitted sender) smtp.mailfrom=axboe@kernel.dk; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1734105343; a=rsa-sha256; cv=none; b=Fb4tmz5eHMGS+CWpijq++RWCoMo8WUJA3lyo0JrhGYcZx3THXyPK2lxvlI5zUD80OlMTnC nS2WAfhRjCe20acbJmTYMflvDaj9p5NBCZMer2Cmhg/IzUFmvjPfbEIZHLGQLhhzdOZ83A wRT8oTdrVR/iHj51Q5d+YBEHyney8YA= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=FBnYR459; spf=pass (imf28.hostedemail.com: domain of axboe@kernel.dk designates 209.85.166.45 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=1734105343; 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=hANs0KTrn4AbTh3ILmowq5bBaAQVBAkU7MnXkJd6Hic=; b=THxx0UT78QVOrrC6bunmu9tCjVuivZ3ngpKApfhjMSAwRCAK9y3R+FbujGBCT+sci/fHSd Rqvp5NRqRLJhuQt/D8r2jGcddWRVn7lW6sqCVV5GOhRwFLeGYVUQma9fSCVEldCXDRQY7w 7Bw3mApXNJcb7woEpL6C/945jiF3JHs= Received: by mail-io1-f45.google.com with SMTP id ca18e2360f4ac-844e7409f8aso39929539f.1 for ; Fri, 13 Dec 2024 07:56:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20230601.gappssmtp.com; s=20230601; t=1734105366; x=1734710166; 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=hANs0KTrn4AbTh3ILmowq5bBaAQVBAkU7MnXkJd6Hic=; b=FBnYR4597HosqMVQGgoBShfc9UQMlmYrWAoIrGDSFDZxm2vtc00ZlPKlvGQOUXSD/6 0TdACxe8byaOBrKADjaDcN5NxfkfhnQXhur440g9siWdIy9Gz26VNYTxW+zTsSF2Aych sOHyGzst9iLpllrTORYnGgk9m03nemnM/dXUiGRSTs2C8TUsVXsrECiIAc6Q+we6H0FN zmGkXZciItsoLPSJSeeZh1i6J8TCER0kKZYqEAbJ6aLmXbZlAxo5eB7Dr2n4VyGbeoK+ xfJ0VpqOr1pis48q5xt6Ayam+C7uYEj5xJWJ0Jz/eD8wZXqu4ABKVIRwkH9hE7nm6nmD Ni4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734105366; x=1734710166; 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=hANs0KTrn4AbTh3ILmowq5bBaAQVBAkU7MnXkJd6Hic=; b=jXWvnMddaCkO6PMQFLLOUMV+STAWIP7Tl8WKzjnDiTR+UDvzFIgxRRikiED3J70Emw 00rVSXF0uxEqe8nqqoQ1CPWPhJDWQqhwhuVLaoKfdA8c3tzmjnkWLgXS/sg0xSvDdIT8 Xq8MDqAxkYrtFUL+BAM/fbBdecvE5UqzMzKkSKdAs1VChM2yTsZxvImf7F+0agbOmelB i27jDDS6CKAoH4eaQYnkpAnhXmeNQTiCZzikNfiVMPjTbWMB84G0TNfiB//EpoOic1mk Hkg+zmCGDxcyKld6PuWpYSsONRgTfNJbcP89/A5AYA/A9Fblrv3W3/KeVignJce3iN+7 3NgQ== X-Gm-Message-State: AOJu0Yw51b7NdmeTs32UTGCzyELt1oOHRWN8QDLyJpxjQWd5Cifj1YIg h3TBtMjWQbnGFbhfnPYP4jZd8VswwPconqWBLhvYDVoKjZ3QmLNNe/k4WQpnIxPo+ZPhCmaGPIu G X-Gm-Gg: ASbGncunZUVjG+vdxM2uOYt2zk5GiYQqUFCY199LldJgjDzRW1b94RulyEF2vdIn9oW +ge1pmp8fCHYBHwHft+nj630UHeGnCJLHzAf6U5e5IOyXNeWPcFc2PE8d0uojx7Vkwl/s7CKSMJ xWuAfvj/KfiFWDQenFO5m20Ww/xR38us6qPXv+hd7a8AiRy0N9MAlxDI/sG6vC+BMoMmEs4WB+o /6+WiOPKypKg35GKISrjaKqC0Y3TAupEe0aqhctxgKXcU7HsLMTmciZ2qaR X-Google-Smtp-Source: AGHT+IFVLcWwM0MIr7oz/Yvc9CHKROeMGY95g0ljJ88B+/rBynMSTGl1ysoTz/aE+AP7fUiTK21pEQ== X-Received: by 2002:a05:6e02:1a07:b0:3a7:8040:595b with SMTP id e9e14a558f8ab-3aff50b64a0mr26251175ab.9.1734105366472; Fri, 13 Dec 2024 07:56:06 -0800 (PST) Received: from localhost.localdomain ([96.43.243.2]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-3a9ca03ae11sm35258405ab.41.2024.12.13.07.56.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Dec 2024 07:56:05 -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 , Christoph Hellwig Subject: [PATCH 02/11] mm/filemap: use page_cache_sync_ra() to kick off read-ahead Date: Fri, 13 Dec 2024 08:55:16 -0700 Message-ID: <20241213155557.105419-3-axboe@kernel.dk> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241213155557.105419-1-axboe@kernel.dk> References: <20241213155557.105419-1-axboe@kernel.dk> MIME-Version: 1.0 X-Rspamd-Queue-Id: E616DC0022 X-Stat-Signature: e9i3bp8dzrt7s9y6jyc33wftztjxxmto X-Rspam-User: X-Rspamd-Server: rspam09 X-HE-Tag: 1734105338-376387 X-HE-Meta: U2FsdGVkX1/c7Aw4Cz3f0AmMZFZA8QuVuTJiBk6i9xGM9XxPr8fmg451glvY3g940K+M+BQS9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UYXBkCw6P6G3x1BBLGyRL9GGTLJpTm68LqCioEfhf9l5ey/FzLcHvTVbhalcRP+ZAPvpJyv3jm7apwlHbMyYBTXq8ELKcvRBrACZ8rMSxTa0E1ZzCXAsIfRUerORtRwkRr0O4+r5fQ9FmakBoKzTwwwCmNyKLedK7dptk9GT139xyuu97PHt8b X-Bogosity: Ham, tests=bogofilter, spamicity=0.000268, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Rather than use the page_cache_sync_readahead() helper, define our own ractl and use page_cache_sync_ra() directly. In preparation for needing to modify ractl inside filemap_get_pages(). No functional changes in this patch. Reviewed-by: Christoph Hellwig Signed-off-by: Jens Axboe Reviewed-by: Kirill A. Shutemov --- mm/filemap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/filemap.c b/mm/filemap.c index 8b29323b15d7..220dc7c6e12f 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -2527,7 +2527,6 @@ static int filemap_get_pages(struct kiocb *iocb, size_t count, { struct file *filp = iocb->ki_filp; struct address_space *mapping = filp->f_mapping; - struct file_ra_state *ra = &filp->f_ra; pgoff_t index = iocb->ki_pos >> PAGE_SHIFT; pgoff_t last_index; struct folio *folio; @@ -2542,12 +2541,13 @@ static int filemap_get_pages(struct kiocb *iocb, size_t count, filemap_get_read_batch(mapping, index, last_index - 1, fbatch); if (!folio_batch_count(fbatch)) { + DEFINE_READAHEAD(ractl, filp, &filp->f_ra, mapping, index); + if (iocb->ki_flags & IOCB_NOIO) return -EAGAIN; if (iocb->ki_flags & IOCB_NOWAIT) flags = memalloc_noio_save(); - page_cache_sync_readahead(mapping, ra, filp, index, - last_index - index); + page_cache_sync_ra(&ractl, last_index - index); if (iocb->ki_flags & IOCB_NOWAIT) memalloc_noio_restore(flags); filemap_get_read_batch(mapping, index, last_index - 1, fbatch);