From: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: David Ahern <dsahern@gmail.com>, Chris Mi <chrism@mellanox.com>,
netdev@vger.kernel.org, gerlitz.or@gmail.com
Subject: Re: [patch iproute2 v3 3/4] tc: Add -bs option to batch mode
Date: Wed, 27 Dec 2017 20:06:00 -0200 [thread overview]
Message-ID: <20171227220600.GC22042@localhost.localdomain> (raw)
In-Reply-To: <20171227134024.0706d33f@xeon-e3>
On Wed, Dec 27, 2017 at 01:40:24PM -0800, Stephen Hemminger wrote:
> On Wed, 27 Dec 2017 18:39:29 -0200
> Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> wrote:
>
> > > > + send = false;
> > > > + else
> > > > + send = true;
> > > > +
> > > > + ret = do_cmd(largc, largv, batch_size, msg_iov_index++, send);
> > >
> > > What happens if tc commands are interlaced in the file -- qdisc add,
> > > class add, filter add, then a delete, show, exec, etc.? Right now each
> > > command is handled one at a time so an add followed by a delete will
> > > work. Your proposed batching loop won't work for this case as some
> > > commands are executed when that line is reached and others are batched
> > > for later send. Not all of the tc commands need to be batched in a
> > > single message so perhaps those commands cause the queue to be flushed
> > > (ie, message sent), then that command is executed and you start the
> > > batching over.
> > >
> > > Further, I really think the batching can be done without the global
> > > variables and without the command handlers knowing it is batching or
> > > part of an iov. e.g., in the case of batching try having the commands
> > > malloc the request buffer and return the pointer back to this loop in
> > > which case this loop calls rtnl_talk_msg and frees the buffers.
> >
> > Sounds like the batching is being done at the wrong level. If it was
> > done by rtnl_talk(), it should be easier.
> > We can keep rtnl_talk() for previous users and make rtnl_talk_msg() do
> > the batching, mostly independent of which kind of msg it it.
> >
> > As you need to inform it that it was the last entry, that may be
> > detected with feof(stdin). Just add a 'bool flush' parameter to it.
> > rtnl_talk_msg(...., flush=feof(stdin));
> >
> > Next step then would be to add a memory manager layer to it, so
> > libnetlink wouldn't need to copy the messages but recycle pointers:
> > rtnl_get_msgbuf(): returns a buffer that one can use to fill in the
> > msg and use with rtnl_talk_msg()
> > and the free is done by libnetlink itself when the message is
> > finally sent, so no need to keep track of what one needs to free or
> > can reuse.
>
>
> What about using sendmmsg instead?
> That woudl allow sending multiple messages in one syscall.
Could be. Although the batching effect would be very different.
sendmmsg calls cond_resched() between messages, for instance.
next prev parent reply other threads:[~2017-12-27 22:06 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-25 8:46 [patch iproute2 v3 0/4] tc: Add -bs option to batch mode Chris Mi
2017-12-25 8:46 ` [patch iproute2 v3 1/4] lib/libnetlink: Add a function rtnl_talk_msg Chris Mi
2017-12-27 14:33 ` David Ahern
2018-01-02 13:59 ` Chris Mi
2017-12-25 8:46 ` [patch iproute2 v3 2/4] utils: Add a function setcmdlinetotal Chris Mi
2017-12-27 14:34 ` David Ahern
2018-01-02 14:03 ` Chris Mi
2017-12-25 8:46 ` [patch iproute2 v3 3/4] tc: Add -bs option to batch mode Chris Mi
2017-12-27 15:39 ` David Ahern
2017-12-27 20:39 ` Marcelo Ricardo Leitner
2017-12-27 21:40 ` Stephen Hemminger
2017-12-27 22:06 ` Marcelo Ricardo Leitner [this message]
2018-01-02 14:17 ` Chris Mi
2017-12-27 19:56 ` Marcelo Ricardo Leitner
2018-01-02 14:19 ` Chris Mi
2017-12-25 8:46 ` [patch iproute2 v3 4/4] man: Add -bs option to tc manpage Chris Mi
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=20171227220600.GC22042@localhost.localdomain \
--to=marcelo.leitner@gmail.com \
--cc=chrism@mellanox.com \
--cc=dsahern@gmail.com \
--cc=gerlitz.or@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=stephen@networkplumber.org \
/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).