Re: [RFC PATCH v2 1/2] kernfs: use kernfs_node specific mutex and spinlock.

From: Greg KH
Date: Mon Jan 03 2022 - 04:55:28 EST


On Mon, Jan 03, 2022 at 07:45:43PM +1100, Imran Khan wrote:
> diff --git a/include/linux/kernfs.h b/include/linux/kernfs.h
> index 861c4f0f8a29..5ed4c9ed39af 100644
> --- a/include/linux/kernfs.h
> +++ b/include/linux/kernfs.h
> @@ -164,6 +164,8 @@ struct kernfs_node {
> unsigned short flags;
> umode_t mode;
> struct kernfs_iattrs *iattr;
> + spinlock_t kernfs_open_node_lock;
> + struct mutex kernfs_open_file_mutex;

Did you just blow up the memory requirements of a system with lots of
kobjects created?

We used to be able to support tens of thousands of scsi devices in a
32bit kernel, with this change, what is the memory difference that just
happened?

There is a tradeoff of memory usage and runtime contention that has to
be made here, and this might be pushing it in the wrong direction for
a lot of systems.

thanks,

greg k-h