From patchwork Sun Nov 10 15:27:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Axboe X-Patchwork-Id: 13869949 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 9D0F6D12D44 for ; Sun, 10 Nov 2024 15:29:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B9CDD6B00B2; Sun, 10 Nov 2024 10:29:24 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B4ACB6B00B3; Sun, 10 Nov 2024 10:29:24 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9C34F6B00B4; Sun, 10 Nov 2024 10:29:24 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 741FD6B00B2 for ; Sun, 10 Nov 2024 10:29:24 -0500 (EST) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 25841ACC2D for ; Sun, 10 Nov 2024 15:29:24 +0000 (UTC) X-FDA: 82770567264.09.23FF9BD Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) by imf14.hostedemail.com (Postfix) with ESMTP id 8A592100010 for ; Sun, 10 Nov 2024 15:28:38 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=o6D1cfUl; spf=pass (imf14.hostedemail.com: domain of axboe@kernel.dk designates 209.85.214.177 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=1731252332; 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=uN7tjL2s/tmxM6CJqz4ta5HuqLPCPNJgi5Uvj68apZw=; b=eZsbIkiMvYsxJqJEP+pbHHY80pPktq6WrEEETPxsq2PwDerycUyjH8Dxp22iFA+YNUEung ErPlyJsYQDIc4j1TXn20rxEB23/u3qaOz5DtAxe3dKTNlmw3E7wu4j6NE2ksKyqLLk7oan kkXPNp6BAfrdES7xO6UrPFJgge/3UV8= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=o6D1cfUl; spf=pass (imf14.hostedemail.com: domain of axboe@kernel.dk designates 209.85.214.177 as permitted sender) smtp.mailfrom=axboe@kernel.dk; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1731252332; a=rsa-sha256; cv=none; b=Tf9dFdSmS67OwoHSGiS+cnm1Rpba3zUojLtdy9vILTmqH6x+lBPmBg/0ao7kBwtthpmb2G 4QseLdfR5REwwcdhuOdThmevsXur0I9t13t/dTjUjRqBj6F4pYf/8zolrnTLZ1XMiYO9Z5 unWhi7uTuoF8pPIAIPn5NqUDvxyU/po= Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-20cceb8d8b4so24320035ad.1 for ; Sun, 10 Nov 2024 07:29:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20230601.gappssmtp.com; s=20230601; t=1731252560; x=1731857360; 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=uN7tjL2s/tmxM6CJqz4ta5HuqLPCPNJgi5Uvj68apZw=; b=o6D1cfUl5NeoQBgYrIqzJBLvDWL2ILpeI72o3/vDASBiE6ina7KL9mxGGwlJwAcAbd H1w5xNP8QmSadTa+pKRoQ4zDhEJK0ncEdhX8v7f0iBjqGSHw2B3WVYAR2gp86TBoeGF/ Nt96cJEkuK9GjxNrxGzHYtWS5SLcHTJUv1CTKoX3n1v+LhEwUGEKme9lG/SeFll3Dq0M ozvX2Wfc11lFNn0Mr/0YTpR5U+8zSm+58HDXZfVs8w83gLrE224OYcVpEgPYKEUIEbRa x/q4OoMsst66SGE1wkMnCLgUMJoMbF1p7Rbjq0BLChuYmwA6asmHFXTNMWukGAA3e0Or R8Sg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731252560; x=1731857360; 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=uN7tjL2s/tmxM6CJqz4ta5HuqLPCPNJgi5Uvj68apZw=; b=lSJ2dOyS/l0bsWXfh5mXZDKaZ+TMrA6BSca92NhXEwywh6CO0nIAyjsl1wwW04P6Jz Spxrm9ZISOUJ94BI21OHoxFflNl7+xUnfdY5OZ2JGo6iX2xR6yz3ld7lVxoUWzYFyDSm dAE+sAwG4q1wV0jJFGyykhTZiFnAbWDUvAECAT3e0Sxs4EQ+BLRPBzEe7SILn5Hyup+M jO2XrjDmUGp0K8C8kH1KGxPpvmcHLG7oaXNPEpm9zaAGoD/Vu2Tm4cBZdhbwQllG/WV5 yLl/BFTZBol7QLv2bsqtkihVL3ds3Dq7SNt03CjtwY5CraFgYr0APCJ70Wn9dyZN57Kw SOwg== X-Gm-Message-State: AOJu0Yx/E7ovX4EkoB0ymDkaQyJfKJiBw/LgEGb2/IKlPflZtdbeJqhX AGKhIFbXLYGq5QKJOsP57T2qeW0ET943JYKZWHed4IEXKRvuR7pHN10jnrsyTW5oqxZDaDcs1Ls VlPQ= X-Google-Smtp-Source: AGHT+IEPVPrIsvzVKM9BRnKywqUBY+49ysTGl3h3gnVcSq9byO4UW1dwGcp/l7t7WWnOfvV7vMqjdA== X-Received: by 2002:a17:902:e812:b0:20c:f6c5:7f6c with SMTP id d9443c01a7336-211821c4546mr156324045ad.16.1731252560665; Sun, 10 Nov 2024 07:29:20 -0800 (PST) Received: from localhost.localdomain ([198.8.77.157]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e99a5f935dsm9940973a91.35.2024.11.10.07.29.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Nov 2024 07:29: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, willy@infradead.org, Jens Axboe Subject: [PATCH 05/15] mm/filemap: use page_cache_sync_ra() to kick off read-ahead Date: Sun, 10 Nov 2024 08:27:57 -0700 Message-ID: <20241110152906.1747545-6-axboe@kernel.dk> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241110152906.1747545-1-axboe@kernel.dk> References: <20241110152906.1747545-1-axboe@kernel.dk> MIME-Version: 1.0 X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 8A592100010 X-Stat-Signature: hgumuoipzef79irwqrhxar6hiats4jgy X-Rspam-User: X-HE-Tag: 1731252518-656182 X-HE-Meta: U2FsdGVkX19JLyKBa69zh6gs/vRT8ZXvDtmk4h8pf7rhNFFfD+bo2Ecfr3B5qcrysDlzQ/53D1NAlt0fNRu5/7u14U3xZxI35nQNm2IqkTqsSg8WKe/glN7Yj0hfRpbelznhCvv4TXYW/G4x7Zx11n5xaSlDpn1n9XFkH7Fz8n9JWG7AYv9ioW1YxQwy/KOemZ1OknBmg02dFgktkG2jdu8DWSLZj2W6cbYoIQldcVCvEh9c8u6HvpgivqVWkunifGVrbobk7GrSs3KvJ/2xiOM1KfcQw7GW1A7fY3ZM581aPLCc/zYa2FPMcpG0WjsP3FthnoCmtweFfzmthaKw4k4kiH9HkXT4hEgUOPXD04rTAXHGYNHTn2GmXk9938xHfILJQnafXqeaxiTv+/IPf32FfkjL33Km1vqc4CqLrn2kFbZVN+lOKpk9AFgdK6X+VQa8u75rOtu3rVFlbWMc4n9U85VdWendl/KqIk2kW4I2H0PV5uT0FHIcp10a57OzpQ2El9ND0kh/IX+yEZWrM7//0DKuRQSMYG2aK+WAquX6zJRiGbRQbr36C89LW+8gbBJzkGuHiQoAmH/zIoKWY4hjGC+Sw+JUVvadgddQqWX+6vkFn1xeOUwg+UcJbebp+LIu9qcbLPRJQUYx1IL/jEWXSMPZYwV5+bTDYB0XwOlCbH9fTTJIGElc6YlVMBjof+srewZ29vzHGzGaTOA80WFK3uvPvrzy9RrCOXjWcsVnjBmCGUUk2EbT1NOaYSJVCz51F1wlPVsu8GNQi9mkvDuuWc4nDtX100EDWf6NC5X1meg7osnwfNKUTBSwi/A27ZkN78NjB/yrtGxm9e24hcH1gzEKqTo9qmvLUgRG1RvmvH8hQP7+lS9HJOJPgf7atVO43O9ycYu64PJTSVi0H5cjx8ssxtvREGHrf70mFKIDlJdvulF5Kf02Aq8aZXRbWDvi3cAT7fsF/3Jgcko Ai36qWEV evqor7qdEGoVCpM8Ez4gUE0MXmSD1NjbpBWMDBgQaOGl+xtHC7ccYaewWgHIIFDYRd/7n2BRhCnNFDXumhXlDcGZ1rQA4PCzxTSPpKPiQEbSEw6voMP30MfBBsv5hXqnsFew8l9oz7pSxQLm7JaVbFdmISOkyR5ZwdJQN0JoANMCKlX7+sueQ1X/Seg6bXrF8LZ4KPsZRwi4KeNPn7G2Wt4rRnRMXDF7fKpb8hsIMO8DKWBXQv6pJcxne2HwAXhWDmGJVAkfVLTV5PUOZz8mBoWSopcR7bAwi5cogJGhNGiEFfqzt5MhrqivnciHLknkVHzuhcSibWzX0oSbXlwEPFM1hKs2sj968caQx 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 0b187938b999..38dc94b761b7 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -2528,7 +2528,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; @@ -2543,12 +2542,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);