Skip to content

Commit 7a1c8e5

Browse files
Eric Dumazetdavem330
authored andcommitted
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>
1 parent a6c36ee commit 7a1c8e5

4 files changed

Lines changed: 4 additions & 6 deletions

File tree

‎net/ceph/buffer.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ struct ceph_buffer *ceph_buffer_new(size_t len, gfp_t gfp)
1919
if (b->vec.iov_base) {
2020
b->is_vmalloc = false;
2121
} else {
22-
b->vec.iov_base = __vmalloc(len, gfp, PAGE_KERNEL);
22+
b->vec.iov_base = __vmalloc(len, gfp | __GFP_HIGHMEM, PAGE_KERNEL);
2323
if (!b->vec.iov_base) {
2424
kfree(b);
2525
return NULL;

‎net/core/request_sock.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,7 @@ int reqsk_queue_alloc(struct request_sock_queue *queue,
4545
nr_table_entries = roundup_pow_of_two(nr_table_entries + 1);
4646
lopt_size += nr_table_entries * sizeof(struct request_sock *);
4747
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);
5149
else
5250
lopt = kzalloc(lopt_size, GFP_KERNEL);
5351
if (lopt == NULL)

‎net/ipv4/fib_trie.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ static struct tnode *tnode_alloc(size_t size)
365365
if (size <= PAGE_SIZE)
366366
return kzalloc(size, GFP_KERNEL);
367367
else
368-
return __vmalloc(size, GFP_KERNEL | __GFP_ZERO, PAGE_KERNEL);
368+
return vzalloc(size);
369369
}
370370

371371
static void __tnode_vfree(struct work_struct *arg)

‎net/xfrm/xfrm_hash.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ struct hlist_head *xfrm_hash_alloc(unsigned int sz)
1919
if (sz <= PAGE_SIZE)
2020
n = kzalloc(sz, GFP_KERNEL);
2121
else if (hashdist)
22-
n = __vmalloc(sz, GFP_KERNEL | __GFP_ZERO, PAGE_KERNEL);
22+
n = vzalloc(sz);
2323
else
2424
n = (struct hlist_head *)
2525
__get_free_pages(GFP_KERNEL | __GFP_NOWARN | __GFP_ZERO,

0 commit comments

Comments
 (0)