Re: [PATCH 1/2] kernfs: replace the mutex in kernfs_iop_permission with a rwlock

2020-12-02 Thread Fox Chen
Hi, Thanks for your comments. > On Wed, Dec 02, 2020 at 10:58:36PM +0800, Fox Chen wrote: > > @@ -121,7 +121,7 @@ int kernfs_iop_setattr(struct dentry *dentry, struct > > iattr *iattr) > > if (!kn) > > return -EINVAL; > > > > - mutex_lock(&kernfs_mutex); > > + write_l

Re: [PATCH 1/2] kernfs: replace the mutex in kernfs_iop_permission with a rwlock

2020-12-02 Thread Tejun Heo
On Wed, Dec 02, 2020 at 10:58:36PM +0800, Fox Chen wrote: > diff --git a/include/linux/kernfs.h b/include/linux/kernfs.h > index 89f6a4214a70..545cdb39b34b 100644 > --- a/include/linux/kernfs.h > +++ b/include/linux/kernfs.h > @@ -156,6 +156,7 @@ struct kernfs_node { > unsigned short

Re: [PATCH 1/2] kernfs: replace the mutex in kernfs_iop_permission with a rwlock

2020-12-02 Thread Tejun Heo
Hello, On Wed, Dec 02, 2020 at 10:58:36PM +0800, Fox Chen wrote: > @@ -121,7 +121,7 @@ int kernfs_iop_setattr(struct dentry *dentry, struct > iattr *iattr) > if (!kn) > return -EINVAL; > > - mutex_lock(&kernfs_mutex); > + write_lock(&kn->iattr_rwlock); > error

Re: [PATCH 1/2] kernfs: replace the mutex in kernfs_iop_permission with a rwlock

2020-12-02 Thread Greg KH
On Wed, Dec 02, 2020 at 10:58:36PM +0800, Fox Chen wrote: > A big global mutex in kernfs_iop_permission will significanly drag > system performance when processes concurrently open files > on kernfs in Big machines(with >= 16 cpu cores). > > This patch replace the big mutex with a rwlock specifica