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 8D535C25B78 for ; Tue, 4 Jun 2024 14:13:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EB4BB6B0095; Tue, 4 Jun 2024 10:13:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E64216B0099; Tue, 4 Jun 2024 10:13:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D03FC6B009A; Tue, 4 Jun 2024 10:13:32 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id B2F156B0095 for ; Tue, 4 Jun 2024 10:13:32 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 0504F80938 for ; Tue, 4 Jun 2024 14:13:31 +0000 (UTC) X-FDA: 82193399064.20.8D08A3B Received: from fout2-smtp.messagingengine.com (fout2-smtp.messagingengine.com [103.168.172.145]) by imf24.hostedemail.com (Postfix) with ESMTP id E0A9C18001A for ; Tue, 4 Jun 2024 14:13:29 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=fastmail.fm header.s=fm1 header.b=LnI1lWQY; dkim=pass header.d=messagingengine.com header.s=fm1 header.b="K 6QFe6m"; dmarc=pass (policy=none) header.from=fastmail.fm; spf=pass (imf24.hostedemail.com: domain of bernd.schubert@fastmail.fm designates 103.168.172.145 as permitted sender) smtp.mailfrom=bernd.schubert@fastmail.fm ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1717510410; 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=bJi9vz7z4EpKqStQ/qCCfjVPwNnCLYGxaXBygPSxRPs=; b=HPY93/cPiWUM4o5R5eroRTo0Hc+kzyghRKeMRuFSPGBoi6FEN1jcSPF6Ic51Zi4tY5qOYa hQ6lJzM1/uKd/Giiq8VaHS1H1XmaXmOMBqCwq/AExsVLXS1tX08/DeoOtqxzKjjTPRNZjv h2eUaX5OV/RCVFK3YC1ullMZdd9QVxY= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=fastmail.fm header.s=fm1 header.b=LnI1lWQY; dkim=pass header.d=messagingengine.com header.s=fm1 header.b="K 6QFe6m"; dmarc=pass (policy=none) header.from=fastmail.fm; spf=pass (imf24.hostedemail.com: domain of bernd.schubert@fastmail.fm designates 103.168.172.145 as permitted sender) smtp.mailfrom=bernd.schubert@fastmail.fm ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1717510410; a=rsa-sha256; cv=none; b=M4XODeYQQHX2llqAGImSFTlWFeAu23uklOMJooOfFJp2Ii9Ooi+xdD4/x2uCLFt733ES57 /a1sf4HG0zjHYD8QQc0mgiluT7pNM2uNxTHQ5pTf8ldVloN631IxOilWwBjTKaA2ynuWdJ f1lNDrgaaswWtAXuslpG0jlqS5AFXAc= Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailfout.nyi.internal (Postfix) with ESMTP id 28417138008E; Tue, 4 Jun 2024 10:13:29 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Tue, 04 Jun 2024 10:13:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.fm; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1717510409; x=1717596809; bh=bJi9vz7z4EpKqStQ/qCCfjVPwNnCLYGxaXBygPSxRPs=; b= LnI1lWQYJtuFz9P4HtDVK8ExuCGoD8ouuMKe1wg4L3qcgf/TdhQ3xZNC+TVXe420 ZcL4xA1F60aBc4AgFHNMiMSFzS/UyGlzZl+E4t6DqsbiJvhJHS7DxwsVgDFT1uQT Xih3S+oIXadAPxxO6BqJK+Of9DAJvuI7FFYjKVA34/rQX2JHRXBuO/nHmYDBQAFU KPsv8i/SEn/Io5I6y3e1pbZC7csYJfW7rKA2LVo72IAxBqQVwsHFvmYJEu0Wk5fx duJB1Jwiyyqs6LbajPE70hEGrhxr/6xFRoEUPpPUvMtKozrvq7yzBf4+BzySsoYR Jwtm+LusCfMsb6sXbsXqww== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1717510409; x= 1717596809; bh=bJi9vz7z4EpKqStQ/qCCfjVPwNnCLYGxaXBygPSxRPs=; b=K 6QFe6mYDipWGIJpnzI46+v3KCBt01QX+rKTNS6Bw42gXW/fuZwRLMIhCYPND562v XQYuIC0+VlnM5w8IboGtAKG7i1h9EHGIveTzERqbjFl3MnMm/6vb6iy/kZKVZRcP COBdE0hhDAtMmJ0HcCBffSaBrqFzf7rnRR2Ep/1I8C4f9mN8XI3nxHN7JnWj0GWW SD9xa9RHpcvA0AMvK5xN0J2mVwFsWxqz9Z7KMxXiVgB7bb+RNINr2yGiqFELs7Pp qRR+yPeGrOfJrcCydJJL6qLPbCfBFYfHVzmF0fTahCACZO2F0oL9mR5zDtOGQCE3 xCHd50vVz+KI7WxAYBRgA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvdelgedgieelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtvdejnecuhfhrohhmpeeuvghr nhguucfutghhuhgsvghrthcuoegsvghrnhgurdhstghhuhgsvghrthesfhgrshhtmhgrih hlrdhfmheqnecuggftrfgrthhtvghrnhepvefhgfdvledtudfgtdfggeelfedvheefieev jeeifeevieetgefggffgueelgfejnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrg hmpehmrghilhhfrhhomhepsggvrhhnugdrshgthhhusggvrhhtsehfrghsthhmrghilhdr fhhm X-ME-Proxy: Feedback-ID: id8a24192:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 4 Jun 2024 10:13:26 -0400 (EDT) Message-ID: <21741978-a604-4054-8af9-793085925c82@fastmail.fm> Date: Tue, 4 Jun 2024 16:13:25 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [HELP] FUSE writeback performance bottleneck To: Miklos Szeredi Cc: Jingbo Xu , "linux-fsdevel@vger.kernel.org" , "linux-kernel@vger.kernel.org" , lege.wang@jaguarmicro.com, "Matthew Wilcox (Oracle)" , "linux-mm@kvack.org" References: <495d2400-1d96-4924-99d3-8b2952e05fc3@linux.alibaba.com> <67771830-977f-4fca-9d0b-0126abf120a5@fastmail.fm> <2f834b5c-d591-43c5-86ba-18509d77a865@fastmail.fm> From: Bernd Schubert Content-Language: en-US, de-DE, fr In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: E0A9C18001A X-Stat-Signature: y1rrudcji4qw343ftjetqenbohyhy4e1 X-HE-Tag: 1717510409-538052 X-HE-Meta: U2FsdGVkX1/b6Zgs58tBguMOs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LYe+yVCFL6qufr3/cy8fOVc5SQX5A6jbZ2SJEFqGEhqEya5aj7Lcjsoe1MEK4kWmjbc5kS/PJszDJL/whMalEFzbuSoYIbya0FigMgaooUjk7TM/dktIByZGabZ1m41P9soLK9JiZJ+z1zJFydv8AeFA95PTRD2b7ETp6hdHrMQVqSOYQvV99oLtoXOWwgM5wD9O+D/d9DThZc/y7w0Riygs2sBUVzJpSfdbua6ZO1+Bm5Xzwmsw== 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 6/4/24 12:02, Miklos Szeredi wrote: > On Tue, 4 Jun 2024 at 11:32, Bernd Schubert wrote: > >> Back to the background for the copy, so it copies pages to avoid >> blocking on memory reclaim. With that allocation it in fact increases >> memory pressure even more. Isn't the right solution to mark those pages >> as not reclaimable and to avoid blocking on it? Which is what the tmp >> pages do, just not in beautiful way. > > Copying to the tmp page is the same as marking the pages as > non-reclaimable and non-syncable. > > Conceptually it would be nice to only copy when there's something > actually waiting for writeback on the page. > > Note: normally the WRITE request would be copied to userspace along > with the contents of the pages very soon after starting writeback. > After this the contents of the page no longer matter, and we can just > clear writeback without doing the copy. > > But if the request gets stuck in the input queue before being copied > to userspace, then deadlock can still happen if the server blocks on > direct reclaim and won't continue with processing the queue. And > sync(2) will also block in that case.> > So we'd somehow need to handle stuck WRITE requests. I don't see an > easy way to do this "on demand", when something actually starts > waiting on PG_writeback. Alternatively the page copy could be done > after a timeout, which is ugly, but much easier to implement. I think the timeout method would only work if we have already allocated the pages, under memory pressure page allocation might not work well. But then this still seems to be a workaround, because we don't take any less memory with these copied pages. I'm going to look into mm/ if there isn't a better solution. > > Also splice from the fuse dev would need to copy those pages, but that > shouldn't be a problem, since it's just moving the copy from one place > to another. Ok, at least I need to keep an eye on it that it doesn't break when I write a patch. Thanks, Bernd