Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp1470134lqj; Tue, 4 Jun 2024 02:33:05 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCViWteG+ILo3OPdcIVtb+pLN/jgnYWT9SAgZlVRKhXb2Fs8nHhs+VlDv0d0MoVNomH5tLW2phaEsRTu94pyOlFScGmjfDBsFCWeU1UFpg== X-Google-Smtp-Source: AGHT+IGXf0lSiYaCSx5foFNlItLTK4uiaohzSPi5FiFPo2dy53xCG3nt0k6yiNBxMBIM0UjURCuc X-Received: by 2002:a50:d693:0:b0:57a:2acc:5512 with SMTP id 4fb4d7f45d1cf-57a364eb470mr8831854a12.39.1717493585458; Tue, 04 Jun 2024 02:33:05 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717493585; cv=pass; d=google.com; s=arc-20160816; b=HFw8XhvgPsgkPMJAFVrOIZvfrnpLNgBdLhE7Wg84lRaLr6VjU7CSoh67Nfp8jv7DsL atMHvftXfcznbuVmckkl5TTFGmrvwMQkYtATRwSW0QgztsVudVnHBtbfNZAIjVNIPVcR pmzCiiZQlUn1mcbssqV/yFpSYXmNOsF0jrSUoTuAxrML8qamhpxrj53r+JO5+uBbTqHe wzVexYyv0QtjGs2KQzDDDcm//dDUC2Axl49ZD+TJCVBfWazb48N/cZuOEGYo62KvqGc7 nm6jc9PVzYcw3/7KWyVrg1+eP0uZvC9AL98XgedeHNR1loew8AY/2pZJ8yBwkJt5CGao H0Mg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:content-language:from :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:feedback-id :dkim-signature:dkim-signature; bh=Z/p/FhNJ0mP2yG98DTjrbvV/ibnqnwF1h5OakqDfidw=; fh=iI+vkb3rQ9KqDFKezfdXDrKNwEWYdy1p3tT98krhsko=; b=epSiD2RclX0B8XGXmDN0eTlxK87D8fZT7zKxRsALIui237f2PJZfvKi87QsiTWQ/bH Gc8k2omE0Ivyf7rTW5YBpN/BGI7jzKVu8TM2l9OjGPfzMIh/cx/GI9UBZsGNb4ceeaic Zx4sEPtbXfjk8TNOPmbA0BzdCKWxdUN6frmEgNUXYemQS+yJbQk0Q35wrX3vXQFTUymU LotXRi6yvmZPXe7Ew76wXnx3q9/VSqCMNLsevgrmy2nG3vvYlpsfxcNrRmYaJFJHCjav 68bN5ksS8bhVhMKhlexLW/olfR6S+0QRuOJzdo2ndZoR8Ai5PCg2KC6OXlgIkZRjyZF+ GChQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@fastmail.fm header.s=fm1 header.b=SOeEetZh; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=bths4Dil; arc=pass (i=1 spf=pass spfdomain=fastmail.fm dkim=pass dkdomain=fastmail.fm dkim=pass dkdomain=messagingengine.com dmarc=pass fromdomain=fastmail.fm); spf=pass (google.com: domain of linux-kernel+bounces-200354-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-200354-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=fastmail.fm Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57a31c62724si4695983a12.289.2024.06.04.02.33.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 02:33:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-200354-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@fastmail.fm header.s=fm1 header.b=SOeEetZh; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=bths4Dil; arc=pass (i=1 spf=pass spfdomain=fastmail.fm dkim=pass dkdomain=fastmail.fm dkim=pass dkdomain=messagingengine.com dmarc=pass fromdomain=fastmail.fm); spf=pass (google.com: domain of linux-kernel+bounces-200354-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-200354-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=fastmail.fm Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id C43391F21C37 for ; Tue, 4 Jun 2024 09:33:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 98A28144303; Tue, 4 Jun 2024 09:32:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=fastmail.fm header.i=@fastmail.fm header.b="SOeEetZh"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="bths4Dil" Received: from fout7-smtp.messagingengine.com (fout7-smtp.messagingengine.com [103.168.172.150]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 89EE713B29F; Tue, 4 Jun 2024 09:32:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.150 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717493559; cv=none; b=Xxnhh1UM2tHbHgQNs3MWJjIhkxBKJ9HKCbmlEgA4S4vr5YAxbzlGdarcHhFsNyfGQCmP1XijedzBocmAYuPVdU92y75NWGGZFQcvSYRJcojgcCzx/weKOn8p3J7cnJEoSSkJkitoQPWUALfV467V6EToTKYpuzxr5i5+eyOUndA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717493559; c=relaxed/simple; bh=jHGksYsJhYFfvI7ABd+r/8I0l8LU2B9ZPQDS7hvB+d4=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=dtq/g0nEakT8OXSluCuJfO0mrOoirQVzvzLYQ6rp8JCrjkoLrrQg81NSAK9s/u0nEx4M/R3wOYywzVfdY61tmb77xskSeqZMemw2gMCnbuP5RzgY+uJxvU7QPjgVqvPOhq36+ubJ0qJRL8584BPsv+V1ORqsqex73Z5/nch1e+k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=fastmail.fm; spf=pass smtp.mailfrom=fastmail.fm; dkim=pass (2048-bit key) header.d=fastmail.fm header.i=@fastmail.fm header.b=SOeEetZh; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=bths4Dil; arc=none smtp.client-ip=103.168.172.150 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=fastmail.fm Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fastmail.fm Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailfout.nyi.internal (Postfix) with ESMTP id A00D11380118; Tue, 4 Jun 2024 05:32:36 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Tue, 04 Jun 2024 05:32:36 -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=1717493556; x=1717579956; bh=Z/p/FhNJ0mP2yG98DTjrbvV/ibnqnwF1h5OakqDfidw=; b= SOeEetZh0Ow/keZ1Ik1aO0oSKhs+/s4Kw/VEx4YcD/SmVXSWLDOY76xpjfP9WJlI RQDosdFOlCnE6boiapTohMGYH+X6vwr3CGDMraPUZlmuBw7NHwK1MvtxilAk4/ia OzggNKn46Ah+LsOQjzMdKxuEm4VuMsYkxjodEAtEp7J4BYSG+uAWT8CAdn0ysnCZ Ic8yXAthhRuOu7y+c99QUiBvQ5pbl7rkZSKprDmW9mgqx9MkLzt+4KCjV0f0HJJi pypGuHNJ+Aapql6o6sfrax0/UhrvywLdRI3VM1LaVhHxFIBqSjlU6smyWAxt+rZB 1NfPVftFM5lz0nvOGfStww== 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=1717493556; x= 1717579956; bh=Z/p/FhNJ0mP2yG98DTjrbvV/ibnqnwF1h5OakqDfidw=; b=b ths4DilJb7/VHsQJgh3N5g0pO5MmvqdZ4Y+PbEWZf7Lg7H2stEYHv8NAjztb5PIS nAwfw6HvDoxFQ21bkzqSntl+Z7RyhW+J8k70zgsUpRa3NNm/gncZhzL13N+czJID Jf2pba+9AkXuCUZzfAm7nvMbyEdWAJ9PwkoCw/oFxkomH0tdwajfNl7GvfXa4Zfs vMzIGDIqWHPY1islMfyBzKuc7mlLIyjNLWdsCzfCEkPzEXHIi2FYnIchPEu3D14f Jw/0hYACvkWjC0Ep/STKlnpsn/b8XMPDZoYzNPaV+Ecig2sWisrP8ZKTts1vC/zQ 65FVrkeapHJFswq6Wi36Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvdelgedgudefucetufdoteggodetrfdotf 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 05:32:34 -0400 (EDT) Message-ID: <2f834b5c-d591-43c5-86ba-18509d77a865@fastmail.fm> Date: Tue, 4 Jun 2024 11:32:32 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [HELP] FUSE writeback performance bottleneck To: Jingbo Xu , Miklos Szeredi Cc: "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> From: Bernd Schubert Content-Language: en-US, de-DE, fr In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 6/4/24 09:36, Jingbo Xu wrote: > > > On 6/4/24 3:27 PM, Miklos Szeredi wrote: >> On Tue, 4 Jun 2024 at 03:57, Jingbo Xu wrote: >> >>> IIUC, there are two sources that may cause deadlock: >>> 1) the fuse server needs memory allocation when processing FUSE_WRITE >>> requests, which in turn triggers direct memory reclaim, and FUSE >>> writeback then - deadlock here >> >> Yep, see the folio_wait_writeback() call deep in the guts of direct >> reclaim, which sleeps until the PG_writeback flag is cleared. If that >> happens to be triggered by the writeback in question, then that's a >> deadlock. >> >>> 2) a process that trigfgers direct memory reclaim or calls sync(2) may >>> hang there forever, if the fuse server is buggyly or malicious and thus >>> hang there when processing FUSE_WRITE requests >> >> Ah, yes, sync(2) is also an interesting case. We don't want unpriv >> fuse servers to be able to block sync(2), which means that sync(2) >> won't actually guarantee a synchronization of fuse's dirty pages. I >> don't think there's even a theoretical solution to that, but >> apparently nobody cares... > > Okay if the temp page design is unavoidable, then I don't know if there > is any approach (in FUSE or VFS layer) helps page copy offloading. At > least we don't want the writeback performance to be limited by the > single writeback kworker. This is also the initial attempt of this thread. > Offloading it to another thread is just a workaround, though maybe a temporary solution. 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. Thanks, Bernd