From patchwork Tue Dec 3 15:31: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: 13892622 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 AE9D5E69EB3 for ; Tue, 3 Dec 2024 15:33:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AD7FA6B0093; Tue, 3 Dec 2024 10:32:56 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A5E056B0095; Tue, 3 Dec 2024 10:32:56 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 926EB6B0096; Tue, 3 Dec 2024 10:32:56 -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 6D5506B0093 for ; Tue, 3 Dec 2024 10:32:56 -0500 (EST) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 2679AA0A93 for ; Tue, 3 Dec 2024 15:32:56 +0000 (UTC) X-FDA: 82854040458.18.2CC4AC5 Received: from mail-oa1-f50.google.com (mail-oa1-f50.google.com [209.85.160.50]) by imf29.hostedemail.com (Postfix) with ESMTP id 1BF1E120024 for ; Tue, 3 Dec 2024 15:32:34 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=OfQO92qZ; dmarc=none; spf=pass (imf29.hostedemail.com: domain of axboe@kernel.dk designates 209.85.160.50 as permitted sender) smtp.mailfrom=axboe@kernel.dk ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1733239968; a=rsa-sha256; cv=none; b=CsWzsw6gQ26YxT58nz0ZwOztwJGhG/CUAhjYFbZesECH7oO7BDk4dhgNWIPXgP/vWkYYzX 4nZFV9w6DWVSpzwlUCKZ1a/taKjm9vIDtIIAf0cHngrAe+Zn2N2Xmlf63hQHwNiVad1bVP f4NqbpNqzpf8DHkdKgvD0ZlMsq1RXzk= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=OfQO92qZ; dmarc=none; spf=pass (imf29.hostedemail.com: domain of axboe@kernel.dk designates 209.85.160.50 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=1733239968; 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=elv86DXnTmRzX7BzNNN54cJv91/ZhMhRandVuyh+78M=; b=u3LeYcBMGxyJ2z3p6vMm+zW/wsuRo6fBSYbux/vtFJm/zwMIHp5QjMWwXYSMSpiuI+JDWN 7Qs1M0ODI+EEPeRm+yUbLf9NRO0rKAtl/QbUOYKElHLZ/ZhbUB+TsB4cwD8HbEYcgxdROc ld5A9vsH1d7llfwCNcOUFNk3DdTWtNI= Received: by mail-oa1-f50.google.com with SMTP id 586e51a60fabf-294ec8e1d8aso3783760fac.1 for ; Tue, 03 Dec 2024 07:32:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20230601.gappssmtp.com; s=20230601; t=1733239973; x=1733844773; 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=elv86DXnTmRzX7BzNNN54cJv91/ZhMhRandVuyh+78M=; b=OfQO92qZagdJjqhgQdl6kb6drpmxiw1UjqZf0DF8FKAzdBw7hfCxllej0C95a8/EIA bxDWVUZbr4xcsm/FqRB9oDhAVyn2JJp5F94Nd4qbjgJ/B+WqC5TF1e98C5Y+k1FZcxAS a4UFkSqjoxIVGQnwGWmt3ra1H1zFrVEno2fNdOfbf+jxdBacqkqgcxzoOPcFHakAKhUa qZT42ZWImnnHp0ZbgmFzp+dKKtaXzCzLWD+vzo87CnRhgdYPWntnw9DMCEKNCcQAP6wA jxUXuOcECOM4ILRuUKeAPzlJgnW/dHMZxKiCFq+9v0Gxq8Q4ydg0UmqoLtQV4RF3/ZcE NYgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733239973; x=1733844773; 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=elv86DXnTmRzX7BzNNN54cJv91/ZhMhRandVuyh+78M=; b=dK8Mj0xbaXfc95O4iavLb2m+LQv9SAcJhSNdLp1Z3tZcPDNBxJWmVLOW2EQIG1qKNe RLtnikolP71m+rOZCX+pyrSKH/S6N4oOFrkB0KXlgTF6qeKdWCtApAOYJRMujl8yTgWm ONM0tcAl+TlcIQZzXxo+pYcuNiD0Px2YRN33cEVE8tb3uvfF6lj1qnlxwF91luJRsJfW mXvFhRrjQvx/IDfHy1Z+x7LOczmdy+hQNKO2jjG/sxjD38+julzVN1VXWLBhJzmAhmCv ZB4HmFDrGG4oO5vaI00/ceUitovWPOWYV79UKmcllD8r5zSM4+RE6TnPEBFELLxPd2h3 toPQ== X-Gm-Message-State: AOJu0Yx+6iC2wCYz4uCN/Iq6KMn7j+CmF6RpbxsxUGEq2inbBytjU6ol MZSoC3pQfbjzg6g7U+GUk5th8hPtpVDmJ76ljT8ePzsfcGIuabp0Rf/T5KbXMeRbXfkvkVhOl/K R X-Gm-Gg: ASbGncv6QKHaHQ52xdl+V4W18/iisn+Z/VkGqhow6EZAnmhMUcZTiMq70v0Hwb/nTf6 DJjdP+8kZCN42ztKnwGgkyC1JgOxDma8J5HVjVK7KUcZOpOkU8f9/qgchfeEFYs0GEqqSWtiG3H R/AAZs0A0eaAwFswHhPkQOqr+94g0D4EiypxuTK+1Fi/YEfunZWmljgaoCZXO7uM9s9KwjBiZxB D2K5R9gjiVVDb7x6sW1z8AR0NVPcaXvfDdI1iGwr/dxNl/Vjc66YnemkS8= X-Google-Smtp-Source: AGHT+IGEqY5mPPeclzVfJP1sqwpK2NEo6ZfmI2zg3SEWdjZlSMpJ+brY6rhQdeJiLlo5jFiEsUF9Rw== X-Received: by 2002:a05:6808:1795:b0:3ea:4c23:daf5 with SMTP id 5614622812f47-3eae4ecb2camr3172373b6e.8.1733239972824; Tue, 03 Dec 2024 07:32:52 -0800 (PST) Received: from localhost.localdomain ([130.250.255.163]) by smtp.gmail.com with ESMTPSA id 5614622812f47-3ea86036cbbsm2891878b6e.8.2024.12.03.07.32.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Dec 2024 07:32:52 -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 Subject: [PATCH 05/12] mm/filemap: use page_cache_sync_ra() to kick off read-ahead Date: Tue, 3 Dec 2024 08:31:41 -0700 Message-ID: <20241203153232.92224-7-axboe@kernel.dk> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241203153232.92224-2-axboe@kernel.dk> References: <20241203153232.92224-2-axboe@kernel.dk> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 1BF1E120024 X-Stat-Signature: zc56bxtcho84zre98w4z8wu5ntuq73zz X-HE-Tag: 1733239954-822454 X-HE-Meta: U2FsdGVkX1/RUS0gVZPPIZl4rW5Ony8r2pjFW0CZlJ/Ya3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I9vJepEZXqEZ5oR0utu15KtJYYyQ3hkhvznY2Lfbtj8xMKBKDrZtld+X7xzsb+yPyGCHGQEzIKfNEjFhRFeX+lPYTXuj/RNRNCqgvhx6AWzqkb66xyPls5tN3Z9GMM70oXl+OLa1hx5LF/5idVesO/ifipCgRZIWr3xyYzjYsAu64PLZygCOeJOSN2B2rdMxjqMqd/XqsOb2z+YezKRYgBYBZgB 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: 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. Signed-off-by: Jens Axboe --- mm/filemap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/filemap.c b/mm/filemap.c index 898e992039e8..dd3042de8038 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);