Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: allow GFP_HIGHMEM in __vmalloc()

We forgot to use __GFP_HIGHMEM in several __vmalloc() calls.

In ceph, add the missing flag.

In fib_trie.c, xfrm_hash.c and request_sock.c, using vzalloc() is
cleaner and allows using HIGHMEM pages as well.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Eric Dumazet and committed by
David S. Miller
7a1c8e5a a6c36ee6

+4 -6
+1 -1
net/ceph/buffer.c
··· 19 19 if (b->vec.iov_base) { 20 20 b->is_vmalloc = false; 21 21 } else { 22 - b->vec.iov_base = __vmalloc(len, gfp, PAGE_KERNEL); 22 + b->vec.iov_base = __vmalloc(len, gfp | __GFP_HIGHMEM, PAGE_KERNEL); 23 23 if (!b->vec.iov_base) { 24 24 kfree(b); 25 25 return NULL;
+1 -3
net/core/request_sock.c
··· 45 45 nr_table_entries = roundup_pow_of_two(nr_table_entries + 1); 46 46 lopt_size += nr_table_entries * sizeof(struct request_sock *); 47 47 if (lopt_size > PAGE_SIZE) 48 - lopt = __vmalloc(lopt_size, 49 - GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO, 50 - PAGE_KERNEL); 48 + lopt = vzalloc(lopt_size); 51 49 else 52 50 lopt = kzalloc(lopt_size, GFP_KERNEL); 53 51 if (lopt == NULL)
+1 -1
net/ipv4/fib_trie.c
··· 365 365 if (size <= PAGE_SIZE) 366 366 return kzalloc(size, GFP_KERNEL); 367 367 else 368 - return __vmalloc(size, GFP_KERNEL | __GFP_ZERO, PAGE_KERNEL); 368 + return vzalloc(size); 369 369 } 370 370 371 371 static void __tnode_vfree(struct work_struct *arg)
+1 -1
net/xfrm/xfrm_hash.c
··· 19 19 if (sz <= PAGE_SIZE) 20 20 n = kzalloc(sz, GFP_KERNEL); 21 21 else if (hashdist) 22 - n = __vmalloc(sz, GFP_KERNEL | __GFP_ZERO, PAGE_KERNEL); 22 + n = vzalloc(sz); 23 23 else 24 24 n = (struct hlist_head *) 25 25 __get_free_pages(GFP_KERNEL | __GFP_NOWARN | __GFP_ZERO,