Re: [RFC PATCH v1 0/6] Introducing `wq_cpu_set` mount option for btrfs

From: Ammar Faizi
Date: Sun Feb 26 2023 - 13:26:29 EST


Hello,

On Sun, 26 Feb 2023 07:01:41 -1000, Tejun Heo wrote:
> Hmm... the allowed cpumasks for unbounded workqueues can already be set
> through /sys/devices/virtual/workqueue/cpumask and also each individual
> workqueue can be exposed in the matching subdirectory by setting WQ_SYSFS.
> Wouldn't the proposed btrfs option be a bit reduandant?

Thank you for the comment. I just realized the sysfs facility for this.
So I will take a look into it deeper. For now, I have several reasons to
use the `wq_cpu_set` option:

1. Currently, there are 15 btrfs workqueues. It would not be convenient
to let the user manage each of them via the sysfs. Using `wq_cpu_set`
option at mounting time allows the user to set all of them in one
shot.

(for btrfs maintainers):
I am also not sure if the number of btrfs workqueues is stable so
that the user can rely on the WQ_SYSFS facility.

2. I looked at /sys/devices/virtual/workqueue/ and saw its
subdirectories. The directory name is taken from the wq->name. But
how to distinguish multiple workqueues with the same name?

Each btrfs mount will at least do this:

alloc_workqueue("btrfs-compressed-write", flags, max_active);

When we do:

mount -t -o rw btrfs /dev/sda1 a;
mount -t -o rw btrfs /dev/sda2 b;
mount -t -o rw btrfs /dev/sda3 c;
mount -t -o rw btrfs /dev/sda4 d;

Is there a way to identify which sysfs devices correspond to a specific
mounted btrfs fs workqueues? Let's say I want each mount to have a
different CPU mask.

--
Ammar Faizi