[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201001162336.45f552b3@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
Date: Thu, 1 Oct 2020 16:23:36 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: saeed@...nel.org
Cc: "David S. Miller" <davem@...emloft.net>, netdev@...r.kernel.org,
Eran Ben Elisha <eranbe@...dia.com>,
Saeed Mahameed <saeedm@...dia.com>,
Moshe Shemesh <moshe@...dia.com>
Subject: Re: [net V2 05/15] net/mlx5: Add retry mechanism to the command
entry index allocation
On Thu, 1 Oct 2020 12:52:37 -0700 saeed@...nel.org wrote:
> +static int cmd_alloc_index_retry(struct mlx5_cmd *cmd)
> +{
> + unsigned long alloc_end = jiffies + msecs_to_jiffies(1000);
> + int idx;
> +
> +retry:
> + idx = cmd_alloc_index(cmd);
> + if (idx < 0 && time_before(jiffies, alloc_end)) {
> + /* Index allocation can fail on heavy load of commands. This is a temporary
> + * situation as the current command already holds the semaphore, meaning that
> + * another command completion is being handled and it is expected to release
> + * the entry index soon.
> + */
> + cond_resched();
> + goto retry;
> + }
> + return idx;
> +}
This looks excessive. At least add some cpu_relax(), or udelay()?
Powered by blists - more mailing lists