浏览代码

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>
Eric Dumazet 14 年之前
父节点
当前提交
7a1c8e5ab1
共有 4 个文件被更改,包括 4 次插入6 次删除
  1. 1 1
      net/ceph/buffer.c
  2. 1 3
      net/core/request_sock.c
  3. 1 1
      net/ipv4/fib_trie.c
  4. 1 1
      net/xfrm/xfrm_hash.c

+ 1 - 1
net/ceph/buffer.c

@@ -19,7 +19,7 @@ struct ceph_buffer *ceph_buffer_new(size_t len, gfp_t gfp)
 	if (b->vec.iov_base) {
 	if (b->vec.iov_base) {
 		b->is_vmalloc = false;
 		b->is_vmalloc = false;
 	} else {
 	} else {
-		b->vec.iov_base = __vmalloc(len, gfp, PAGE_KERNEL);
+		b->vec.iov_base = __vmalloc(len, gfp | __GFP_HIGHMEM, PAGE_KERNEL);
 		if (!b->vec.iov_base) {
 		if (!b->vec.iov_base) {
 			kfree(b);
 			kfree(b);
 			return NULL;
 			return NULL;

+ 1 - 3
net/core/request_sock.c

@@ -45,9 +45,7 @@ int reqsk_queue_alloc(struct request_sock_queue *queue,
 	nr_table_entries = roundup_pow_of_two(nr_table_entries + 1);
 	nr_table_entries = roundup_pow_of_two(nr_table_entries + 1);
 	lopt_size += nr_table_entries * sizeof(struct request_sock *);
 	lopt_size += nr_table_entries * sizeof(struct request_sock *);
 	if (lopt_size > PAGE_SIZE)
 	if (lopt_size > PAGE_SIZE)
-		lopt = __vmalloc(lopt_size,
-			GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO,
-			PAGE_KERNEL);
+		lopt = vzalloc(lopt_size);
 	else
 	else
 		lopt = kzalloc(lopt_size, GFP_KERNEL);
 		lopt = kzalloc(lopt_size, GFP_KERNEL);
 	if (lopt == NULL)
 	if (lopt == NULL)

+ 1 - 1
net/ipv4/fib_trie.c

@@ -365,7 +365,7 @@ static struct tnode *tnode_alloc(size_t size)
 	if (size <= PAGE_SIZE)
 	if (size <= PAGE_SIZE)
 		return kzalloc(size, GFP_KERNEL);
 		return kzalloc(size, GFP_KERNEL);
 	else
 	else
-		return __vmalloc(size, GFP_KERNEL | __GFP_ZERO, PAGE_KERNEL);
+		return vzalloc(size);
 }
 }
 
 
 static void __tnode_vfree(struct work_struct *arg)
 static void __tnode_vfree(struct work_struct *arg)

+ 1 - 1
net/xfrm/xfrm_hash.c

@@ -19,7 +19,7 @@ struct hlist_head *xfrm_hash_alloc(unsigned int sz)
 	if (sz <= PAGE_SIZE)
 	if (sz <= PAGE_SIZE)
 		n = kzalloc(sz, GFP_KERNEL);
 		n = kzalloc(sz, GFP_KERNEL);
 	else if (hashdist)
 	else if (hashdist)
-		n = __vmalloc(sz, GFP_KERNEL | __GFP_ZERO, PAGE_KERNEL);
+		n = vzalloc(sz);
 	else
 	else
 		n = (struct hlist_head *)
 		n = (struct hlist_head *)
 			__get_free_pages(GFP_KERNEL | __GFP_NOWARN | __GFP_ZERO,
 			__get_free_pages(GFP_KERNEL | __GFP_NOWARN | __GFP_ZERO,