From patchwork Fri Dec 20 15:47:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Axboe X-Patchwork-Id: 13916933 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 12234E77188 for ; Fri, 20 Dec 2024 15:48:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A208F6B0088; Fri, 20 Dec 2024 10:48:41 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 9CF346B0089; Fri, 20 Dec 2024 10:48:41 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 847FC6B008A; Fri, 20 Dec 2024 10:48:41 -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 651556B0088 for ; Fri, 20 Dec 2024 10:48:41 -0500 (EST) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 2982044BB0 for ; Fri, 20 Dec 2024 15:48:41 +0000 (UTC) X-FDA: 82915767606.20.9577038 Received: from mail-io1-f52.google.com (mail-io1-f52.google.com [209.85.166.52]) by imf25.hostedemail.com (Postfix) with ESMTP id 9EEFDA0004 for ; Fri, 20 Dec 2024 15:48:14 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=lrNHkzVv; spf=pass (imf25.hostedemail.com: domain of axboe@kernel.dk designates 209.85.166.52 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=1734709703; 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=ymwG1n6nWD/uJHK94RoKI8EVCXuU9v7PVyju+T4v7w0=; b=GI+ZPMdNas89GkwB4iqD9qxpY32AeLO0hIVZcwRksUE7RnlPeEXFf91qsgib5ClGb2uwTL bk2hgs5QvpbfVd4zASbC8IzcJdgVR3mn2wWbdn6hmTuCJfC8HPBBk8/wIU32TsujOq7M6Y jPzwVKN1edck6/K/X40nAhmCyVoqBjg= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=lrNHkzVv; spf=pass (imf25.hostedemail.com: domain of axboe@kernel.dk designates 209.85.166.52 as permitted sender) smtp.mailfrom=axboe@kernel.dk; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1734709703; a=rsa-sha256; cv=none; b=qK++gQKmlMF0rA0fS8MhtneSb1JXtw7y8KdL6jVUajwhB1cm18ePyfgmPhzY90TbI9OA3T PZEhf1TBwUYEVw6Q7jGDPp62ZiX3Ns1RdnF+pqmxi60HtLSVvqtS18RFCe+bp0dE+uNuTf cbEldELrfT1EF5H4CpTY0Y/YNMhOMeA= Received: by mail-io1-f52.google.com with SMTP id ca18e2360f4ac-844e7409f8aso74948839f.1 for ; Fri, 20 Dec 2024 07:48:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20230601.gappssmtp.com; s=20230601; t=1734709718; x=1735314518; 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=ymwG1n6nWD/uJHK94RoKI8EVCXuU9v7PVyju+T4v7w0=; b=lrNHkzVvgTi8e/mYkao8j+juYH7FtI6UGNHPfSL7Z7Hz0cKdrudKeJbpV2ZzDu921c dfd7FiiRKdU7holmcs/IRZXnWi+/soHPgeBvfkpPXxWaoMemHVk2YZeQeCj3k8fvHC+z LHDyUS3a0s40PkNCpdiLIaMoM3BCtb/opJycGylK9l9s7wIU4QDhD8tSnSxSuiMkkAb5 SN6WEXxbucIQhh3g4N6RGZ1R+RgdVfyj/7rUHqY1QTR7fdSU00JrZwKtdxFdb3H+EzCu 9vMtehceInK6NhOq0du9tRY0V0nr4Lo3rvJPh2YHIBYy2yaMneWdH+4qtkEU85Js5kRL PsLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734709718; x=1735314518; 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=ymwG1n6nWD/uJHK94RoKI8EVCXuU9v7PVyju+T4v7w0=; b=XezKHlPcs0G1U2PBxVW7y02huWycdOYtLTfd2ElOvYxv0uJJiRVRPc3ZDMahEAskJd XuV92lIo8TY/fvI8/mLoe/5NyStxd4yOUG+Q+Dcx1WUhjNdyfbPbDIxtnGTmxIumSxn2 0IkK+g3WM3sKYGC+wd+w7ZLFW4Ia2VwIc7efLlIyGl1e+2UmQIGIO6Mwo8Le0NwBTf2e eLCHkqPpTXhFmFi74z4+6TKyPRIFXzwNvE9uDUEVabGVJAy4Gh8hz8DhUKDLEDO1qcWS hqGnOo9G+5+RAaTuxp197LTGVrDDgqHG1Vev4QBohc0tynvmissfVHRAUVZm2JZb0/ha DDoQ== X-Gm-Message-State: AOJu0YxYo9fVD6mQR7mrpfuWmuoGwQW0UMH17x3owlyP7yosd7qGSxey ZSBOQ2hoVngmbErei/vu/bq+uR0uhY7yCXXBJxYH7Y42XXvpAIj6EuPBvgdNbXf/SyhriOFG2Tk g X-Gm-Gg: ASbGncve3Qm2cDGFeHcH3klAGk48liF6IJkb65Pnz7GCR61KzSsyHamOkU8eEXn/An1 +leeV/AmEH0+O3iuUVVGTu98XQorZdYAPrOtoJlEEvJghK+/C/6m9t9aAKjD+uTijUGvc13t0By +XGd0UAXr3qZihHvmynIfAIUf99IepfC+r/wXF/RAana6eVUXS75ny2DDDRFJrwsmzmaKBoDopa rLFre0c7UzULWmvRHVYDN0TdK3DFIeD5FNQWJbwq3vYYfV2iKVzhT0ldtFx X-Google-Smtp-Source: AGHT+IG3fN9OsN4GGTbFHoS9tD5hs657TGN6y3Qqvn5pakOnrgdzlOR3L4/c6Fhv1UMBXZPo8R74Hg== X-Received: by 2002:a05:6e02:156d:b0:3ab:1b7a:593e with SMTP id e9e14a558f8ab-3c2d514f9ebmr38935955ab.19.1734709717719; Fri, 20 Dec 2024 07:48:37 -0800 (PST) Received: from localhost.localdomain ([96.43.243.2]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4e68bf66ed9sm837821173.45.2024.12.20.07.48.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Dec 2024 07:48:36 -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 , "Kirill A . Shutemov" , Christoph Hellwig Subject: [PATCH 02/12] mm/filemap: use page_cache_sync_ra() to kick off read-ahead Date: Fri, 20 Dec 2024 08:47:40 -0700 Message-ID: <20241220154831.1086649-3-axboe@kernel.dk> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241220154831.1086649-1-axboe@kernel.dk> References: <20241220154831.1086649-1-axboe@kernel.dk> MIME-Version: 1.0 X-Rspamd-Queue-Id: 9EEFDA0004 X-Stat-Signature: yqeq14hxq1ei4qohp5zjrhykgshpdf1w X-Rspam-User: X-Rspamd-Server: rspam11 X-HE-Tag: 1734709694-459686 X-HE-Meta: U2FsdGVkX1/Stk06K1/lOMrYcF1WOWTDV72th1AkBQ8MTzXMC1kCA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5BX++Ojo388WBfKPGgeysacknoZ6nJeGQxhsxwqrvpcE3hMsiV7bkGDloxACVZkKyPWsneveZ2uytHjvFUmaPYdryRUE2Ui2qRTXculfAzzm2CThffPXW1/P4E3+MdxguYhsQEVLgYNbiH7UtUgry3XIyvzLCYMLJZ1RL5uN/OzjaRKARxgtAt5paP0V7Uum7kzptT7W6/xAMR3rZZqEH4NSx+MxgifvNrPI4k96 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000014, 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: Kirill A. Shutemov Reviewed-by: Christoph Hellwig Signed-off-by: Jens Axboe Reviewed-by: Matthew Wilcox (Oracle) --- 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);