From: David Miller <davem@davemloft.net>
To: ronen.arad@intel.com
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH net-next v2] netlink: Trim skb to alloc size to avoid MSG_TRUNC
Date: Sun, 18 Oct 2015 19:33:56 -0700 (PDT) [thread overview]
Message-ID: <20151018.193356.1252632768047689966.davem@davemloft.net> (raw)
In-Reply-To: <1444899317-3345-1-git-send-email-ronen.arad@intel.com>
From: Ronen Arad <ronen.arad@intel.com>
Date: Thu, 15 Oct 2015 01:55:17 -0700
> netlink_dump() allocates skb based on the calculated min_dump_alloc or
> a per socket max_recvmsg_len.
> min_alloc_size is maximum space required for any single netdev
> attributes as calculated by rtnl_calcit().
> max_recvmsg_len tracks the user provided buffer to netlink_recvmsg.
> It is capped at 16KiB.
> The intention is to avoid small allocations and to minimize the number
> of calls required to obtain dump information for all net devices.
>
> netlink_dump packs as many small messages as could fit within an skb
> that was sized for the largest single netdev information. The actual
> space available within an skb is larger than what is requested. It could
> be much larger and up to near 2x with align to next power of 2 approach.
>
> Allowing netlink_dump to use all the space available within the
> allocated skb increases the buffer size a user has to provide to avoid
> truncaion (i.e. MSG_TRUNG flag set).
>
> It was observed that with many VLANs configured on at least one netdev,
> a larger buffer of near 64KiB was necessary to avoid "Message truncated"
> error in "ip link" or "bridge [-c[ompressvlans]] vlan show" when
> min_alloc_size was only little over 32KiB.
>
> This patch trims skb to allocated size in order to allow the user to
> avoid truncation with more reasonable buffer size.
>
> Signed-off-by: Ronen Arad <ronen.arad@intel.com>
Getting spurious MSG_TRUNC is surely a bug, so I am going to apply
this to 'net' as it is a genuine bug fix.
Thanks.
prev parent reply other threads:[~2015-10-19 2:17 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-13 1:15 [PATCH] netlink: trim skb to exact size to avoid MSG_TRUNC Ronen Arad
2015-10-13 8:56 ` Thomas Graf
2015-10-13 17:52 ` Arad, Ronen
2015-10-14 7:44 ` Thomas Graf
2015-10-15 6:41 ` Arad, Ronen
2015-10-15 8:55 ` [PATCH net-next v2] netlink: Trim skb to alloc " Ronen Arad
2015-10-19 2:33 ` David Miller [this message]
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=20151018.193356.1252632768047689966.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=ronen.arad@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