From: Paolo Abeni <pabeni@redhat.com>
To: Hangbin Liu <liuhangbin@gmail.com>,
Przemek Kitszel <przemyslaw.kitszel@intel.com>
Cc: netdev@vger.kernel.org, Jay Vosburgh <j.vosburgh@gmail.com>,
"David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Eric Dumazet <edumazet@google.com>, Liang Li <liali@redhat.com>
Subject: Re: [PATCH net-next 1/4] selftests/net/forwarding: add slowwait functions
Date: Fri, 26 Jan 2024 10:53:35 +0100 [thread overview]
Message-ID: <b73a2b50ca75de97bd4f1693969b485498b506f6.camel@redhat.com> (raw)
In-Reply-To: <ZbN5uAeqEKJth5Jv@Laptop-X1>
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
next prev parent reply other threads:[~2024-01-26 9:53 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-24 9:58 [PATCH net-next 0/4] selftests: bonding: use busy/slowwait when waiting Hangbin Liu
2024-01-24 9:58 ` [PATCH net-next 1/4] selftests/net/forwarding: add slowwait functions Hangbin Liu
2024-01-24 13:25 ` Przemek Kitszel
2024-01-26 9:22 ` Hangbin Liu
2024-01-26 9:53 ` Paolo Abeni [this message]
2024-01-24 9:58 ` [PATCH net-next 2/4] selftests: bonding: use tc filter to check if LACP was sent Hangbin Liu
2024-01-24 9:58 ` [PATCH net-next 3/4] selftests: bonding: reduce garp_test/arp_validate test time Hangbin Liu
2024-01-26 9:57 ` Paolo Abeni
2024-01-26 12:52 ` Hangbin Liu
2024-01-24 9:58 ` [PATCH net-next 4/4] selftests: bonding: use busy/slowwait instead of hard code sleep Hangbin Liu
2024-01-24 13:26 ` [PATCH net-next 0/4] selftests: bonding: use busy/slowwait when waiting Przemek Kitszel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b73a2b50ca75de97bd4f1693969b485498b506f6.camel@redhat.com \
--to=pabeni@redhat.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=j.vosburgh@gmail.com \
--cc=kuba@kernel.org \
--cc=liali@redhat.com \
--cc=liuhangbin@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=przemyslaw.kitszel@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).