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 7FB03C25B7E for ; Tue, 4 Jun 2024 12:24:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D2E5C6B00AD; Tue, 4 Jun 2024 08:24:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CDB326B00AE; Tue, 4 Jun 2024 08:24:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B7C0C6B00B4; Tue, 4 Jun 2024 08:24:15 -0400 (EDT) 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 978236B00AD for ; Tue, 4 Jun 2024 08:24:15 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 45EC716071E for ; Tue, 4 Jun 2024 12:24:15 +0000 (UTC) X-FDA: 82193123670.11.7880DFE Received: from out30-118.freemail.mail.aliyun.com (out30-118.freemail.mail.aliyun.com [115.124.30.118]) by imf08.hostedemail.com (Postfix) with ESMTP id A702916001B for ; Tue, 4 Jun 2024 12:24:11 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b="IUAkFt/b"; spf=pass (imf08.hostedemail.com: domain of jefflexu@linux.alibaba.com designates 115.124.30.118 as permitted sender) smtp.mailfrom=jefflexu@linux.alibaba.com; dmarc=pass (policy=none) header.from=linux.alibaba.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1717503853; 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=jPomrUN2mMhHCZSoHA6BXf+LpnTjctPJaYag2ZL8SMk=; b=FNXS8NuQbCH1BoOh2KZ1jH2VGvBfJvyAktBQX+uWNn4QdpXjR9CGv5kKQvKjJoNHyM/7zc +r4WhoWVrnb36nOUsQjbQJZ5JkHg+12+65SqL0LQ+7Q2NYDCXE/1ip+v/d5v0UhWWLZ9F9 CCwgZSVQMTpFGC7XsrY9rSyxnrOFt2k= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1717503853; a=rsa-sha256; cv=none; b=j052jZR0SEapE5inmkQW9i3S7MC09sH39OTTgm/gn5zwEouF9o4M7zsyvgIr78mPF9XSxt GUPEnrV/pmN/PoP/cVQ8CZ4LvKz1hZo+Z2ACNbGC0+waV/kl8eQOU6hNnyqKErxAP0SdSk t5wrRoeS9wfkhN/6NhcmWtAFff6NA6M= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b="IUAkFt/b"; spf=pass (imf08.hostedemail.com: domain of jefflexu@linux.alibaba.com designates 115.124.30.118 as permitted sender) smtp.mailfrom=jefflexu@linux.alibaba.com; dmarc=pass (policy=none) header.from=linux.alibaba.com DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1717503848; h=Message-ID:Date:MIME-Version:Subject:To:From:Content-Type; bh=jPomrUN2mMhHCZSoHA6BXf+LpnTjctPJaYag2ZL8SMk=; b=IUAkFt/bTF3gb3tAXx3JmuVtVDo3marrDBmm4vhLI/WLvR/nVXPjsDZupw1M2k3b5+jB61GNF1iJRTBcN9D542M5ILiHBKTZU2uVPpUhVLTEuy02bJCmLQ0BFlm+PkY0588+bv1ITtEZQ8DKKJAt4DHkyItISeE7zzW8kD+xKaU= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R211e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033068173054;MF=jefflexu@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0W7r4iPR_1717503847; Received: from 30.221.146.134(mailfrom:jefflexu@linux.alibaba.com fp:SMTPD_---0W7r4iPR_1717503847) by smtp.aliyun-inc.com; Tue, 04 Jun 2024 20:24:08 +0800 Message-ID: Date: Tue, 4 Jun 2024 20:24:06 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [HELP] FUSE writeback performance bottleneck To: Bernd Schubert , 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> <2f834b5c-d591-43c5-86ba-18509d77a865@fastmail.fm> Content-Language: en-US From: Jingbo Xu In-Reply-To: <2f834b5c-d591-43c5-86ba-18509d77a865@fastmail.fm> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: A702916001B X-Rspam-User: X-Stat-Signature: 3xiokzzo6m33caqugx5eyr564z773asq X-HE-Tag: 1717503851-881331 X-HE-Meta: U2FsdGVkX18YzgSlZS42rFFcpQ1kHQbmIok04MKuSt9Pfdcm4TflR0BhlS9gBVT3+yOxsVm+0ACyqBkTk9pYAU6HwiX+CXSPSI1/jb5E9uvGjkUxxt2uQ6FQH2Dak/fzrf37OcU7aoV1QSolBsPnSRSy3YviI5ectnhJqZN7fG+yO5adAUVDGR4vbSzyI9Qh0++T4itl1pQEWHlLNTXrRUYq6yoSxNchZGV6qBSzFtyxjYVb+/BpM6CSzjIbPep48N2cCypL6TGQ6lhqbBKQmQPv2iqbIrarbB2ouA9mvzR3rf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.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 5:32 PM, Bernd Schubert wrote: > > > 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. If we could break the limit that only one single (writeback) kworker for one bdi... Apparently it's much more complicated. Just a brainstorming idea... I agree it's a tough thing. -- Thanks, Jingbo