提交 e12f8e29 编写于 作者: E Eric Dumazet 提交者: Patrick McHardy

netfilter: vmalloc_node cleanup

Using vmalloc_node(size, numa_node_id()) for temporary storage is not
needed. vmalloc(size) is more respectful of user NUMA policy.
Signed-off-by: NEric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: NPatrick McHardy <kaber@trash.net>
上级 fabf3a85
...@@ -758,7 +758,7 @@ static struct xt_counters *alloc_counters(const struct xt_table *table) ...@@ -758,7 +758,7 @@ static struct xt_counters *alloc_counters(const struct xt_table *table)
* about). * about).
*/ */
countersize = sizeof(struct xt_counters) * private->number; countersize = sizeof(struct xt_counters) * private->number;
counters = vmalloc_node(countersize, numa_node_id()); counters = vmalloc(countersize);
if (counters == NULL) if (counters == NULL)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
...@@ -1005,8 +1005,7 @@ static int __do_replace(struct net *net, const char *name, ...@@ -1005,8 +1005,7 @@ static int __do_replace(struct net *net, const char *name,
struct arpt_entry *iter; struct arpt_entry *iter;
ret = 0; ret = 0;
counters = vmalloc_node(num_counters * sizeof(struct xt_counters), counters = vmalloc(num_counters * sizeof(struct xt_counters));
numa_node_id());
if (!counters) { if (!counters) {
ret = -ENOMEM; ret = -ENOMEM;
goto out; goto out;
...@@ -1159,7 +1158,7 @@ static int do_add_counters(struct net *net, const void __user *user, ...@@ -1159,7 +1158,7 @@ static int do_add_counters(struct net *net, const void __user *user,
if (len != size + num_counters * sizeof(struct xt_counters)) if (len != size + num_counters * sizeof(struct xt_counters))
return -EINVAL; return -EINVAL;
paddc = vmalloc_node(len - size, numa_node_id()); paddc = vmalloc(len - size);
if (!paddc) if (!paddc)
return -ENOMEM; return -ENOMEM;
......
...@@ -928,7 +928,7 @@ static struct xt_counters *alloc_counters(const struct xt_table *table) ...@@ -928,7 +928,7 @@ static struct xt_counters *alloc_counters(const struct xt_table *table)
(other than comefrom, which userspace doesn't care (other than comefrom, which userspace doesn't care
about). */ about). */
countersize = sizeof(struct xt_counters) * private->number; countersize = sizeof(struct xt_counters) * private->number;
counters = vmalloc_node(countersize, numa_node_id()); counters = vmalloc(countersize);
if (counters == NULL) if (counters == NULL)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
...@@ -1352,7 +1352,7 @@ do_add_counters(struct net *net, const void __user *user, ...@@ -1352,7 +1352,7 @@ do_add_counters(struct net *net, const void __user *user,
if (len != size + num_counters * sizeof(struct xt_counters)) if (len != size + num_counters * sizeof(struct xt_counters))
return -EINVAL; return -EINVAL;
paddc = vmalloc_node(len - size, numa_node_id()); paddc = vmalloc(len - size);
if (!paddc) if (!paddc)
return -ENOMEM; return -ENOMEM;
......
...@@ -943,7 +943,7 @@ static struct xt_counters *alloc_counters(const struct xt_table *table) ...@@ -943,7 +943,7 @@ static struct xt_counters *alloc_counters(const struct xt_table *table)
(other than comefrom, which userspace doesn't care (other than comefrom, which userspace doesn't care
about). */ about). */
countersize = sizeof(struct xt_counters) * private->number; countersize = sizeof(struct xt_counters) * private->number;
counters = vmalloc_node(countersize, numa_node_id()); counters = vmalloc(countersize);
if (counters == NULL) if (counters == NULL)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
...@@ -1213,8 +1213,7 @@ __do_replace(struct net *net, const char *name, unsigned int valid_hooks, ...@@ -1213,8 +1213,7 @@ __do_replace(struct net *net, const char *name, unsigned int valid_hooks,
struct ip6t_entry *iter; struct ip6t_entry *iter;
ret = 0; ret = 0;
counters = vmalloc_node(num_counters * sizeof(struct xt_counters), counters = vmalloc(num_counters * sizeof(struct xt_counters));
numa_node_id());
if (!counters) { if (!counters) {
ret = -ENOMEM; ret = -ENOMEM;
goto out; goto out;
...@@ -1368,7 +1367,7 @@ do_add_counters(struct net *net, const void __user *user, unsigned int len, ...@@ -1368,7 +1367,7 @@ do_add_counters(struct net *net, const void __user *user, unsigned int len,
if (len != size + num_counters * sizeof(struct xt_counters)) if (len != size + num_counters * sizeof(struct xt_counters))
return -EINVAL; return -EINVAL;
paddc = vmalloc_node(len - size, numa_node_id()); paddc = vmalloc(len - size);
if (!paddc) if (!paddc)
return -ENOMEM; return -ENOMEM;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册