]> git.hungrycats.org Git - linux/commitdiff
[SCTP] Use __get_free_pages() to allocate ssnmap.
authorSridhar Samudrala <sri@us.ibm.com>
Thu, 12 Feb 2004 08:59:24 +0000 (00:59 -0800)
committerSridhar Samudrala <sri@us.ibm.com>
Thu, 12 Feb 2004 08:59:24 +0000 (00:59 -0800)
This is needed to avoid kmalloc()'s 128K limit when an association is
initialized with a large no. of streams(more than 65000 inbound +
outbound streams).

net/sctp/ssnmap.c

index 345ab7120e8dcc278f7bcb72a8b3234d6a8f9c99..f907f9a8c31a285af969957270dcc51bffd0552b 100644 (file)
@@ -56,8 +56,10 @@ static inline size_t sctp_ssnmap_size(__u16 in, __u16 out)
 struct sctp_ssnmap *sctp_ssnmap_new(__u16 in, __u16 out, int gfp)
 {
        struct sctp_ssnmap *retval;
+       int order;
 
-       retval = kmalloc(sctp_ssnmap_size(in, out), gfp);
+       order = get_order(sctp_ssnmap_size(in,out));
+       retval = (struct sctp_ssnmap *)__get_free_pages(gfp, order);
 
        if (!retval)
                goto fail;
@@ -71,7 +73,7 @@ struct sctp_ssnmap *sctp_ssnmap_new(__u16 in, __u16 out, int gfp)
        return retval;
 
 fail_map:
-       kfree(retval);
+       free_pages((unsigned long)retval, order);
 fail:
        return NULL;
 }
@@ -107,7 +109,9 @@ void sctp_ssnmap_clear(struct sctp_ssnmap *map)
 void sctp_ssnmap_free(struct sctp_ssnmap *map)
 {
        if (map && map->malloced) {
-               kfree(map);
+               free_pages((unsigned long)map,
+                          get_order(sctp_ssnmap_size(map->in.len,
+                                                     map->out.len)));
                SCTP_DBG_OBJCNT_DEC(ssnmap);
        }
 }