Received: by 2002:a05:6a10:5594:0:0:0:0 with SMTP id ee20csp52789pxb; Mon, 25 Apr 2022 05:42:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzJfQk0RQCzovs2+PYMAhdCV1RSUcAget0aPLAuib+9wn0Zwc8pgfWzfuzlcbfB7DVQB4Q+ X-Received: by 2002:a05:6402:c9c:b0:425:d5e0:b69 with SMTP id cm28-20020a0564020c9c00b00425d5e00b69mr10240199edb.271.1650890523988; Mon, 25 Apr 2022 05:42:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650890523; cv=none; d=google.com; s=arc-20160816; b=pe87h2ILs+gN9FnqlbH6KqoPSidWiTsBAE4rP5v3xWeLN6cpGIE5FAPQTtkWQaMKTA HYvOqI46IHJaLhAikN5WAOr9KHq7WqYiH5fNaOs2Lx+tsDnPkPNGk102IdlY08DHszLT OVdRzS7octulP6egOQJ7eST8diphic4wl4qhdJCkGg70NXh5wuDYD8u6OeGm/RPZtwXU jkNVXNWsV0eq99KvAESo2OAijIoOW4SS2s2ZAmQSWr/d/XM86x59V+9fLKF9u7AQuLj+ +zg7mlkV+TdC0sMx88ItEO3tRss8IxgnWSh06JWs6qLlAF36lZr0YPsPZLolBIIO2KG4 FrDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=VYj7gb2p+tfnsZdvnMq4DRXvqIJLzOEZPdR6J7EgYds=; b=wEYifO5mj1v8lN7TwC6LcGBl1kQtEb1T9X8vu2/rQDa3o2Mlyok/FMBEzdcCDpv9FW jBxVkoWpCQoKJRtTc3nzjHIgLYn0SfxZ2yBq8Wn4kIZLGZad8U9oKqA15iy+Dy1pmoXo E/6qdrqvqvdTv5x7KgCfLmumfgGGtuxtJZ1aTjFShpAHeBerzqUX9cA7HMgDmdQ8igJC sLpOzpX/Ow+c2FilvsLLXTeO9L2SYNwPVxSECyHyJQyTI2CciY/B2Qsz3G/pn9gagCiu 5B7kqAlC47hePhPIR2O60u7FAPABGaZ8DS4F/x1+6txsJbCLeot8tIWtAhHppmq2lnlj B8YQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b=jykvH8iY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id eb6-20020a0564020d0600b0041f7893ca86si15907761edb.509.2022.04.25.05.41.36; Mon, 25 Apr 2022 05:42:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b=jykvH8iY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236181AbiDYIlW (ORCPT + 99 others); Mon, 25 Apr 2022 04:41:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231609AbiDYIlO (ORCPT ); Mon, 25 Apr 2022 04:41:14 -0400 Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A7D76C971 for ; Mon, 25 Apr 2022 01:38:11 -0700 (PDT) Received: by mail-ej1-x62f.google.com with SMTP id gh6so4117002ejb.0 for ; Mon, 25 Apr 2022 01:38:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=szeredi.hu; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=VYj7gb2p+tfnsZdvnMq4DRXvqIJLzOEZPdR6J7EgYds=; b=jykvH8iYFyvyl0kpb3iWILAI/i44LQ5Xzw/dWEOXZwrptNnmkltE0jH88XVk/5aRoC sGT0DDavqPJNeLrcqn0exgkkNM2SWlGCOwFeX1SjESUEbasnm2oEoeoXN7AKlj/I4BOf yBdCVUj5q/U3yNmNZagHaBC5HRWisFOW1kw0o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=VYj7gb2p+tfnsZdvnMq4DRXvqIJLzOEZPdR6J7EgYds=; b=2GeO9sSBJtUsXC5pxyBo6JzKpRQG+8FQ7fJudCqpoYWjSQSq7Nzdiht5Al16jxCnEh bqSAlX8H2+qiU7HVb1JwRRCUC9r1MLUQPdRAVrTrk9/t1ZRYYjPoDTrsCDNecS3oAI9W Xta62QsbYdWkvpFZH4zgQM7NYfT1Ir3a5Ky4yimuIWBN3tirXcBMa3c+N3sRi/2p1xlj w0Jn0/hO4nG85iC4f0L3VauKLTl1846qqeRSopJH8q5nY0zk744cZzhkbkXpAf+HVQ+a ip5Es1L63wq1GZ6aEb9jpiMrsxLbixqotSNmnJtuF0mbbrAAitD1OIqLL8LBU3ZiDba+ xOUA== X-Gm-Message-State: AOAM531RrfG20TEJc8aD1Cg0QoI/qrux8EJ+H36UuaFOpgGkHpFoRQwy ic+UD0LZ64ZCix63rGZy1a8aDcox2pfDNv6xPfsopQ== X-Received: by 2002:a17:907:1c11:b0:6f0:d63:69b3 with SMTP id nc17-20020a1709071c1100b006f00d6369b3mr15338656ejc.691.1650875889690; Mon, 25 Apr 2022 01:38:09 -0700 (PDT) MIME-Version: 1.0 References: <6ba14287-336d-cdcd-0d39-680f288ca776@ddn.com> In-Reply-To: From: Miklos Szeredi Date: Mon, 25 Apr 2022 10:37:58 +0200 Message-ID: Subject: Re: RFC fuse waitq latency To: Bernd Schubert Cc: Bernd Schubert , Linux-FSDevel , Linux Kernel , Dharmendra Singh Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 22 Apr 2022 at 17:46, Bernd Schubert wrote: > > [I removed the failing netapp/zufs CCs] > > On 4/22/22 14:25, Miklos Szeredi wrote: > > On Mon, 28 Mar 2022 at 15:21, Bernd Schubert wrote: > >> > >> I would like to discuss the user thread wake up latency in > >> fuse_dev_do_read(). Profiling fuse shows there is room for improvement > >> regarding memory copies and splice. The basic profiling with flame graphs > >> didn't reveal, though, why fuse is so much > >> slower (with an overlay file system) than just accessing the underlying > >> file system directly and also didn't reveal why a single threaded fuse > >> uses less than 100% cpu, with the application on top of use also using > >> less than 100% cpu (simple bonnie++ runs with 1B files). > >> So I started to suspect the wait queues and indeed, keeping the thread > >> that reads the fuse device for work running for some time gives quite > >> some improvements. > > > > Might be related: I experimented with wake_up_sync() that didn't meet > > my expectations. See this thread: > > > > https://lore.kernel.org/all/1638780405-38026-1-git-send-email-quic_pragalla@quicinc.com/#r > > > > Possibly fuse needs some wake up tweaks due to its special scheduling > > requirements. > > Thanks I will look at that as well. I have a patch with spinning and > avoid of thread wake that is almost complete and in my (still limited) > testing almost does not take more CPU and improves meta data / bonnie > performance in between factor ~1.9 and 3, depending on in which > performance mode the cpu is. > > https://github.com/aakefbs/linux/commits/v5.17-fuse-scheduling3 > > Missing is just another option for wake-queue-size trigger and handling > of signals. Should be ready once I'm done with my other work. Trying to understand what is being optimized here... does the following correctly describe your use case? - an I/O thread is submitting synchronous requests (direct I/O?) - the fuse thread always goes to sleep, because the request queue is empty (there's always a single request on the queue) - with this change the fuse thread spins for a jiffy before going to sleep, and by that time the I/O thread will submit a new sync request. - the I/O thread does not spin while the the fuse thread is processing the request, so it still goes to sleep. Thanks, Miklos