Re: ipc/mqueue: release spinlock before freeing node_cache in mqueue_evict_inode()

From: ritu pal
Date: Thu Jul 03 2025 - 04:05:07 EST


> That spinlock is inside the inode in question; what exactly is going to be
> on the other side of contention? Note that none of the file methods
> are going to run concurrent with that...

Another thread that's waiting to acquire the spinlock to process the
next item in the mqueue.
This change reduces the hold time of "info->lock", since the kfree()
of the node_cache does not require a spinlock to be held.

On Fri, Jun 27, 2025 at 10:08 PM Al Viro <viro@xxxxxxxxxxxxxxxxxx> wrote:
>
> On Fri, Jun 27, 2025 at 06:11:14PM +0530, ritu pal wrote:
> > Hi,
> >
> > Currently, mqueue_evict_inode() holds info->lock while freeing
> > info->node_cache
> > with kfree(). Although kfree() does not sleep, it may take a non-trivial
> > amount
> > of time, increasing the duration the spinlock is held and potentially
> > impacting
> > concurrency.
>
> That spinlock is inside the inode in question; what exactly is going to be
> on the other side of contention? Note that none of the file methods
> are going to run concurrent with that...