]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
RDS: fix the sg allocation based on actual message size
authorWei Lin Guay <wei.lin.guay@oracle.com>
Fri, 20 Nov 2015 23:14:48 +0000 (15:14 -0800)
committerChuck Anderson <chuck.anderson@oracle.com>
Thu, 14 Apr 2016 00:57:30 +0000 (17:57 -0700)
Fix an issue where only PAGE_SIZE bytes are allocated per
scatter-gather entry (SGE) regardless of the actual message
size: Furthermore, use buddy memory allocation technique to
allocate/free memmory (if possible) to reduce SGE.

Orabug: 21894138
Signed-off-by: Wei Lin Guay <wei.lin.guay@oracle.com>
Signed-off-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
net/rds/message.c
net/rds/page.c

index ab535e2cb184303e9c2f8d5f75b0428cfb843576..f0e540094ed36ad191a7baeefc75db90958757ce 100644 (file)
@@ -63,7 +63,10 @@ static void rds_message_purge(struct rds_message *rm)
        for (i = 0; i < rm->data.op_nents; i++) {
                rdsdebug("putting data page %p\n", (void *)sg_page(&rm->data.op_sg[i]));
                /* XXX will have to put_page for page refs */
-               __free_page(sg_page(&rm->data.op_sg[i]));
+               (rm->data.op_sg[i].length <= PAGE_SIZE) ?
+                       __free_page(sg_page(&rm->data.op_sg[i])) :
+                       __free_pages(sg_page(&rm->data.op_sg[i]),
+                                    get_order(rm->data.op_sg[i].length));
        }
        rm->data.op_nents = 0;
 
index e35a92fde68f44a5b2f66a679b1982b65c540de9..c09f29655dfd3e46fbb600cb8cd8898998dc94e4 100644 (file)
@@ -127,11 +127,11 @@ int rds_page_remainder_alloc(struct scatterlist *scat, unsigned long bytes,
 
        /* jump straight to allocation if we're trying for a huge page */
        if (bytes >= PAGE_SIZE) {
-               page = alloc_page(gfp);
+               page = alloc_pages(gfp, get_order(bytes));
                if (!page) {
                        ret = -ENOMEM;
                } else {
-                       sg_set_page(scat, page, PAGE_SIZE, 0);
+                       sg_set_page(scat, page, bytes, 0);
                        ret = 0;
                }
                goto out;