From mboxrd@z Thu Jan 1 00:00:00 1970 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 C88EBC5478C for ; Mon, 26 Feb 2024 23:48:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2EE434401CD; Mon, 26 Feb 2024 18:48:58 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 29F2044017F; Mon, 26 Feb 2024 18:48:58 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 117EE4401CD; Mon, 26 Feb 2024 18:48:58 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id F256344017F for ; Mon, 26 Feb 2024 18:48:57 -0500 (EST) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id CB50E40A39 for ; Mon, 26 Feb 2024 23:48:57 +0000 (UTC) X-FDA: 81835597914.04.6910C58 Received: from mail-ed1-f42.google.com (mail-ed1-f42.google.com [209.85.208.42]) by imf23.hostedemail.com (Postfix) with ESMTP id B082C140009 for ; Mon, 26 Feb 2024 23:48:55 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=google header.b=MjlylAWA; spf=pass (imf23.hostedemail.com: domain of torvalds@linuxfoundation.org designates 209.85.208.42 as permitted sender) smtp.mailfrom=torvalds@linuxfoundation.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708991335; 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=SYfl+v2OzAJpVUFUvJIQ4ltKHlEy4WHz/kYWr9Yc7PE=; b=Bx+qrdKdU7c3F/i3TqBUtJT6GCpZ7wWc8Y1S0Snhj3vMFy+JSSCjHB2KvLLYGGe6lUIxIQ iMPxzM4kZ/i4KDUlvuJPWXT2QQSsR41hTi7zUYr388uqjsfrnYeM2Qz2qk6qHvanX4xsAR e168/VyPW93noMcyABUrgmXyrd0Wzbo= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=google header.b=MjlylAWA; spf=pass (imf23.hostedemail.com: domain of torvalds@linuxfoundation.org designates 209.85.208.42 as permitted sender) smtp.mailfrom=torvalds@linuxfoundation.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708991335; a=rsa-sha256; cv=none; b=AN8B8i+mMEWL+gEjUsF8W6zxNqGawRLJD7opXHhBUG2m723JW3QeW1QSOl5rrv+UfekGsQ cLVnbBAdy1bCA29LlzDnRNFvqUMbCrYDVjTEbbTabz97ht8LsLkxd1mvLFV0Cye2Gyb5TJ gTxV6sdFg44Xx6sTJOrjPilwmYZvNHg= Received: by mail-ed1-f42.google.com with SMTP id 4fb4d7f45d1cf-5640fef9fa6so4786340a12.0 for ; Mon, 26 Feb 2024 15:48:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; t=1708991334; x=1709596134; darn=kvack.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=SYfl+v2OzAJpVUFUvJIQ4ltKHlEy4WHz/kYWr9Yc7PE=; b=MjlylAWALqCAUO6TSVV8Ezl4UF/QY/sAMel3HB/chl/xor8GqLXwEsLMGNXndlax9B m41rspa5AFGYSbr/dmoixcYJLvpojrpGZ80EXK3T8OOS1Bx2K476t+BOypcN1cs7EPeH TwOFgDXoHcurFlTh047oGEhQedhRVEHOUGnq0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708991334; x=1709596134; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=SYfl+v2OzAJpVUFUvJIQ4ltKHlEy4WHz/kYWr9Yc7PE=; b=k8nQS9ZuKvHsgZovAlociKPB2+y9K9fO4HnvnyOrlWcu4/vDuPiJ+Yh3PmrzFlpKeP vxKYdnSolbuOXpfZCGlnWuxo3IdjMYIm4uzKgBNwEJUxvg93xbsv43JTWRQEpd0UYzlH iXxK8pXg4BLxlVkXs6vs3smaBlZNTt6ts1Q54kdfFunBEyweulkYdAtLiKva3OtwgoeV f3nSk6hRPONromKu39Z4q8pAZjQeiEJMcTWrTY7VaNMgX1GvtOVwGfaslC8q5AlKxphY VJyVjf8D42kgO7ZvEtHBVS9ZMmsAbzsdbBSVKmpcfT4/dFriEqAXDu4ypLAbUcdAOZ8b knKg== X-Forwarded-Encrypted: i=1; AJvYcCUoOYAAxgM5PP358iWenphRcNpGKmluv+XWNXGBeGjrEopkUBidJO6CCciQR1nAfEjnYseTaZ47w2raVsTlIUG+euU= X-Gm-Message-State: AOJu0YzvZ7Yc5WcwoMUqSmWz1zBve2EhRI8grZv5FJ81BaYorFA2ZIwH O93fDQhTd8mSdNoOlxkq5oLLC5n8zeoA280AlvvjZqizM80rNKHUSkSBV4LzN5XqcTJ/V/14q/u Zw4skFg== X-Google-Smtp-Source: AGHT+IEW7W1qT5yfO/nH+rLdbSP7XaRtBvguCRujXWm/BmZz0R4G9Dl9Zr7sGulAosICAIST121v3Q== X-Received: by 2002:aa7:c706:0:b0:566:2f24:b065 with SMTP id i6-20020aa7c706000000b005662f24b065mr435248edq.34.1708991333848; Mon, 26 Feb 2024 15:48:53 -0800 (PST) Received: from mail-ed1-f45.google.com (mail-ed1-f45.google.com. [209.85.208.45]) by smtp.gmail.com with ESMTPSA id p13-20020a056402500d00b005648b000e91sm211058eda.92.2024.02.26.15.48.52 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 26 Feb 2024 15:48:52 -0800 (PST) Received: by mail-ed1-f45.google.com with SMTP id 4fb4d7f45d1cf-565ef8af2f5so1967970a12.3 for ; Mon, 26 Feb 2024 15:48:52 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCXyt2aJPzAOXsU5h6eqGRKKybJ7YWhMARQzix98hw28Pv3vo8BikeTjvdjGQiabgSCjYH30i2d/ffjHF2ZfvI9jLY0= X-Received: by 2002:a17:906:f894:b0:a3e:72ca:700d with SMTP id lg20-20020a170906f89400b00a3e72ca700dmr5330908ejb.45.1708991332329; Mon, 26 Feb 2024 15:48:52 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Linus Torvalds Date: Mon, 26 Feb 2024 15:48:35 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [LSF/MM/BPF TOPIC] Measuring limits and enhancing buffered IO To: Al Viro Cc: Kent Overstreet , Matthew Wilcox , Luis Chamberlain , lsf-pc@lists.linux-foundation.org, linux-fsdevel@vger.kernel.org, linux-mm , Daniel Gomez , Pankaj Raghav , Jens Axboe , Dave Chinner , Christoph Hellwig , Chris Mason , Johannes Weiner Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: B082C140009 X-Rspam-User: X-Stat-Signature: a9yrp37bh36gtk7w34sq4mgifh38c15a X-Rspamd-Server: rspam01 X-HE-Tag: 1708991335-662365 X-HE-Meta: U2FsdGVkX1+f6H+dg2tk71B0lhkWUNel60TjwirnEv3CVUqwwVMxcVUKuTFGCEX7r90833OwPDjzIZK4Vs7VSYcOmxebb9xBrIveCtTSZKy5ql+4A2pipu8RR5tZ58vtFx92frvkK4ph5t+ZqujobggAhlBUQpk6Y/tHsf6y8y2V+Tj39ORnketIMlpO4XQ6B1dVnWb3xJNOgjyHP8JJi+sHgV0wd+Nf7GaAueQbxbYZko91o26NEbBID0fsEP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bsvg9pQ2svlMSeIxp0IDf542TxOmE0HCD9zSSwlNiI2ZwIiCgMOaw/E9zwBlPpWm2CjZfbq8o0Sk/e9CiOusZ1repBrlzBMgrkdBwtE39ERAR2u0AUgUwvSBS/07MdyMOyxPnsKIh55oL3J91ufJAw8xP5tHaFxUJOneDO5JOzBp1iCPpUayLlPJCL3GiFi3SOcnNU146I2ltkMyLEGRT5QU X-Bogosity: Ham, tests=bogofilter, spamicity=0.000007, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Mon, 26 Feb 2024 at 14:46, Linus Torvalds wrote: > > I really haven't tested this AT ALL. I'm much too scared. "Courage is not the absence of fear, but acting in spite of it" - Paddington Bear / Michal Scott It seems to actually boot here. That said, from a quick test with lots of threads all hammering on the same page - I'm still not entirely convinced it makes a difference. Sure, the kernel profile changes, but filemap_get_read_batch() wasn't very high up in the profile to begin with. I didn't do any actual performance testing, I just did a 64-byte pread at offset 0 in a loop in 64 threads on my 32c/64t machine. The cache ping-pong would be a lot more noticeable on some multi-socket machine, of course, but I do get the feeling that this is all optimizing for such an edge-case of an edge-case that it's all a bit questionable. But that patch does largely seem to work. Famous last words. It really needs a lot more sanity checking, and that comment about probably needing a memory barrier is still valid. And even then there's the question about replacing the same folio in the same spot in the xarray. I'm not convinced it is worth worrying about in any reality we care about, but it's _technically_ all a bit wrong. So I'm throwing that patch over the fence to somebody that cares. I _do_ now claim it at least kind of works. Linus