From: Phil Sutter <phil@nwl.cc>
To: David Ahern <dsahern@gmail.com>
Cc: Stephen Hemminger <stephen@networkplumber.org>,
Hangbin Liu <liuhangbin@gmail.com>,
netdev@vger.kernel.org, Michal Kubecek <mkubecek@suse.cz>
Subject: Re: [PATCHv5 iproute2 net-next 2/2] lib/libnetlink: re malloc buff if size is not enough
Date: Thu, 26 Oct 2017 20:31:47 +0200 [thread overview]
Message-ID: <20171026183147.GY32305@orbyte.nwl.cc> (raw)
In-Reply-To: <4dd9b1a2-878d-dfe0-f9b7-f000fbde3c6c@gmail.com>
On Thu, Oct 26, 2017 at 09:42:46AM -0600, David Ahern wrote:
> On 10/26/17 9:33 AM, Phil Sutter wrote:
> > On Thu, Oct 26, 2017 at 09:28:00AM -0600, David Ahern wrote:
> >> On 10/26/17 4:24 AM, Stephen Hemminger wrote:
> >>>>
> >>>> The kernel needs a flag that says "give me the message of the buffer is
> >>>> large enough; if not just PEEK and tell me the length." That would avoid
> >>>> the double call in most cases.
> >>>
> >>> Actually this has little impact because old code was doing implicit zero
> >>> of whole buffer, new code does not.
> >>>
> >>
> >> The patch calls recvmsg twice; libnl does the same thing. It would be
> >> better performance wise to have a flag that allows retrieval of the
> >> message if the supplied buffer is large enough and PEEK semantics if
> >> not. It was really a comment on how we could do better with proper
> >> kernel support.
> >
> > Doesn't MSG_TRUNC without MSG_PEEK do just that?
>
> MSG_TRUNC returns the actual message length if it is greater than the
> buffer. The message was dequeued and what could be copied into the
> supplied buffer is copied, but that means the returned message is truncated.
Ah, so one would have to resend the request then. Stupid me. :)
Thanks, Phil
next prev parent reply other threads:[~2017-10-26 18:31 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-26 1:41 [PATCHv5 iproute2 net-next 0/2] libnetlink: malloc correct buff at run time Hangbin Liu
2017-10-26 1:41 ` [PATCHv5 iproute2 net-next 2/2] lib/libnetlink: re malloc buff if size is not enough Hangbin Liu
2017-10-26 2:59 ` David Ahern
2017-10-26 10:24 ` Stephen Hemminger
2017-10-26 15:28 ` David Ahern
2017-10-26 15:33 ` Phil Sutter
2017-10-26 15:42 ` David Ahern
2017-10-26 18:31 ` Phil Sutter [this message]
2019-02-12 23:32 ` Eric Dumazet
2019-02-12 23:43 ` Eric Dumazet
2017-10-26 1:41 ` [PATCHv5 iproute2 net-next 2/2] lib/libnetlink: update rtnl_talk to support malloc buff at run time Hangbin Liu
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=20171026183147.GY32305@orbyte.nwl.cc \
--to=phil@nwl.cc \
--cc=dsahern@gmail.com \
--cc=liuhangbin@gmail.com \
--cc=mkubecek@suse.cz \
--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).