Re: [PATCH] staging: axis-fifo: minimize lock duration in write

From: Greg Kroah-Hartman

Date: Mon Mar 09 2026 - 12:57:18 EST


On Mon, Mar 09, 2026 at 04:11:25PM +0000, Josh Law wrote:
> 9 Mar 2026 16:07:50 Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>:
>
> > On Sun, Mar 01, 2026 at 12:58:36AM +0000, Josh Law wrote:
> >> Memory allocation and copy from user space with vmemdup_user() is relatively slow and can sleep. Move it outside the lock to minimize the time the mutex is held, reducing contention for concurrent accesses.
> >
> > Something happened with your line wrapping :(
> >
> > And are you sure that your change works?  What is wrong with grabbing
> > the lock this way?
> >
> > thanks,
> >
> > greg k-h
>
> The issue with grabbing the lock before vmemdup_user() is that the allocation and user-space copy can take a significant amount of time and can sleep.

But what is wrong with that?

> Also, it's just to be more efficient haha, and yes I'm sure this change works, I own the hardware, and it operates better...

Great, please put the performance numbers in the patch, that will show
the need for this change.

thanks,

greg k-h