public inbox for [email protected]
 help / color / mirror / Atom feed
From: Qu Wenruo <[email protected]>
To: Ammar Faizi <[email protected]>
Cc: Chris Mason <[email protected]>, Josef Bacik <[email protected]>,
	David Sterba <[email protected]>, Tejun Heo <[email protected]>,
	Lai Jiangshan <[email protected]>,
	Filipe Manana <[email protected]>,
	Linux Btrfs Mailing List <[email protected]>,
	Linux Kernel Mailing List <[email protected]>,
	Linux Fsdevel Mailing List <[email protected]>,
	GNU/Weeb Mailing List <[email protected]>
Subject: Re: [RFC PATCH v1 0/6] Introducing `wq_cpu_set` mount option for btrfs
Date: Tue, 28 Feb 2023 07:49:53 +0800	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <Y/[email protected]>



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

  reply	other threads:[~2023-02-27 23:50 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-26 16:02 [RFC PATCH v1 0/6] Introducing `wq_cpu_set` mount option for btrfs Ammar Faizi
2023-02-26 16:02 ` [RFC PATCH v1 1/6] workqueue: Add set_workqueue_cpumask() helper function Ammar Faizi
2023-02-26 16:02 ` [RFC PATCH v1 2/6] btrfs: Change `mount_opt` type in `struct btrfs_fs_info` to `u64` Ammar Faizi
2023-02-26 16:02 ` [RFC PATCH v1 3/6] btrfs: Create btrfs CPU set struct and helpers Ammar Faizi
2023-02-26 16:02 ` [RFC PATCH v1 4/6] btrfs: Add wq_cpu_set=%s mount option Ammar Faizi
2023-02-26 16:02 ` [RFC PATCH v1 5/6] btrfs: Adjust the default thread pool size when `wq_cpu_set` option is used Ammar Faizi
2023-02-26 16:02 ` [RFC PATCH v1 6/6] btrfs: Add `BTRFS_DEFAULT_MAX_THREAD_POOL_SIZE` macro Ammar Faizi
2023-02-26 17:01 ` [RFC PATCH v1 0/6] Introducing `wq_cpu_set` mount option for btrfs Tejun Heo
2023-02-26 18:26   ` Ammar Faizi
2023-02-26 18:29     ` Ammar Faizi
2023-02-27 10:18 ` Qu Wenruo
2023-02-27 13:42   ` Ammar Faizi
2023-02-27 23:49     ` Qu Wenruo [this message]
2023-02-27 11:02 ` Filipe Manana
     [not found]   ` <[email protected]>
2023-02-27 13:45     ` Ammar Faizi
2023-02-27 16:24       ` Roman Mamedov
2023-02-27 22:17 ` Dave Chinner
2023-02-28  8:01   ` Ammar Faizi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox