From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C97CD606A31F for ; Wed, 21 Oct 2026 08:33:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=QtpM+94P Received: by kanga.kvack.org (Postfix) id CE2246B0678; Wed, 21 Oct 2026 04:33:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C92D46B067A; Wed, 21 Oct 2026 04:33:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B82786B067B; Wed, 21 Oct 2026 04:33:16 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 8D9E26B0678 for ; Wed, 21 Oct 2026 04:33:16 -0400 (EDT) Received: from smtpin18.hostedemail.com (lb01a-stub [10.200.18.249]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 0C8921A04B4 for ; Wed, 21 Oct 2026 08:33:16 +0000 (UTC) X-FDA: 85345968792.18.A124A9B Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by imf14.hostedemail.com (Postfix) with ESMTP id F28E2100006 for ; Wed, 21 Oct 2026 08:33:13 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20260515 header.b=QtpM+94P; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf14.hostedemail.com: domain of kas@kernel.org designates 172.234.252.31 as permitted sender) smtp.mailfrom=kas@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1792571594; 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-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=MKByxw8dDW6HSJz8+UMbqi5YMYg3uB2cb2BltWyQmtY=; b=hmHHIvJedsxic1JSINC8g9tKTIWNIvOhwCON6G6vsDoahA2yLNP/TBYFWk5caSB0Os2ckC tB17mPpiKFktbT4YTrGKRnmUOuCfDdQtRC3gGBSgntDOY2gDFHpLVb9uog+E9itfpT2oII xzLxoMtbGQ3lEjJL56zzwkx+wDInr+Q= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20260515 header.b=QtpM+94P; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf14.hostedemail.com: domain of kas@kernel.org designates 172.234.252.31 as permitted sender) smtp.mailfrom=kas@kernel.org ARC-Seal: i=1; a=rsa-sha256; d=hostedemail.com; s=arc-20220608; cv=none; t=1792571594; b=AXMGNfPayFXkGlZAWIW8wMFIvToWzNQrqXRdzfLyEJydDyb+xw5ZnGHMhwsj6w1gri8MKm U/UGUTBGvPoiBb289RhrfouO/iLe+hBpFUqcqGTYZnM8E3EeVw4+4eEh1uGR6ix/e2QwoF MSWLN9wDgZzqWJf2yfVuNPYk8c/9CLQ= Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 2197843D26; Wed, 21 Oct 2026 08:33:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5F32E1F000CB; Wed, 21 Oct 2026 08:33:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1792571593; bh=MKByxw8dDW6HSJz8+UMbqi5YMYg3uB2cb2BltWyQmtY=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=QtpM+94P0z/ja2LfWi1SKDPVylIFLra5YBht5Gdl4ToK7koxRMrqLfqlFA6US5oc3 3+xUnVvo/Y7M+Izf5+pXUzsRxldK98M1KJrd5mNfp4ME9zkbgkkajDpOwKYTgtw/qj r1DUqsE4e8dj7RM7K+JilygqmHkigjTqfMnclTo1YQ/YNCp1YGE8NcrGv9LF9qln6a +OAHHmrFUeL9DW2HyspbiMqLPl5iXJX6S4GfOHC5geAqZpkLySVG2ImEaV4xp9J2LZ jIz1SbEL45Sunpjq0AFLoRcG9SE/lz9ACwk7ieWFZy79gzhKLxYKkn26a6SIOEvMvE AdV58TpRxBNYA== Received: from phl-compute-02.internal (phl-compute-02.internal [10.202.2.42]) by mailfauth.ams.internal (Postfix) with ESMTP id 96A7C198004A; Wed, 21 Oct 2026 04:33:01 -0400 (EDT) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-02.internal (MEProxy); Wed, 21 Oct 2026 04:33:08 -0400 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: dmFkZTFrsjqyNAVpEK98oebWFXwZpI7LqX9Aov6fN8jUp2sNNep1ITMUB5YykhVbmPS/JW hhu+Ze1IE7IQhEqDUpsMd7Cg7z0t93UpSSU3DYZM/EVADOuUVk+FjdtAeACf5DVZ07Qkhn t/PA68gModROd74o4gybU16E1jPYQsNXGLetxZ7IOa6m+sCSckxL6wwATbX1RUo4X8mwkX tvQzyXOt7I1CuCjEyKtXxHmz4HGj57DN9ITZyqARldyoDovSDBIwoWizcJ+AuScX7751LZ GsLMiHVmGYyi+16tRQPq7oISzc69Z2qZ+zI4txcHKFEUanCWKZTYL39zREtM9rxHRO8Jhq WH7pVuWso/HHzbbIyQWn+a0kjP0y4p2oz5+TPjDWJrRopIdu1nE5WVdG0PPJFjuufj8M0L GJ//TWPi0snycliRS5JJ37gww9RykpVb7LoEMV6J/YhMqGDXlyLbJ0tx1TUjl9rfgYneJi OKTrtcZU/jhXGREu335v/vLNLk3WQxS1jzpklNaJ7gFd3IhswJL1OmaUOh/+v2t6E1l+Bl AWWX+tWL4e/AZIyHtWrbzT8WHj0a9UNa5jeHi82Da4a/8bdG8RYbXxatW9tRg0y2KQIITM GFV8HOuowBhoXkp3irIUh2WZcBODF2cXEfd1sZfpqWHqGU10kSs+RI7+0DGw X-ME-Proxy: Feedback-ID: i10464835:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 21 Oct 2026 04:33:00 -0400 (EDT) Date: Wed, 21 Oct 2026 09:32:59 +0100 From: Kiryl Shutsemau To: Linus Torvalds Cc: Andrew Morton , David Hildenbrand , Matthew Wilcox , Vlastimil Babka , Lorenzo Stoakes , Jan Kara , Hugh Dickins , Christian Brauner , Alexander Viro , Miklos Szeredi , Miaohe Lin , Naoya Horiguchi , Oscar Salvador , "Liam R . Howlett" , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Brendan Jackman , Johannes Weiner , Zi Yan , Baolin Wang , Nico Pache , Ryan Roberts , Dev Jain , Barry Song , Lance Yang , Usama Arif , Kairui Song , Qi Zheng , Shakeel Butt , Axel Rasmussen , Yuanchu Xie , Wei Xu , Baoquan He , "Paul E . McKenney" , Pedro Falcato , Harry Yoo , Luis Chamberlain , Ilya Gladyshev , Jaegeuk Kim , linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, fuse-devel@lists.linux.dev, kernel-team@meta.com Subject: Re: [RFC PATCH 13/18] mm/filemap: store the end of a read in f_ra only when it changes Message-ID: References: <20261019154913.1765974-1-kas@kernel.org> <20261019154913.1765974-14-kas@kernel.org> X-Archived-By: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: F28E2100006 X-Stat-Signature: huzru845kx5h3js9f313jatrdyh6gq99 X-Rspamd-Server: rspam04 X-Spam-Status: No, score=-6.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Rspam-User: X-HE-Tag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svHjbVFNqZSd+aMTzaSA0DP9z/P5C2bASTn0UvRUCOVcMT3A46wvEScFfnD0zbUsybLyFfbjNSGMGFTdOC08vO9kqrEWjYKCAPG5eBFXQprfzkply2UJujM75IudDBRPmMrRRkNE0Op8vmNJThIVVBrc61jpEuY2+dnaBYCpBlCJzbnOmjIG8Sc0q7tIMoFCL5JdKJ7Etxn9oNRHlVsgGaVnlzwRvwc28KTPKyFCgTeiRHe0AT2QOFbLEb5uTiV3rUfdr8nSPtVNQuq/tInH2n5GEEKIJWL+Ot0Jo/FO1Nw/oC83LWlRsetKX/ipeVmIlf17UrfnDBNbIwuU6RdJ0UjWUyg/O9c6Hh6ENRjVGgCjbxJluZH9rTZlC115XFBarFc= Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 On Tue, Oct 20, 2026 at 11:20:00AM -1000, Linus Torvalds wrote: > On Mon, 19 Oct 2026 at 05:50, Kiryl Shutsemau (Meta) wrote: > > > > filemap_read() writes the end of every read to file->f_ra.prev_pos. > > Threads that read through one open file all write that cache line, on > > every read. The value often stays the same, as for reads that start at > > the same offset each time. > > This seems silly. That "often stays the same" is only true for the > pointless benchmark, no? > > I don't think it's ever true in any real load. Right. The patch is bogus, not only the commit message. It is worse than useless: for random reads prev_pos changes every time, so the compare reads the shared line and then writes it anyway. Bisecting a RocksDB slowdown led here: with patches 1-12 it runs at base speed, this one costs 4-5% at 16-64 threads. The store itself does matter in a real load. RocksDB threads pread() through one fd per SST file, opened with POSIX_FADV_RANDOM. With the folio refcount gone, the prev_pos store on that shared struct file is what they fight over next. For an FMODE_RANDOM file nothing reads prev_pos but filemap_read() itself: readahead is forced and returns before looking at it. Skipping the store there takes a small hot table at 64 threads from 10.7M to 14.1M Gets/s, against 12.5M with the series as posted. I will replace this patch with that. -- Kiryl Shutsemau / Kirill A. Shutemov