[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <a9d10969-0b74-4fa1-8f3d-6fc2c7a475a7@intel.com>
Date: Mon, 4 Nov 2024 08:18:23 -0700
From: Dave Jiang <dave.jiang@...el.com>
To: Christophe JAILLET <christophe.jaillet@...adoo.fr>,
Fenghua Yu <fenghua.yu@...el.com>, Vinod Koul <vkoul@...nel.org>
Cc: linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org,
dmaengine@...r.kernel.org
Subject: Re: [PATCH] dmaengine: idxd: Remove a useless mutex
On 11/2/24 4:46 AM, Christophe JAILLET wrote:
> ida_alloc()/ida_free() don't need any mutex, so remove this one.
>
> It was introduced by commit e6fd6d7e5f0f ("dmaengine: idxd: add a device to
> represent the file opened").
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>
Reviewed-by: Dave Jiang <dave.jiang@...el.com>
> ---
> See:
> https://elixir.bootlin.com/linux/v6.11.2/source/lib/idr.c#L375
> https://elixir.bootlin.com/linux/v6.11.2/source/lib/idr.c#L484
> ---
> drivers/dma/idxd/cdev.c | 5 -----
> 1 file changed, 5 deletions(-)
>
> diff --git a/drivers/dma/idxd/cdev.c b/drivers/dma/idxd/cdev.c
> index 57f1bf2ab20b..ff94ee892339 100644
> --- a/drivers/dma/idxd/cdev.c
> +++ b/drivers/dma/idxd/cdev.c
> @@ -28,7 +28,6 @@ struct idxd_cdev_context {
> * global to avoid conflict file names.
> */
> static DEFINE_IDA(file_ida);
> -static DEFINE_MUTEX(ida_lock);
>
> /*
> * ictx is an array based off of accelerator types. enum idxd_type
> @@ -123,9 +122,7 @@ static void idxd_file_dev_release(struct device *dev)
> struct idxd_device *idxd = wq->idxd;
> int rc;
>
> - mutex_lock(&ida_lock);
> ida_free(&file_ida, ctx->id);
> - mutex_unlock(&ida_lock);
>
> /* Wait for in-flight operations to complete. */
> if (wq_shared(wq)) {
> @@ -284,9 +281,7 @@ static int idxd_cdev_open(struct inode *inode, struct file *filp)
> }
>
> idxd_cdev = wq->idxd_cdev;
> - mutex_lock(&ida_lock);
> ctx->id = ida_alloc(&file_ida, GFP_KERNEL);
> - mutex_unlock(&ida_lock);
> if (ctx->id < 0) {
> dev_warn(dev, "ida alloc failure\n");
> goto failed_ida;
Powered by blists - more mailing lists