Received: by 2002:a05:6500:1b41:b0:1fb:d597:ff75 with SMTP id cz1csp65475lqb; Tue, 4 Jun 2024 05:24:24 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVh5fMjOVGOyfkPScfol2uewl9a6iMGzYWleE9Ub1Zpmv5u9uAOj5WEeQG/quivdeDtkfZ+zSzLloz9U0cUAkbEWowWwPY/slYInkFLPw== X-Google-Smtp-Source: AGHT+IG1xdvVWtUMHlLAOD2xVz7irLiG/nddViir6sRWCgsWO9NpxbxgaKdKvxpnZeT31JlzmAWx X-Received: by 2002:a17:906:7fd1:b0:a68:e322:2996 with SMTP id a640c23a62f3a-a68e3222f02mr478359466b.36.1717503864474; Tue, 04 Jun 2024 05:24:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717503864; cv=pass; d=google.com; s=arc-20160816; b=PPXTyNXxQcueqqo/mpb4s4+dXH0vDDUKS/ZlaT/xDhe9NFyZUVT3q8tSi/z7Hdpd5Y bWGhXHYNLoOzd3IMfWzZNZTc1/0KAQiayJDlH4lja4Wza7hnGPPBVE4WZpV414hs4oMZ 8HSezLww89gDz/FduQ+UbdFGUp2UtuzyILo5DlzW+q0WI58y/cPpjNGMtYeqfpHQZtM3 rwWbZlJQJuU0Bqjq3mOhWJT4mPiS05seiDKqqqfu9sxn2UFRznwYk8+ZeUFP5zxgC/x0 rdyo0/FqrgrhRh4v6IM1o7Y2MwkQ3K/zp0T5Igeps6PBPDeVXLb4TWo+3ASBvj0Z7UAy 6Cbg== 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=jPomrUN2mMhHCZSoHA6BXf+LpnTjctPJaYag2ZL8SMk=; fh=Hqwl7eoowYH2ZxMrpHSonNQaJfCoFYxyuRk6+wc3eTI=; b=vfcBA1MgnlClE+wdMvcmAOgHKEo7M1NxWl/Zk0D3wfJ6dPLIKXkzPfzxVIWuxVw1Ry Gp4tuRJdiVQAI7msNj0DLOuN0gMA416IwO2gSLtPeSONZe+oCuoSqAXYhCqzehGa8N4e VTg5E7qKr2HO4fgWwYxFLYUwlrtEzD43FcOOP1CS8iCHmF9SDb0eefRU9/UiG69YF7gl F7JSL1H9uiUmaubhcTaU7krYgSkUNBObteBlNH8MOhvyas2VQdUKKqQsOJQ3leJhFJ7r j9Q8YvAU4r16P2jHJaYEV8VBuAN507lC8UVbC8CCvpH+qNQwOL8kTn10dH95IWdHEOi3 DDkQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.alibaba.com header.s=default header.b="IUAkFt/b"; 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-200581-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-200581-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. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a67e6f0264dsi507174866b.155.2024.06.04.05.24.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 05:24:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-200581-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=@linux.alibaba.com header.s=default header.b="IUAkFt/b"; 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-200581-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-200581-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 33F461F2122C for ; Tue, 4 Jun 2024 12:24:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E73A6146008; Tue, 4 Jun 2024 12:24:14 +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="IUAkFt/b" 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 4E614BE7F; Tue, 4 Jun 2024 12:24:10 +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=1717503854; cv=none; b=XsSnAr0Y+y2+8WYuGIgFaOGosPXX/WLanq17zO96whxtDg53kQv/VGBhO63WoEEFFyjKsxuq8z6mDfaPrhYkeDYNIqrk/I9digKbjxUrYV5RYfBSFHQPVYedqIMt+3LKHq2lf/3q0JmacXQdlW0Qh3t8aIwRIvwFg3DJqGXUykw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717503854; c=relaxed/simple; bh=ZwDWpEgrdrXqFWIrKyzELQzl+gwfit0FDORF0fNWeD8=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=KbkbeH1QhKOgAjOHH8IrJfsM2Ln766InrPxNYf9gHfetsxpGNsGR34WpE9qOreUyI5w/aizMNt+h9Sey9rK6A9LxIumIH323I9/g/um0fjUsjSz63HbChyo1uFhmIb1JRQHUc/f/s7Xj1IX6wjhrJIYOx84mpMuCmXxjnLRtoQU= 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=IUAkFt/b; 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=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 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: 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 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