netdev
[Top] [All Lists]

Re: [PATCH] NETLINK: Use SKB_MAXORDER to calculate NLMSG_GOODSIZE

To: tgraf@xxxxxxx (Thomas Graf)
Subject: Re: [PATCH] NETLINK: Use SKB_MAXORDER to calculate NLMSG_GOODSIZE
From: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Date: Sat, 29 Jan 2005 10:22:01 +1100
Cc: davem@xxxxxxxxxxxxx, kuznet@xxxxxxxxxxxxx, netdev@xxxxxxxxxxx
In-reply-to: <20050128230327.GV31837@postel.suug.ch>
Organization: Core
Sender: netdev-bounce@xxxxxxxxxxx
User-agent: tin/1.7.4-20040225 ("Benbecula") (UNIX) (Linux/2.4.27-hx-1-686-smp (i686))
Thomas Graf <tgraf@xxxxxxx> wrote:
> 
> The current value doesn't make much sense anymore because
> skb_shared_info isn't taken into account which means that
> depending on the architecture NLMSG_GOOSIZE can exceed PAGE_SIZE
> resulting in a waste of almost a complete page.

You're quite right.

> Using SKB_MAXORDER solves this potential leak at the cost of
> slightly smaller but safer sizes for some architectures.

At first glance it's not clear which of sk_buff or skb_shared_info
is bigger.  So it might even end up being bigger :)

> -#define NLMSG_GOODSIZE (PAGE_SIZE - ((sizeof(struct sk_buff)+0xF)&~0xF))
> +#define NLMSG_GOODORDER 0
> +#define NLMSG_GOODSIZE (SKB_MAX_ORDER(0, NLMSG_GOODORDER))

Are we ever going use NLMSG_GOODORDER for anything? If not why don't
we go straight to NLMSG_GOODSIZE?

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

<Prev in Thread] Current Thread [Next in Thread>