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 38695C25B78 for ; Tue, 4 Jun 2024 10:02:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9038B6B0098; Tue, 4 Jun 2024 06:02:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8B3B66B00B5; Tue, 4 Jun 2024 06:02:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 77AED6B00B0; Tue, 4 Jun 2024 06:02:58 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 59AE86B00B5 for ; Tue, 4 Jun 2024 06:02:58 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id B1606C0E75 for ; Tue, 4 Jun 2024 10:02:57 +0000 (UTC) X-FDA: 82192767594.19.FA4231F Received: from mail-ej1-f47.google.com (mail-ej1-f47.google.com [209.85.218.47]) by imf20.hostedemail.com (Postfix) with ESMTP id 7A4591C0025 for ; Tue, 4 Jun 2024 10:02:55 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=szeredi.hu header.s=google header.b=WzLytMrM; dmarc=pass (policy=quarantine) header.from=szeredi.hu; spf=pass (imf20.hostedemail.com: domain of miklos@szeredi.hu designates 209.85.218.47 as permitted sender) smtp.mailfrom=miklos@szeredi.hu ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1717495376; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Le/ddYXHWhX53i9qIi9hulgRRWo7gp0FcrSDy4OJL6E=; b=rBuyuS5nMBBN3MUnW9becCbna61vcVqw8TvcgAS4FJv7QUQg0C0rXlbK3mYTlMBdkKvMGT J6iuh3toOFaWcdzLDMz9TvJ6ewWyHz3NL0/9e/aqxDu9K9pLTG4tCythKTeTXHz8UPenOU qyAr9Z5i80FVr9zBjsM390yrKMIg9pI= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=szeredi.hu header.s=google header.b=WzLytMrM; dmarc=pass (policy=quarantine) header.from=szeredi.hu; spf=pass (imf20.hostedemail.com: domain of miklos@szeredi.hu designates 209.85.218.47 as permitted sender) smtp.mailfrom=miklos@szeredi.hu ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1717495376; a=rsa-sha256; cv=none; b=KSrOL+kTekEzhcnf1U0FylKZYcJXgLFna08xQOosibPDAHJm55l0PatPf+tqVXOiHsSIoh ++PU4WykAyENlt+EMOqpJ0ujQl4cD13B8qBHSEUfTNe0Y8kK16ziRN/ccvwdYPHyUQ0nBH lxVcg4tQt7VlPgmYabvk4xCkBi+akoE= Received: by mail-ej1-f47.google.com with SMTP id a640c23a62f3a-a690161d3ccso205818566b.2 for ; Tue, 04 Jun 2024 03:02:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=szeredi.hu; s=google; t=1717495374; x=1718100174; darn=kvack.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=WzLytMrMuYoQFNrhf1I/D+ItH4xj5q9Fvw0poA62e1tHcHwCoVkhMpdKpzBNqPMrPy Y2QIhMoa9nyug1lUHuXyt0JdmqB4giqvo1jEJsRjDW2b9yBgEy/DZkGUm/0V1B7J+NQw EQuPBYnQegKB2ln4edY7LHs15/FJcWd+Wa22k= 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=YQRCrJ95PBq372jk95YQTPrsXWow/Cu8rv9W0d7Tny6Em5o4Z6u21dpxJU20wxO+L2 l7HqhymkLSm0RC8G0aSYA2TYDqvUTdhQTk11fiDRFAiOlWXnYMSP8+nEn7Ewm+4JDAK8 0sB58o/ECgWZ6E3JyZKSRULjvBc1Kx2phiHHy51QYnuCjok1arM4xI1OT9r5Y3QXU6+b OUUJlrP/CWbe/zCZMs6yih8HruWHlnci49YXfykLJvBuWUNp1WXbpXSe2wPxI7Udx/lQ TM9ug+wg2xko5j/NG0bCTadwXi37N9EwvZ97RwSTCk0S6JiPiKmCR6WCAs/PhJhAtK3b bD9A== X-Forwarded-Encrypted: i=1; AJvYcCW/SpiUprZYd/qDZQiyfaZ3H2cTwun68oD/oHbdaC3wYTMqqnUXzCbaCcLJ3ktLPFaIdjMrdMnWsR3E/sxprSuKHDg= X-Gm-Message-State: AOJu0YwdH3QgAenB9tNPQc3ZtI+2fw7SEEUN5sqUAjQTLj5T1mqLdMr+ wWzLKmSyWdjrba0pAAGAK8LRXFylcCRdyx9KtSDvVz28jTq/9JvPCpbQBb2o0qq7kyfP9CXByot g0zGZmLuS7kRdHAmR7PBaaubUdVcN8/tU0nUa4g== X-Google-Smtp-Source: AGHT+IEydtpbcQ3+TaA0iWlzJhJL0iIGS1Jc2F5dm0s3zwbofudHPfZLYiJf5Va09F6m9a/kI80mbXTFZt5MKzATyJM= 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) 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" X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 7A4591C0025 X-Stat-Signature: 1ni3fsbk4p3gtb8996mwtcei4forr41e X-HE-Tag: 1717495375-730431 X-HE-Meta: U2FsdGVkX1+vxW/2LWwz5a9HAU75pSnbz4FCLJHkpqk4/w1LdZUZIU66EncG6BTWLsmG47aPyKFzRESq3DZa/Pa3vnF4L3ExLGlC3s+H08P0PtddgRM3Ktt/NwH2rxh1/A6eDOvZeMRL4zp93jAoL03geDmZ1anYyrzg3+kXufSHAO38Bhyzcdz91saqBYhqUnWFWxAoHFxYGK82oIyieDBscMIoM3+NAS1jzZgJn08Neli3MH8EWsKNIz5ROAGrOeIZ4fkkiuqX96aTVnaz85rK7pMcdgjVEVSgCwq8WsDF7d7oKqK63CxBujsQECbGJc6XxBR6m4USiiKIzg1n/XtfdQAB/UYeCca5X0B2yufuWPPdHOOqoJwOhhUFwvTP2y8P/7ddWtFm7xmGY/FevRnqRChEK176lQ71VGQHxq4zT/tkfsrhC4to2CBl1KwqXqVnHTHSpCzs8w3KNvD211bE9U82xmOnrsmXBAT7RLQE+uwy3V3Fo22Vt41S/B3Me1apKtX90KjlAN+3VJ5R6CCmsqM8VK2ENIF86P2q6YSEWGIY0PetmHl1gnO3oG7052UY6uhVS4kLrRO9MSyW6dMJzUi437EhYqw7TPMhvd3VQwcGhxzrWe3IHyOh2+jEB+xDUv1QZZDeBUQEJ+iR82/5V596gUFL2jdUsnx1xYOVYKMFcYGNhR0IQf7oU3/GkTqOYV/9gYhsPJm3ZHKWtZ5LjrNyBmfHv4sexzt06ijsbF7YXXgHUboD+eWg9Ngo6gVEPZgoFZ2T/BLIHwC3glNJFyY5HeEa9uZBC/oc3tdIFX3H/nPBI0LW7A5YuOaJAJcB3RXpLSLIu9/GlLUrjqOBiUDfdxsvmr1WKNC5ubtLmPyFUFlGYrxqnTtC4SGDM4g/8u/d1Ot4qrD3GmnGguX/3uI/xIapV+StqiFKEKMoSBR0ufJhwdzBxversD0K4l+bzD0hhJs+Yd4vSxI zWUs7tvt PmStKkC1Yvm1NOT2nGTRMvbsEm9hq6Trnzb9xbpUSaQoYmerWujSUNDgibi52IW5/Zf6eyjH+bl12d1ku5mZ46TFuEp7lcJQ35X8j3LP4uGiQC3ZFByghUyG6ZzrQ+hSC5gMoMd1p9mb54RyRspoQ0IQh/cdIgqCG151dX7lGI0/yFauxtoFIcviJ/hTxF2sGtFktO80SJrRBI2v02zi0Z0gQDaYwan+QX/qrir3hxLuhEpjCvNrZkzv9oEwSoFQCvl/kZ8z1M3/o/P4= X-Bogosity: Ham, tests=bogofilter, spamicity=0.006633, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 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