erofs: lazily initialize per-CPU workers and CPU hotplug hooks
authorSandeep Dhavale <dhavale@google.com>
Tue, 6 May 2025 22:57:41 +0000 (15:57 -0700)
committerGao Xiang <hsiangkao@linux.alibaba.com>
Thu, 15 May 2025 22:11:22 +0000 (06:11 +0800)
commit12bf25d1659b1ec55e44fad2485155707062df79
tree08df7a68db711931f243b518295b134443a9ec2c
parent4eb56b0761e75034dd35067a81da4c280c178262
erofs: lazily initialize per-CPU workers and CPU hotplug hooks

Currently, when EROFS is built with per-CPU workers, the workers are
started and CPU hotplug hooks are registered during module initialization.
This leads to unnecessary worker start/stop cycles during CPU hotplug
events, particularly on Android devices that frequently suspend and resume.

This change defers the initialization of per-CPU workers and the
registration of CPU hotplug hooks until the first EROFS mount. This
ensures that these resources are only allocated and managed when EROFS is
actually in use.

The tear down of per-CPU workers and unregistration of CPU hotplug hooks
still occurs during z_erofs_exit_subsystem(), but only if they were
initialized.

Signed-off-by: Sandeep Dhavale <dhavale@google.com>
Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Link: https://lore.kernel.org/r/20250506225743.308517-1-dhavale@google.com
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
fs/erofs/zdata.c