[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b73a2b50ca75de97bd4f1693969b485498b506f6.camel@redhat.com>
Date: Fri, 26 Jan 2024 10:53:35 +0100
From: Paolo Abeni <pabeni@...hat.com>
To: Hangbin Liu <liuhangbin@...il.com>, Przemek Kitszel
<przemyslaw.kitszel@...el.com>
Cc: netdev@...r.kernel.org, Jay Vosburgh <j.vosburgh@...il.com>, "David S .
Miller" <davem@...emloft.net>, Jakub Kicinski <kuba@...nel.org>, Eric
Dumazet <edumazet@...gle.com>, Liang Li <liali@...hat.com>
Subject: Re: [PATCH net-next 1/4] selftests/net/forwarding: add slowwait
functions
On Fri, 2024-01-26 at 17:22 +0800, Hangbin Liu wrote:
> On Wed, Jan 24, 2024 at 02:25:57PM +0100, Przemek Kitszel wrote:
> >
> > > + echo -n "$out"
> > > + return 0
> > > + fi
> > > +
> > > + local current_time="$(date -u +%s)"
> > > + if ((current_time - start_time > timeout)); then
> > > + echo -n "$out"
> > > + return 1
> > > + fi
> > > +
> > > + sleep 1
> >
> > I see that `sleep 1` is simplest correct impl, but it's tempting to
> > suggest exponential back-off, perhaps with saturation at 15
> >
> > (but then you will have to cap last sleep to don't exceed timeout by
> > more than 1).
>
> Do you mean sleep longer when cmd exec failed? I'm not sure if it's a good
> idea as the caller still wants to return ASAP when cmd exec succeeds.
I think exponential backoff is not needed here: we don't care about
minimizing the CPU usage overhead, and there should not be 'collision'
issues.
Instead I *think* you could use a smaller sleep, e.g.
sleep 0.1
and hopefully reduce the latency even further.
Cheers,
Paolo
Powered by blists - more mailing lists