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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3993AC7EE30 for ; Mon, 27 Feb 2023 23:50:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229964AbjB0XuU (ORCPT ); Mon, 27 Feb 2023 18:50:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229451AbjB0XuS (ORCPT ); Mon, 27 Feb 2023 18:50:18 -0500 Received: from mout.gmx.net (mout.gmx.net [212.227.17.21]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD50E1CF78; Mon, 27 Feb 2023 15:50:16 -0800 (PST) Received: from [0.0.0.0] ([149.28.201.231]) by mail.gmx.net (mrgmx104 [212.227.17.174]) with ESMTPSA (Nemesis) id 1MzhnN-1obPHS29iL-00vhw5; Tue, 28 Feb 2023 00:50:00 +0100 Message-ID: <3c843d9e-3813-dc02-160c-4a46ad47f941@gmx.com> Date: Tue, 28 Feb 2023 07:49:53 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.0 To: Ammar Faizi Cc: Chris Mason , Josef Bacik , David Sterba , Tejun Heo , Lai Jiangshan , Filipe Manana , Linux Btrfs Mailing List , Linux Kernel Mailing List , Linux Fsdevel Mailing List , GNU/Weeb Mailing List References: <20230226160259.18354-1-ammarfaizi2@gnuweeb.org> <19732428-010d-582c-0aed-9dd09b11d403@gmx.com> Content-Language: en-US From: Qu Wenruo Subject: Re: [RFC PATCH v1 0/6] Introducing `wq_cpu_set` mount option for btrfs In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K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e9aw3pwLTEEoaP3vsp3DAH tGyyoN65HvVKiHy+8pvhvUXK4G2wq/Fs9WaMSPmSjeM07qsAQiYraLCFCwzW4tMc6mBzpNL8l MYH+lxbgQV7+R2TbZmET0zc/y5AAbBci6DJUcHgrkTrAQIVYz/bbYpl3u3cp6s3/tnwxe7e2E xo/yR88EDbt0KcK1QiT7C8aunN0= Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2023/2/27 21:42, Ammar Faizi wrote: > On Mon, Feb 27, 2023 at 06:18:43PM +0800, Qu Wenruo wrote: >> I'm not sure if pinning the wq is really the best way to your problem. >> >> Yes, I understand you want to limit the CPU usage of btrfs workqueues, but >> have you tried "thread_pool=" mount option? >> >> That mount option should limit the max amount of in-flight work items, thus >> at least limit the CPU usage. > > I have tried to use the thread_poll=%u mount option previously. But I > didn't observe the effect intensively. I'll try to play with this option > more and see if it can yield the desired behavior. The thread_pool mount option is much harder to observe the behavior change. As wq pinned to one or two CPUs is easy to observe using htop, while the unbounded wq, even with thread_pool, is much harder to observe. Thus it needs more systematic testing to find the difference. > >> For the wq CPU pinning part, I'm not sure if it's really needed, although >> it's known CPU pinning can affect some performance characteristics. > > What I like about CPU pinning is that we can dedicate CPUs for specific > workloads so it won't cause scheduling noise to the app we've dedicated > other CPUs for. > I'm not 100% sure if we're really any better than the scheduler developers, as there are a lot of more things to consider. E.g. for recent Intel CPUs, they have BIG and little cores, and BIG cores even have SMT supports. For current kernels, scheduler would avoid putting workloads into the threads sharing the same physical cores. Thus it can result seemingly weird priority like BIG core thread1 > little core > BIG core thread2. But that results overall better performance. So overall, unless necessary I'd avoid manual CPU pinning. Thanks, Qu