mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Imran Khan <imran.f.khan@oracle.com>
To: tj@kernel.org, viro@zeniv.linux.org.uk
Cc: linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org
Subject: Re: [PATCH v7 0/8] kernfs: Introduce interface to access global kernfs_open_file_mutex.
Date: Wed, 9 Mar 2022 15:12:01 +1100	[thread overview]
Message-ID: <e77bab80-c2ca-3ba4-862f-9a29268f132e@oracle.com> (raw)
In-Reply-To: <20220225052116.1243150-1-imran.f.khan@oracle.com>

Hello Al and Hello Tejun,

On 25/2/22 4:21 pm, Imran Khan wrote:
> Reduce contention around global locks used in kernfs.
> 
> The current kernfs design makes use of 3 global locks to synchronize
> various operations. There are a few other global locks as well but
> they are used for specific cases and hence don't cause severe contention.
> 
> The above mentioned 3 main global locks used in kernfs are:
> 
> 1. A global mutex, kernfs_open_file_mutex, to protect the list of
> kernfs_open_file instances correspondng to a sysfs attribute.
> 
> 2. A global spinlock, kernfs_open_node_lock, to protect
> kernfs_node->attr.open which points to kernfs_open_node instance
> corresponding to a kernfs_node.
> 
> 3. A global per-fs rw semaphore, root->kernfs_rwsem, to synchronize most
> of the other operations like adding, removing, renaming etc. of a file
> or directory.
> 
[...]
> 
> ------------------------------------------------------------------

Could you please review v7 of this change set and let me know your feedback?

> Changes since v6:
>  - Addressed review comments from Tejun
> 	- Make locking helpers compact and remove unlock_parent from node.
>  
>  - Addressed review comments from Al Viro
> 	- Make multi node lock helpers non-inline
> 	- Account for change of parent while waiting on semaphores during
> 	  rename operation
> 	- Add a document to describe hashed locks introduced in this patch
> 	  and to provide proof of correctness 
>  
>  - Fix for some issues that I observed while preparing lock correctness
>    document
> 	- Lock both parent and target while looking for symlink
> 	- Introduce a per-fs mutex to synchronize lookup and removal of a node
> 	- Avoid locking parent in remove_self, because only the first instance
> 	  does actual removal so other invocations of remove_self don't need
> 	  to lock the parent
>  
>  - Remove refcounting from lock helpers
> 	- Refcounting was present in lock helpers for cases where an execution
> 	  path acquires node's rwsem and then deletes the node. For such cases
> 	  release helpers should not try to acquire semaphore for this already
> 	  freed node. Refcounting was ensuring that release helpers could get
> 	  an still existing node.
> 	  I have modified locking helpers such that helpers that acquire rwsem
> 	  returns its address which can later be used by release helpers.
> 
[...]
> Imran Khan (8):
>   kernfs: Introduce interface to access global kernfs_open_file_mutex.
>   kernfs: Replace global kernfs_open_file_mutex with hashed mutexes.
>   kernfs: Introduce interface to access kernfs_open_node_lock.
>   kernfs: Replace global kernfs_open_node_lock with hashed spinlocks.
>   kernfs: Use a per-fs rwsem to protect per-fs list of
>     kernfs_super_info.
>   kernfs: Introduce interface to access per-fs rwsem.
>   kernfs: Replace per-fs rwsem with hashed rwsems.
>   kernfs: Add a document to describe hashed locks used in kernfs.
> 
>  .../filesystems/kernfs-hashed-locks.rst       | 245 +++++++++++++++++
>  fs/kernfs/Makefile                            |   2 +-
>  fs/kernfs/dir.c                               | 212 +++++++++-----
>  fs/kernfs/file.c                              |  66 +++--
>  fs/kernfs/inode.c                             |  48 +++-
>  fs/kernfs/kernfs-internal.c                   | 259 ++++++++++++++++++
>  fs/kernfs/kernfs-internal.h                   | 159 +++++++++++
>  fs/kernfs/mount.c                             |  30 +-
>  fs/kernfs/symlink.c                           |  13 +-
>  include/linux/kernfs.h                        |  71 ++++-
>  10 files changed, 980 insertions(+), 125 deletions(-)
>  create mode 100644 Documentation/filesystems/kernfs-hashed-locks.rst
>  create mode 100644 fs/kernfs/kernfs-internal.c
> 
> 
> base-commit: 196d330d7fb1e7cc0d85641c89ce4602cb36f12e

Thanks,
-- Imran

      parent reply	other threads:[~2022-03-09  4:12 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-25  5:21 Imran Khan
2022-02-25  5:21 ` [PATCH v7 1/8] " Imran Khan
2022-02-25  5:21 ` [PATCH v7 2/8] kernfs: Replace global kernfs_open_file_mutex with hashed mutexes Imran Khan
2022-02-25  5:21 ` [PATCH v7 3/8] kernfs: Introduce interface to access kernfs_open_node_lock Imran Khan
2022-02-25  5:21 ` [PATCH v7 4/8] kernfs: Replace global kernfs_open_node_lock with hashed spinlocks Imran Khan
2022-02-25  5:21 ` [PATCH v7 5/8] kernfs: Use a per-fs rwsem to protect per-fs list of kernfs_super_info Imran Khan
2022-02-25  5:21 ` [PATCH v7 6/8] kernfs: Introduce interface to access per-fs rwsem Imran Khan
2022-02-25  5:21 ` [PATCH v7 7/8] kernfs: Replace per-fs rwsem with hashed rwsems Imran Khan
2022-02-25  5:21 ` [PATCH v7 8/8] kernfs: Add a document to describe hashed locks used in kernfs Imran Khan
2022-03-09  4:12 ` Imran Khan [this message]

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 \
    --in-reply-to=e77bab80-c2ca-3ba4-862f-9a29268f132e@oracle.com \
    --to=imran.f.khan@oracle.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tj@kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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

all inboxes | Powered by JetHome®