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 222A6E77197 for ; Wed, 8 Jan 2025 03:35:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A4C066B0088; Tue, 7 Jan 2025 22:35:36 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 9FCCC6B0089; Tue, 7 Jan 2025 22:35:36 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8C39E6B008A; Tue, 7 Jan 2025 22:35:36 -0500 (EST) 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 6D3456B0088 for ; Tue, 7 Jan 2025 22:35:36 -0500 (EST) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 2F6281A02E6 for ; Wed, 8 Jan 2025 03:35:36 +0000 (UTC) X-FDA: 82982869872.04.5AC9BA2 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf24.hostedemail.com (Postfix) with ESMTP id 589F618000A for ; Wed, 8 Jan 2025 03:35:34 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b="aHtvWA/2"; spf=pass (imf24.hostedemail.com: domain of akpm@linux-foundation.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1736307334; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=PsNdTIcevroVpX03Nn2PCduUf2HZpr0FNRYGMvRDrZo=; b=6xfFSfF6W6OW0ci+Apo5MQxwUo+P/hSWQKzUs0pvzzeV0B9HwmwL57ixv1YtrRhkTL5KuK QQw3A4Qg8tDIkvv2s7S+p5iiyxodhat0Qsqf4hwVnud19V+0EoiWDZATLH3zrM5FwQElcG QVHt79Ak3gYJta6Nolr5RRP34vh9duc= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736307334; a=rsa-sha256; cv=none; b=u8XleN1iLEH0gs+z198zprNf0NSrnY5t36R/OOIvAqxCoRBs1fyqGTMSF6465AIaZngWHj lvggZvROKvHUWr64BwAtsXnuixI4MJfVgPhX7CAYKQNSmn0NMeos6eN6lbt0CyJNBtGSsc s5SKBwQgDEw9FKoruVu7EBIYRoZ1gpg= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b="aHtvWA/2"; spf=pass (imf24.hostedemail.com: domain of akpm@linux-foundation.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 329A55C1028; Wed, 8 Jan 2025 03:34:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A7BF0C4CED0; Wed, 8 Jan 2025 03:35:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1736307333; bh=sQAX/iqTnOw6UTmjfw9UedjzVrSYr4SYKc+Q9qOwxpQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=aHtvWA/2Te0L5DBjFwURMWyTb0dSEVJLliE7pNi73K/Ju/hz3WhqLhRGulkwoCgy4 Vrp9VScfP/Ry42p2FFbE1zoagysnj+14Qf+33OO9tO4rCudYzP5Hl75v599tT35vkX GR4a1LWBMnQ3KkCdeZMv0QwvPQlLWWPyJ+iw+hGw= Date: Tue, 7 Jan 2025 19:35:32 -0800 From: Andrew Morton To: Jens Axboe Cc: linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, hannes@cmpxchg.org, clm@meta.com, linux-kernel@vger.kernel.org, willy@infradead.org, kirill@shutemov.name, bfoster@redhat.com Subject: Re: [PATCHSET v8 0/12] Uncached buffered IO Message-Id: <20250107193532.f8518eb71a469b023b6a9220@linux-foundation.org> In-Reply-To: <20241220154831.1086649-1-axboe@kernel.dk> References: <20241220154831.1086649-1-axboe@kernel.dk> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 589F618000A X-Stat-Signature: cjj96oxsjimibo73mi3g7xxs6cj4rx88 X-Rspam-User: X-HE-Tag: 1736307334-921727 X-HE-Meta: U2FsdGVkX1+7yV4u6A5iZsctO0tQd+h/1l+/S9iuMzcNlzSNcRxEAD99bHH6evVzEr6N9z7oFWloe+QKc4N89oR3TVRjIsYeASq/yQWF9JaeUCWAnNk13RnKzblZpVHb+GlBg5kHxD/93BgyJUy3CH4QwtZKJQqOMP2h1+TRegj699/h8/pT0evxTF0WjKpOG2+h9BkYpoCDaOKi79Zsk7xJULLMA8FUNFz+++ebqqgrpF032UFn25SN+3zEWD7/NNba56vQ7J5J1dxhGEb+LN/QKMBrg4a4kmK2v4ORxnBpMFtJy0hs9/JaLwQhdoEa8B/hsaeWDF8dDTPGaxwYEjVTgQPybeIwIJOQZ3P5TH3vtRFrNkgRXP9fNVTx2Vvu900bjOysW0+YzJcljEjuUi27uL+qgl7RRGCPUlcuC69H7iNQ/mQF+OmPzOkCs8sA15iiMlDLItUpd76a5TWQiPRCI6OqUpZkcFuqH824lenwsKDWzXfKq/g/CJdVBmJzdVxS9m+HolgtWgj+nfy2mR05/Iejhy0m2pxZ/iKug0dzmzZnXHb1FEzKfkekxwPh+TC9/XWu4zKoBoYAq9E7vOLRyVk+gsL00E6f8fMadg150u3wX7v8f+/JMzZPGQXE5qnlzklMzqom/uBv3Ut341Tr/6hsfKOAkXnM2uHDsJ0TfUcZlzTSje4kfKgyx1f8vZKIrABZYpSgMNm1gS5eWTPKBFLNJ6IQxCo0unD7+dQnXzfLlWFlGmMpO1D84jQIrrlOTVgamTZ+VBha9evKQHGfPnSYbUFPypEYXg4hnO4I4iBc3fc7zBzsxh+DVciyljAzZXcPrT7oNjg3tjrIuXtD1yRP2SUgt05sIy9LnsqlnNP2LpfI2MSpBVY26QEuc2VAtkM4KlYaFgq7s4ABTlUgcc5olRbQrUPqL7pNbCYxcLsUX5cZ41fkVUkr6Hko+OLRmxzseCQVF9NUqhs orHaYe2L 5N5XXAu7dS+vnu52gkQnie+UQtkgy+kZ83ygeCGMjuDOInNRpmZCDfkV/bjnna1cbtiXEOaelE0NVZZmoVIyc5hcvtB3sHjPEkyPh4kgZ03wPhPzlN6/DW4pDZSQrTGw0wDjbXHyGjgff3avpA5fpd7yDo1eBTj5kMGlbOghYwv3ll2krWquexW21D/CBlxH0+Vq2tEvkrtdlqU7wv0/bu70pcIUwIqAAVbBtpY87TXAh5IshB/tqyZRcGMQ9/LYpN+37 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: On Fri, 20 Dec 2024 08:47:38 -0700 Jens Axboe wrote: > So here's a new approach to the same concent, but using the page cache > as synchronization. Due to excessive bike shedding on the naming, this > is now named RWF_DONTCACHE, and is less special in that it's just page > cache IO, except it prunes the ranges once IO is completed. > > Why do this, you may ask? The tldr is that device speeds are only > getting faster, while reclaim is not. Doing normal buffered IO can be > very unpredictable, and suck up a lot of resources on the reclaim side. > This leads people to use O_DIRECT as a work-around, which has its own > set of restrictions in terms of size, offset, and length of IO. It's > also inherently synchronous, and now you need async IO as well. While > the latter isn't necessarily a big problem as we have good options > available there, it also should not be a requirement when all you want > to do is read or write some data without caching. Of course, we're doing something here which userspace could itself do: drop the pagecache after reading it (with appropriate chunk sizing) and for writes, sync the written area then invalidate it. Possible added benefits from using separate threads for this. I suggest that diligence requires that we at least justify an in-kernel approach at this time, please. And there's a possible middle-ground implementation where the kernel itself kicks off threads to do the drop-behind just before the read or write syscall returns, which will probably be simpler. Can we please describe why this also isn't acceptable? Also, it seems wrong for a read(RWF_DONTCACHE) to drop cache if it was already present. Because it was presumably present for a reason. Does this implementation already take care of this? To make an application which does read(/etc/passwd, RWF_DONTCACHE) less annoying? Also, consuming a new page flag isn't a minor thing. It would be nice to see some justification around this, and some decription of how many we have left.