[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <cda8be83538b9cac786b12ea8324248e88f62be1.camel@kernel.org>
Date: Fri, 02 Oct 2020 10:03:14 -0700
From: Saeed Mahameed <saeed@...nel.org>
To: Jakub Kicinski <kuba@...nel.org>
Cc: "David S. Miller" <davem@...emloft.net>, netdev@...r.kernel.org,
Eran Ben Elisha <eranbe@...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, 2020-10-01 at 16:23 -0700, Jakub Kicinski wrote:
> 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()?
cpu_relax() should also work fine, it is just that we have 100%
certainty that the allocation will success real soon.
Powered by blists - more mailing lists