Skip to content

Commit 23f90cc

Browse files
Wei Lin GuayLinuxMinion
authored andcommitted
RDS: fix the sg allocation based on actual message size
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 <[email protected]> Signed-off-by: Santosh Shilimkar <[email protected]>
1 parent ea6e04f commit 23f90cc

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

net/rds/message.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,10 @@ static void rds_message_purge(struct rds_message *rm)
6363
for (i = 0; i < rm->data.op_nents; i++) {
6464
rdsdebug("putting data page %p\n", (void *)sg_page(&rm->data.op_sg[i]));
6565
/* XXX will have to put_page for page refs */
66-
__free_page(sg_page(&rm->data.op_sg[i]));
66+
(rm->data.op_sg[i].length <= PAGE_SIZE) ?
67+
__free_page(sg_page(&rm->data.op_sg[i])) :
68+
__free_pages(sg_page(&rm->data.op_sg[i]),
69+
get_order(rm->data.op_sg[i].length));
6770
}
6871
rm->data.op_nents = 0;
6972

net/rds/page.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,11 @@ int rds_page_remainder_alloc(struct scatterlist *scat, unsigned long bytes,
127127

128128
/* jump straight to allocation if we're trying for a huge page */
129129
if (bytes >= PAGE_SIZE) {
130-
page = alloc_page(gfp);
130+
page = alloc_pages(gfp, get_order(bytes));
131131
if (!page) {
132132
ret = -ENOMEM;
133133
} else {
134-
sg_set_page(scat, page, PAGE_SIZE, 0);
134+
sg_set_page(scat, page, bytes, 0);
135135
ret = 0;
136136
}
137137
goto out;

0 commit comments

Comments
 (0)