Hi,

Against latest net-2.6.14, but should apply to other versions as well. Please 
apply.

diff-tree b13ca94bb73c79cbc1b34c4261b02c3df934498a (from 
c097bee59e15d4703e53b8c21d9e9ce5da9365bc)
Author: Balazs Scheidler <[EMAIL PROTECTED]>
Date:   Sat Aug 13 16:24:25 2005 +0200

        As discussed [1] in a previous thread by DaveM and Harald the use of 
arrays
        in BSS should be avoided if possible.

        This simple patch converts the XFRM code to use __get_free_pages instead
        of statically allocated arrays (2048 * sizeof(list_head) == 16kB on 32
        bit platforms).

        [1] http://marc.theaimsgroup.com/?l=linux-netdev&m=112236788222811&w=2

        Signed-off-by: Balazs Scheidler <[EMAIL PROTECTED]>

diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -35,8 +35,8 @@ static DEFINE_SPINLOCK(xfrm_state_lock);
  * Main use is finding SA after policy selected tunnel or transport mode.
  * Also, it can be used by ah/esp icmp error handler to find offending SA.
  */
-static struct list_head xfrm_state_bydst[XFRM_DST_HSIZE];
-static struct list_head xfrm_state_byspi[XFRM_DST_HSIZE];
+static struct list_head *xfrm_state_bydst;
+static struct list_head *xfrm_state_byspi;

 DECLARE_WAIT_QUEUE_HEAD(km_waitq);
 EXPORT_SYMBOL(km_waitq);
@@ -1097,6 +1097,15 @@ void __init xfrm_state_init(void)
 {
        int i;

+       xfrm_state_bydst = (struct list_head *)
+               __get_free_pages(GFP_KERNEL,
+                                get_order(sizeof(struct list_head) *
+                                          XFRM_DST_HSIZE * 2));
+
+       if (!xfrm_state_bydst)
+               panic("Error allocating XFRM state tables\n");
+
+       xfrm_state_byspi = &xfrm_state_bydst[XFRM_DST_HSIZE];
        for (i=0; i<XFRM_DST_HSIZE; i++) {
                INIT_LIST_HEAD(&xfrm_state_bydst[i]);
                INIT_LIST_HEAD(&xfrm_state_byspi[i]);

-- 
Bazsi

-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to