Received: by 2002:a89:d84:0:b0:1fb:9c95:a417 with SMTP id eb4csp657360lqb; Tue, 4 Jun 2024 03:03:23 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVByHH8wGcE3ALllaQgjF9LXo1BURfLf0j/i1WlWZoOUkA3np8X9D1bH96UnVxK2WeGQ+9QBlmReyOyF5ZIMOmuxXe7B7r3EEK0gJMCFw== X-Google-Smtp-Source: AGHT+IFcdD5JCEG1KMUGahZoZJTKXMCJo5f5ZuJCBOwiWzEleNA30x0/MxIZVoL+zbdjOVHJLwVH X-Received: by 2002:a05:620a:8101:b0:793:1c64:131e with SMTP id af79cd13be357-794f5ebe42emr1063138985a.50.1717495403402; Tue, 04 Jun 2024 03:03:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717495403; cv=pass; d=google.com; s=arc-20160816; b=K7Hdjfg+dN+DRFD/gNO7AVMQ6evVGEO5p5oy2SRu3xDVgvlJykmUWoYAj3LE4NgOEz 8bNqY2p7/sr/o72xuuTaBKUvxR9CfAVJaxuf7VgkOHixmcrA9UnZ+7pd5i9/4PBEPc65 0G04YTPILMMR3XzBlDNcdQjJsxJEFaIddcSu5reZaVrqQ3vV0KdUuq/5gDLtaemj6bji CpISeGq3EXipSMdZwz6dJ58GiE6eihnafLdYhC0CpoFaaaFSmrn57n8yKC+Lsaz/PZCj 2bpcE74IFUTHBTsQwklAMH/9494O99zTBynuKxGvPqBrYO5i9TtUeX8ywfzv96N7R5JG jwBg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=Le/ddYXHWhX53i9qIi9hulgRRWo7gp0FcrSDy4OJL6E=; fh=618Xr0pd2OacfRb1WNMFjbhPZbgvf1RXGpdoEBsWwkk=; b=0qL/TiLl3mydGfEUkhW3OdlHBufPP0SQjHRRz5x/I/ZzL6g/xRU9oam/vVRedVfel4 i2DLjXakH0mEuHIjo4cXER+ZFftFt77Z+AscsHSUkoAy6mOZu9NUg6UbArNxE9yuSKIO Pv6XMXj0bICHCxYA1Dgfid63Favepzu7m4Js1jI/1PuX+q/eaLMshJ+M7QOsdllHQ4PE 1C/WPRjL8D6pwWZmYAj3qvoZtaCigk9nec08wU2xYuKTxh2rjbHja4fAeecXQE3nTqiK J0N1yhJ2OkmrrAJdzqWb0OXwxrZW6XYzRcx3CeMrwHKWMHLBI12xm5POkoXgszZCq5Mg Nf2g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@szeredi.hu header.s=google header.b=S3w8LXbq; arc=pass (i=1 spf=pass spfdomain=szeredi.hu dkim=pass dkdomain=szeredi.hu dmarc=pass fromdomain=szeredi.hu); spf=pass (google.com: domain of linux-kernel+bounces-200396-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-200396-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=szeredi.hu Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id af79cd13be357-794f3062fc8si1192292185a.281.2024.06.04.03.03.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 03:03:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-200396-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@szeredi.hu header.s=google header.b=S3w8LXbq; arc=pass (i=1 spf=pass spfdomain=szeredi.hu dkim=pass dkdomain=szeredi.hu dmarc=pass fromdomain=szeredi.hu); spf=pass (google.com: domain of linux-kernel+bounces-200396-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-200396-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=szeredi.hu 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id E97CA1C2203B for ; Tue, 4 Jun 2024 10:03:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BA43C1448E2; Tue, 4 Jun 2024 10:02:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=szeredi.hu header.i=@szeredi.hu header.b="S3w8LXbq" Received: from mail-ej1-f52.google.com (mail-ej1-f52.google.com [209.85.218.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3FD9438B for ; Tue, 4 Jun 2024 10:02:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717495377; cv=none; b=FoH+X+xSJ4kMkcIWZXRAxplCgkB5Fd+cNSi49vYNbXm4TxHc2/BUW8cgldrrqY1lmy8+q+F+IQyBsvKi1I0DDbJL0iI6ciBpu04nNIGXZuT7fjuWHkftJTI9PyaZz2Qo2FHEicDJmqseoS9m3iy/kp4ReDB5tjsXlQFvLZcbyWo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717495377; c=relaxed/simple; bh=KmFXORb2yt5DuY/K2IoFpc+0VDLo4L9lk+l/JXxqBHg=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=VmFLvHqLvBNEz4t7+xigTc913yyvHnWqj4J0I27j7l+LmISCeguuhff8n4PWxX4W9p6pqMKGo8wLDLygyYwuuJzFZ4gnmxYYRgEvgfbjdS4qqCZux36DcT4lxz5JFVhT1Fyc2EM4uf4tDBkuzau8wmSRR/F6w8HDEWTwdBdDMao= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=szeredi.hu; spf=pass smtp.mailfrom=szeredi.hu; dkim=pass (1024-bit key) header.d=szeredi.hu header.i=@szeredi.hu header.b=S3w8LXbq; arc=none smtp.client-ip=209.85.218.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=szeredi.hu Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=szeredi.hu Received: by mail-ej1-f52.google.com with SMTP id a640c23a62f3a-a68e7538cfaso291823266b.0 for ; Tue, 04 Jun 2024 03:02:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=szeredi.hu; s=google; t=1717495374; x=1718100174; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Le/ddYXHWhX53i9qIi9hulgRRWo7gp0FcrSDy4OJL6E=; b=S3w8LXbqp2dOuWm8GSbzRrjE/aVeq1ouhnVW1IC/4BDXEoEud5SOZ5s9+8C2DHKRpy DZT0k947t7MB3trmXZZ1jksFr3m3CsboeJBuodxBevpdfoDMukGSxauFGVBdDMkBJini Y1njkUVOfH2qqOGPkNKy0Cfo+D5f/YbCxuwPg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717495374; x=1718100174; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Le/ddYXHWhX53i9qIi9hulgRRWo7gp0FcrSDy4OJL6E=; b=JTP2EnGvwv8Wm4b/79F88T09SPvsHwdSqmfo+zFy0Cy3Qc47JVVKzA9fvEf0WIWN5v lZ2cO3/xg97FDgqkBaqLjA7Hx4EsRHrKknc9vmsAcCwAEn4qYVcukfBjEJEaMBsd+BfM skvZna8qA6tVMKiYtmY4WksyuarqRpe40BpDwaiXH/hhJfaejg84qQtiikm+IfD5bilP nQx21+L5W07lyoMvGrhhsZfqGU+XdFppXyyipm4lNWQxMF8ecibzhTRi9pv9Tf9JIRnQ KpX3GoCPQbokKPW39EWWCBgd+Vz3UVMGKS8DiliXcMTpQ2c5mjqkhCBSrOgmi1MzzDK6 0yKg== X-Forwarded-Encrypted: i=1; AJvYcCU4yBeSQmCyvJbA9h1wMtD5KCS5mMbyk2KW8dmqTrfFkAUbcTqQZDLjGsvk18/CnBUU6/HqBgEyPQwqOYpqlB/N9qktdv9guHkb3jZz X-Gm-Message-State: AOJu0YxkFIaMoa77MbkzcIK9iixmKmy0EOJVyQ6MiIs8f6SeIoUw5U4+ G9dRBshRSDDP0xAYp0+H9y1YVMPToNFcQL0KE6VC4sIdStAJdgrwvXaHN6pYcjmh+dhwmGUj+p8 pL/XTQUTup0qcvcJhDSZtYn0ES5bxaD8r5o1gbQ== X-Received: by 2002:a17:906:b0c6:b0:a67:7d34:3205 with SMTP id a640c23a62f3a-a68208fe45emr768858166b.35.1717495373577; Tue, 04 Jun 2024 03:02:53 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <495d2400-1d96-4924-99d3-8b2952e05fc3@linux.alibaba.com> <67771830-977f-4fca-9d0b-0126abf120a5@fastmail.fm> <2f834b5c-d591-43c5-86ba-18509d77a865@fastmail.fm> In-Reply-To: <2f834b5c-d591-43c5-86ba-18509d77a865@fastmail.fm> From: Miklos Szeredi Date: Tue, 4 Jun 2024 12:02:42 +0200 Message-ID: Subject: Re: [HELP] FUSE writeback performance bottleneck To: Bernd Schubert Cc: Jingbo Xu , "linux-fsdevel@vger.kernel.org" , "linux-kernel@vger.kernel.org" , lege.wang@jaguarmicro.com, "Matthew Wilcox (Oracle)" , "linux-mm@kvack.org" Content-Type: text/plain; charset="UTF-8" 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. 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. Thanks, Miklos