Network performance can suffer when a load balancing bond uses slave
interfaces which are in different NUMA domains.

This compares the NUMA domain of a newly enslaved interface against any
existing enslaved interfaces and prints a warning if they do not match.

Signed-off-by: Patrick Talbert <ptalb...@redhat.com>
---
:100644 100644 b19dc03... 250a969... M  drivers/net/bonding/bond_main.c
 drivers/net/bonding/bond_main.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index b19dc03..250a969 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -55,6 +55,7 @@
 #include <asm/dma.h>
 #include <linux/uaccess.h>
 #include <linux/errno.h>
+#include <linux/device.h>
 #include <linux/netdevice.h>
 #include <linux/inetdevice.h>
 #include <linux/igmp.h>
@@ -1450,6 +1451,21 @@ int bond_enslave(struct net_device *bond_dev, struct 
net_device *slave_dev)
                }
        }
 
+       if (bond_has_slaves(bond)) {
+               struct list_head *iter;
+               struct slave *slave;
+
+               bond_for_each_slave(bond, slave, iter) {
+                       if (slave_dev->dev.numa_node !=
+                           slave->dev->dev.numa_node) {
+                               netdev_warn(bond_dev,
+                                           "%s does not match NUMA domain of 
existing slaves. This could have a performance impact.",
+                                           slave_dev->name);
+                               break;
+                       }
+               }
+       }
+
        call_netdevice_notifiers(NETDEV_JOIN, slave_dev);
 
        /* If this is the first slave, then we need to set the master's hardware
-- 
1.8.3.1

Reply via email to