Skip to content

Commit 0ba5a25

Browse files
elijah-wrightakpm00
authored andcommitted
kernel: relay: use __GFP_ZERO in relay_alloc_buf
Passing the __GFP_ZERO flag to alloc_page should result in less overhead th= an using memset() Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Elijah Wright <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent f7b0ff2 commit 0ba5a25

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

kernel/relay.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ static void *relay_alloc_buf(struct rchan_buf *buf, size_t *size)
118118
return NULL;
119119

120120
for (i = 0; i < n_pages; i++) {
121-
buf->page_array[i] = alloc_page(GFP_KERNEL);
121+
buf->page_array[i] = alloc_page(GFP_KERNEL | __GFP_ZERO);
122122
if (unlikely(!buf->page_array[i]))
123123
goto depopulate;
124124
set_page_private(buf->page_array[i], (unsigned long)buf);
@@ -127,7 +127,6 @@ static void *relay_alloc_buf(struct rchan_buf *buf, size_t *size)
127127
if (!mem)
128128
goto depopulate;
129129

130-
memset(mem, 0, *size);
131130
buf->page_count = n_pages;
132131
return mem;
133132

0 commit comments

Comments
 (0)