Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp1425442lqj; Tue, 4 Jun 2024 00:36:35 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVsOkoBa3D7DQRarUG7r0alTkiwAzl0NLWYq+0Q/p3JO8oiIwHZ6sdbpGoyxzQJy5gKC8vJjT2icPDsZwiS0paw+R2SoiUTol9MblieSQ== X-Google-Smtp-Source: AGHT+IGK55cvgU8J3x/H7f8OSGYrbQe7x7bM1O8qPpsmwbJ0WzZcismsRPgPHCebCWjQlobmfDPg X-Received: by 2002:a50:bb48:0:b0:57a:228b:a03d with SMTP id 4fb4d7f45d1cf-57a36375149mr7639004a12.12.1717486595473; Tue, 04 Jun 2024 00:36:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717486595; cv=pass; d=google.com; s=arc-20160816; b=WPl2KMoqNyV8dHmNkE4MqfE+emuPEPf6yTEOd/34M1AK4za2UAz/7qoU/d3xynesfO DdO2HQ9AU98yH+n/I7nkK8qwWSaCAmr4yAPnfYh9EjEKfU7gQIckH86xdaKRvww85/QA WFwU9TqKa/E7Vf6tQBQ4x0y7pOVkYrcGMwh2QzJd8X+/ty0ytitJ44z9WMyFcHZsv/l2 iY6EoJ9lWlc+y9bDwdqE3kCVxJoerZNpix6aGmYsXz8gixBTQHHhSUSUcLt0q9QTjJRi 8rNuvs7F66JApJaMCX/HbGq2Vg3mPihSpxpFlu1HTEhPr9lMzdu34F9jljbaq5DTAiOm QZ/g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=ODwm6X80T2O9PNIpKJj73Wx7jHKcAvCfBJLjUeUP88g=; fh=s+4tv+zpo52giR09KnfNpfLt0vSKEEDO94pWCfi5Xl0=; b=E+DtHldXME7LK0n+WzHZjPaOUfqAF4jrRi9ojYY+xC8TCwFWSZMEw7qNSGqtlv8Eev zGDAxiwefbCLn9VlcNFc7NtksIojwwSvcL9W+nxkydg8awkKEA8ub3KBedF0Smlo6hxG W5ShGaCAn2UhzwQsqnX3vYruo2A0H4ySmfMlyWNfIa54RtLCdkYuHGLNxZigjQU6lKw0 3d5yH9s5uAyp0BsxRpOC/H35UWtJ75BKNjiN5fi2W+S2AmDv7yqdIVjunizChLt+JwmQ GFQWiW43oVwaUFsUwNxoEA/eAZXFfaEN3y7uXQUBPFLzvLk95R6QWVuSDmbLSjX8dg4C Fm6Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.alibaba.com header.s=default header.b=AJzjWWAF; arc=pass (i=1 spf=pass spfdomain=linux.alibaba.com dkim=pass dkdomain=linux.alibaba.com dmarc=pass fromdomain=linux.alibaba.com); spf=pass (google.com: domain of linux-kernel+bounces-200167-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-200167-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.alibaba.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57a5934c7ccsi2639457a12.117.2024.06.04.00.36.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 00:36:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-200167-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.alibaba.com header.s=default header.b=AJzjWWAF; arc=pass (i=1 spf=pass spfdomain=linux.alibaba.com dkim=pass dkdomain=linux.alibaba.com dmarc=pass fromdomain=linux.alibaba.com); spf=pass (google.com: domain of linux-kernel+bounces-200167-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-200167-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.alibaba.com 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 3559F1F221C3 for ; Tue, 4 Jun 2024 07:36:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 919571411C0; Tue, 4 Jun 2024 07:36:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="AJzjWWAF" Received: from out30-101.freemail.mail.aliyun.com (out30-101.freemail.mail.aliyun.com [115.124.30.101]) (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 D155313DDD3; Tue, 4 Jun 2024 07:36:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.101 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717486583; cv=none; b=dmxDr9HAPB75t59AF7Y6u+lDPq8GUND3DUb2+Y3O8rMC3hDQKQzB15/N9tCAgMAPm5eBvQPFf6CVT4u8et/+0hwSNTV2p+XJYPbbxU1IesNdkG9E77yxXJTfN//cl50E6lGZswZMzC2I01/FjRyR8CYDwqyM97A0mwF26vE9xDw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717486583; c=relaxed/simple; bh=Fw2dlhvUDvhaiIAs+Ca0alCjR7N9kP9wakSguQ5bY00=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=bNyOGaG77zu6b3pUaN2wZa5jGYkh+4eUL41Um3BMMLtuWiYwndkSee16PN+0ZAyq5e2E7/XDc2W6ufP/TPbigxekvmWCp1f77ZpLJG1fTS67nC+XsVfshfylvvhWtrGWzfmHq5yw2Snh1dUzEpZhhsiGWDskvcHARJHR6F9tTkA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=AJzjWWAF; arc=none smtp.client-ip=115.124.30.101 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1717486577; h=Message-ID:Date:MIME-Version:Subject:To:From:Content-Type; bh=ODwm6X80T2O9PNIpKJj73Wx7jHKcAvCfBJLjUeUP88g=; b=AJzjWWAFf4KwF6ByDbP9e9Uv+RuCU+0//hjRCA+Y2ocAJv3Kuj2VkBre0UuaDEBCBFA8kUjC1kbBD+nC1Po0BSIRvvLOoQV/LL48cBjqein9TrGCRVTXjaMQ3rICe+Ti0bqMrq6sGWCwwxp/lnViuNw1/4qjOQ3RNMM7Q8x9eqw= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R881e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033037067112;MF=jefflexu@linux.alibaba.com;NM=1;PH=DS;RN=5;SR=0;TI=SMTPD_---0W7q92aK_1717486576; Received: from 30.221.146.134(mailfrom:jefflexu@linux.alibaba.com fp:SMTPD_---0W7q92aK_1717486576) by smtp.aliyun-inc.com; Tue, 04 Jun 2024 15:36:17 +0800 Message-ID: Date: Tue, 4 Jun 2024 15:36:15 +0800 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: Miklos Szeredi Cc: Bernd Schubert , "linux-fsdevel@vger.kernel.org" , "linux-kernel@vger.kernel.org" , lege.wang@jaguarmicro.com References: <495d2400-1d96-4924-99d3-8b2952e05fc3@linux.alibaba.com> <67771830-977f-4fca-9d0b-0126abf120a5@fastmail.fm> Content-Language: en-US From: Jingbo Xu In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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. -- Thanks, Jingbo