]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
kernel: relay: use __GFP_ZERO in relay_alloc_buf
authorElijah Wright <git@elijahs.space>
Tue, 10 Jun 2025 22:56:28 +0000 (15:56 -0700)
committerAndrew Morton <akpm@linux-foundation.org>
Thu, 10 Jul 2025 05:57:50 +0000 (22:57 -0700)
Passing the __GFP_ZERO flag to alloc_page should result in less overhead
th= an using memset()

Link: https://lkml.kernel.org/r/20250610225639.314970-3-git@elijahs.space
Signed-off-by: Elijah Wright <git@elijahs.space>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
kernel/relay.c

index c0c93a04d4ce926937dfbc9098e1d9df9821853e..3ee5b038d0d90fe58b0171b592706c11c9725878 100644 (file)
@@ -118,7 +118,7 @@ static void *relay_alloc_buf(struct rchan_buf *buf, size_t *size)
                return NULL;
 
        for (i = 0; i < n_pages; i++) {
-               buf->page_array[i] = alloc_page(GFP_KERNEL);
+               buf->page_array[i] = alloc_page(GFP_KERNEL | __GFP_ZERO);
                if (unlikely(!buf->page_array[i]))
                        goto depopulate;
                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)
        if (!mem)
                goto depopulate;
 
-       memset(mem, 0, *size);
        buf->page_count = n_pages;
        return mem;