diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2009-11-29 03:44:33 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-11-29 04:17:39 -0500 |
commit | 3291b9db567e1ec38362024049cbd02987b1e277 (patch) | |
tree | 8de6878abfed5a16974747c54c4e1420327b86ab /net/core | |
parent | 9b963e5d0e01461099a40117b05480f24b63381f (diff) |
pktgen: NUMA aware
pktgen threads are bound to given CPU, we can allocate memory for
these threads in a NUMA aware way.
After a pktgen session on two threads, we can check flows memory was
allocated on right node, instead of a not related one.
# grep pktgen_thread_write /proc/vmallocinfo
0xffffc90007204000-0xffffc90007385000 1576960 pktgen_thread_write+0x3a4/0x6b0 [pktgen] pages=384 vmalloc N0=384
0xffffc90007386000-0xffffc90007507000 1576960 pktgen_thread_write+0x3a4/0x6b0 [pktgen] pages=384 vmalloc N1=384
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/pktgen.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/net/core/pktgen.c b/net/core/pktgen.c index b44104d3e6be..19ee493ec178 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c | |||
@@ -3626,6 +3626,7 @@ static int pktgen_add_device(struct pktgen_thread *t, const char *ifname) | |||
3626 | { | 3626 | { |
3627 | struct pktgen_dev *pkt_dev; | 3627 | struct pktgen_dev *pkt_dev; |
3628 | int err; | 3628 | int err; |
3629 | int node = cpu_to_node(t->cpu); | ||
3629 | 3630 | ||
3630 | /* We don't allow a device to be on several threads */ | 3631 | /* We don't allow a device to be on several threads */ |
3631 | 3632 | ||
@@ -3635,12 +3636,13 @@ static int pktgen_add_device(struct pktgen_thread *t, const char *ifname) | |||
3635 | return -EBUSY; | 3636 | return -EBUSY; |
3636 | } | 3637 | } |
3637 | 3638 | ||
3638 | pkt_dev = kzalloc(sizeof(struct pktgen_dev), GFP_KERNEL); | 3639 | pkt_dev = kzalloc_node(sizeof(struct pktgen_dev), GFP_KERNEL, node); |
3639 | if (!pkt_dev) | 3640 | if (!pkt_dev) |
3640 | return -ENOMEM; | 3641 | return -ENOMEM; |
3641 | 3642 | ||
3642 | strcpy(pkt_dev->odevname, ifname); | 3643 | strcpy(pkt_dev->odevname, ifname); |
3643 | pkt_dev->flows = vmalloc(MAX_CFLOWS * sizeof(struct flow_state)); | 3644 | pkt_dev->flows = vmalloc_node(MAX_CFLOWS * sizeof(struct flow_state), |
3645 | node); | ||
3644 | if (pkt_dev->flows == NULL) { | 3646 | if (pkt_dev->flows == NULL) { |
3645 | kfree(pkt_dev); | 3647 | kfree(pkt_dev); |
3646 | return -ENOMEM; | 3648 | return -ENOMEM; |
@@ -3702,7 +3704,8 @@ static int __init pktgen_create_thread(int cpu) | |||
3702 | struct proc_dir_entry *pe; | 3704 | struct proc_dir_entry *pe; |
3703 | struct task_struct *p; | 3705 | struct task_struct *p; |
3704 | 3706 | ||
3705 | t = kzalloc(sizeof(struct pktgen_thread), GFP_KERNEL); | 3707 | t = kzalloc_node(sizeof(struct pktgen_thread), GFP_KERNEL, |
3708 | cpu_to_node(cpu)); | ||
3706 | if (!t) { | 3709 | if (!t) { |
3707 | printk(KERN_ERR "pktgen: ERROR: out of memory, can't " | 3710 | printk(KERN_ERR "pktgen: ERROR: out of memory, can't " |
3708 | "create new thread.\n"); | 3711 | "create new thread.\n"); |