From patchwork Fri Nov 8 17:43:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Axboe X-Patchwork-Id: 13868798 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 2D5B7D64074 for ; Fri, 8 Nov 2024 17:45:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AA32E6B00DC; Fri, 8 Nov 2024 12:45:24 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A55356B00DE; Fri, 8 Nov 2024 12:45:24 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 89BD06B00DF; Fri, 8 Nov 2024 12:45:24 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 61B186B00DC for ; Fri, 8 Nov 2024 12:45:24 -0500 (EST) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 0410FC0F53 for ; Fri, 8 Nov 2024 17:45:23 +0000 (UTC) X-FDA: 82763653140.25.42957C4 Received: from mail-oi1-f180.google.com (mail-oi1-f180.google.com [209.85.167.180]) by imf08.hostedemail.com (Postfix) with ESMTP id 4663C160023 for ; Fri, 8 Nov 2024 17:44:57 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=hlhYSMzg; spf=pass (imf08.hostedemail.com: domain of axboe@kernel.dk designates 209.85.167.180 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=1731087783; 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=c9RgbH65zDtdD1C8SyJhiChYXVIUYPb7qWGKr+fnitI=; b=deFfVMhh7RvQcN7FJNZ5DFFnFzLrTTZyZxCOWhVOmlGxf8xu452L2YWne+m0hQ0GV6DwnM VDpRIY0dLL24Uq2x+G+2Q92kIC9oDf2GlG+G45QNd6ElDrJbMf3zx1NvB4BPJx8zRj5GPB S/CnGfkMcmy+rTAhKdpmwMZ+w9dhSns= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1731087783; a=rsa-sha256; cv=none; b=B0lWKLVwy7FgS05t6i47KShQ0CgY34Gnfcw3x563nApnkH20u0pWcZrB8lkGtVet+wUd5n fQHPxbwIZkyCzOznMWokE+ATdWDEjT3v16ZXGi/PffMWPrKEaJ+kIhuhCVpi2hCYZkvHKP ZdXfLpns0/DYSIdB5ULx69DEL8ezC7s= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=hlhYSMzg; spf=pass (imf08.hostedemail.com: domain of axboe@kernel.dk designates 209.85.167.180 as permitted sender) smtp.mailfrom=axboe@kernel.dk; dmarc=none Received: by mail-oi1-f180.google.com with SMTP id 5614622812f47-3e6359ab118so1155271b6e.1 for ; Fri, 08 Nov 2024 09:45:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20230601.gappssmtp.com; s=20230601; t=1731087921; x=1731692721; 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=c9RgbH65zDtdD1C8SyJhiChYXVIUYPb7qWGKr+fnitI=; b=hlhYSMzgwc0K652I8lKOgMsvfl3sk7anYie4cI/UIcGPJrARpZ9ZVKvV9akddyg00A cl5deaDvtRuMiTVztJqWMwspzeba4ARcTlO5gR3zirvUrNU17wBY8w+okjgBncQcUall PopPqzeHevZIcQw2yVVQpWvnXp0q6BqKKubts4DDD6J9RKPToUV7igtiovR5jYXgRs4y JvgLqNsu/VCmBb0x8kHfwVe97KiuWeCzRJsqQV96s+0pZRrCG7DhnxRwSlf21zfruojR PDEZta/IhfGqeylSykW0pSMG31m7YVbPcGgeJ4q2yaeFNstUsKkBSjsosxrerr6OjIhc 4nOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731087921; x=1731692721; 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=c9RgbH65zDtdD1C8SyJhiChYXVIUYPb7qWGKr+fnitI=; b=S8LKExvduMiIcgPg4LFmWP6tM5x7ORIMYI1g5lZPRwQXfzxOy5fCw1NdUU0+CH2ara KFaiaTgbhSZSU0oGnHvPdq3ZAqxLN+Co/EH+RlACbiAmE0gELM2NQmthzOwEor7cVjAH nyYjtQMohttKIjTUxQHjVP0leEcnyDw/iLK2Qa5Ag3U4OqRMi0yo/a4dI/wbhAXVx50P lHn1NFvm6VMrmlDHWUHjq6pBM1g9NXqP8p3CJcOdW72dp9Qcz8xpKsjfFF3cJJmRnrJG qbv+U9yVEc9e6GBj5TOxw+fIDDDxYCOrrcATGEt8+Exq9bmbO+aZHd1mgufLUavqd7In lMtA== X-Gm-Message-State: AOJu0YwfAe0HFz011zaJE+YUt5lXed56pK/Ixdh0Fgq3NAKQZRKO6i77 XqEWGEw5pTdHdUTcmw0sut+mPjxarRl6in83DEY5yIvoyc9I15PyXg021FZSnNQSPr5CmKuKBLx AYuI= X-Google-Smtp-Source: AGHT+IEdm8GyqJXGR6xkfsMSAWw5HHFtOAoa8M2cW5v0Mo0ooZH016xwV9QTHy9Q50Vx5kixVOJjvw== X-Received: by 2002:a05:6808:1391:b0:3dc:1afd:6688 with SMTP id 5614622812f47-3e793f74377mr2161727b6e.20.1731087920676; Fri, 08 Nov 2024 09:45:20 -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.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Nov 2024 09:45:19 -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 05/13] mm/filemap: use page_cache_sync_ra() to kick off read-ahead Date: Fri, 8 Nov 2024 10:43:28 -0700 Message-ID: <20241108174505.1214230-6-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: rspam12 X-Rspamd-Queue-Id: 4663C160023 X-Stat-Signature: 66y51w7mu1er7jsxs5fsrgejc4bc64fq X-HE-Tag: 1731087897-842469 X-HE-Meta: U2FsdGVkX19oJ0EUrV0bqMI95+1CiAl/zokWApiqxzkHn8C4JYnPb+MToWxrV9YsVrnEeW9esouRQ/WSieNhUqKcyShEvm8HkvJZVwjSsgj2xOxy5L4GEaA3i+FTmUoJHtodYhMs9PP9xqw6FF+dMptzsiTRaiXz9bH2jyxGoCEu7ebdDHrv9pFBVKzZ709HHE/MW0E3j2TWSWGZWaaYxwxS962cOElYi+MUKEk/fHV0Zmv831x7SFrhVpF6YhYxdHjyiu7B79Ll2W4kg2FWGJYFGiH3G+XRolcy68nMWjbW1OFAPnhCuELT+kpfyJlDE8379PHm4wci86ZzORlMcQ95lhk0rm5MXxJQNZA77hSDOdbwFDTJVTwF28/JrW5VVwIcIq4D+Nj3PKk96D9dgUFDHtSeRF7GWaP2auSKrgcpbn6yvYoxY+rQC/tveMhywEQO5KAG88UNv1+d+lFCpRJudk/4syrApZPd7RU1WIpLAe0xiMxSD7YMgIc1sY7TTokqwwYBMwMqSOarc1BYq+Wqv7YvVxOsUNclFdtL5wKZyyLaAVId9vi283zWY2EMXPMN8u6jpOkc6jZkEuyNViWU7/LXcHx4Tjquv6g6A9y6PIPUJejy0YVndWNQ0kZr5vnMLKu+zOlbmV1k0jERnFpTf7TQoDXuvCnEquMZdBqU/o0FZmzd9DrGeLYzBcMg1xR1ljwQP/hU95C58ZGeefMwmVkkr+60pYgMI2D7NIjQnYq16kU9E92c88hOLXwjGguX/pwITiTMEolnMhyo6AF/YuL8CDPkHpAXRnqFvFKJx+pe5PJIQyjyCHqVckkUXLBOYF4SeX60dPbE8GrBbuxKsWeiD25v3QOrQT9iUUR1dCMCF4ne9WEmCM+0nmwrBS2s61Hmyg/uq3a+K/g7CAVMJt5/KO/KV+c9wFtvtIGthHJpRxmt50cg2qBAmilN6eAWM4C1zC5ZMKQC5iD d+mwXTWt OBG6Z9mKJc5EuW1cWnkCtU0bSqJbxoglF6fKVNML9juzx1bUirWieX5DkjPR/HTHgG0GatUidgod4tQseZGOdj34eHSCLzCdAl5ee3kycB4fFsyyYdV48taVJc3mf+joLsrvSNHR0ALsZY/Z+rUDs5eNyjOOCrrnmfBi8vn5CMMFOuwFCFijiUsh3foGSqLiBgxtZd9k3qZHeEmANFH0Vkjs6o8nXG/f9VxlP+kxoh9ZFFZrGfbnFEGvRPqHNjJA3qpkqCX6zwAWG6JECDqReAFOe6h39zJhJweH5cuiCx7u98XwbabDpRbVXbCKGB2cNilf2fDb+w1rcPvM+X6Np9UNovl7fAb+F6EZY 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 2ae26a0f961b..7f8d13f06c04 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -2525,7 +2525,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; @@ -2540,12 +2539,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);