netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] NETLINK: Use SKB_MAXORDER to calculate NLMSG_GOODSIZE
@ 2005-01-28 23:03 Thomas Graf
  2005-01-28 23:22 ` Herbert Xu
                   ` (3 more replies)
  0 siblings, 4 replies; 16+ messages in thread
From: Thomas Graf @ 2005-01-28 23:03 UTC (permalink / raw)
  To: David S. Miller, Alexey Kuznetsov; +Cc: netdev

NLMSG_GOODSIZE specifies a good default size for the skb tailroom
used in netlink messages when the size is unknown at the time of
the allocation.

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.

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

Signed-off-by: Thomas Graf <tgraf@suug.ch>

--- linux-2.6.11-rc2-bk4.orig/include/linux/netlink.h	2005-01-26 18:19:27.000000000 +0100
+++ linux-2.6.11-rc2-bk4/include/linux/netlink.h	2005-01-28 23:06:02.000000000 +0100
@@ -133,10 +133,9 @@
 
 /*
  *	skb should fit one page. This choice is good for headerless malloc.
- *
- *      FIXME: What is the best size for SLAB???? --ANK
  */
-#define NLMSG_GOODSIZE (PAGE_SIZE - ((sizeof(struct sk_buff)+0xF)&~0xF))
+#define NLMSG_GOODORDER 0
+#define NLMSG_GOODSIZE (SKB_MAX_ORDER(0, NLMSG_GOODORDER))
 
 
 struct netlink_callback

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2005-02-09  4:54 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-28 23:03 [PATCH] NETLINK: Use SKB_MAXORDER to calculate NLMSG_GOODSIZE Thomas Graf
2005-01-28 23:22 ` Herbert Xu
2005-01-28 23:40   ` Thomas Graf
2005-02-07  6:27     ` David S. Miller
2005-01-28 23:48   ` Alexey Kuznetsov
2005-01-29  0:21     ` Thomas Graf
2005-01-29  0:27       ` Thomas Graf
2005-02-07  6:32         ` David S. Miller
2005-02-07 13:28           ` Thomas Graf
2005-02-07 14:27           ` [PATCH] NET: Fix calculation for collapsed skb size Thomas Graf
2005-02-09  4:54             ` David S. Miller
2005-01-29 18:40       ` [PATCH] NETLINK: Use SKB_MAXORDER to calculate NLMSG_GOODSIZE Alexey Kuznetsov
2005-01-29 12:47 ` Thomas Graf
2005-02-06 18:54 ` Thomas Graf
2005-02-06 21:08   ` David S. Miller
2005-02-07  6:25 ` David S. Miller

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).