numa: Reset unassigned node on tree rebuild
http://code.google.com/p/irqbalance/issues/detail?id=38 This issue noted that on a tree rebuild, the unassigned node has pointers to the interrupt list and children list that is left over from the previous tree state. We erroneously follow these lists even though they are no longer allocated, leading to memory errors Fix it my re-initializing to the startup state. Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
This commit is contained in:
parent
918c8a9da1
commit
5dfe1f8817
11
numa.c
11
numa.c
|
@ -38,7 +38,7 @@
|
||||||
|
|
||||||
GList *numa_nodes = NULL;
|
GList *numa_nodes = NULL;
|
||||||
|
|
||||||
static struct topo_obj unspecified_node = {
|
static struct topo_obj unspecified_node_template = {
|
||||||
.load = 0,
|
.load = 0,
|
||||||
.number = -1,
|
.number = -1,
|
||||||
.obj_type = OBJ_TYPE_NODE,
|
.obj_type = OBJ_TYPE_NODE,
|
||||||
|
@ -49,6 +49,8 @@ static struct topo_obj unspecified_node = {
|
||||||
.obj_type_list = &numa_nodes,
|
.obj_type_list = &numa_nodes,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static struct topo_obj unspecified_node;
|
||||||
|
|
||||||
static void add_one_node(const char *nodename)
|
static void add_one_node(const char *nodename)
|
||||||
{
|
{
|
||||||
char path[PATH_MAX];
|
char path[PATH_MAX];
|
||||||
|
@ -85,6 +87,13 @@ void build_numa_node_list(void)
|
||||||
DIR *dir = opendir(SYSFS_NODE_PATH);
|
DIR *dir = opendir(SYSFS_NODE_PATH);
|
||||||
struct dirent *entry;
|
struct dirent *entry;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Note that we copy the unspcified node from the template here
|
||||||
|
* in the event we just freed the object tree during a rescan.
|
||||||
|
* This ensures we don't get stale list pointers anywhere
|
||||||
|
*/
|
||||||
|
memcpy(&unspecified_node, &unspecified_node_template, sizeof (struct topo_obj));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add the unspecified node
|
* Add the unspecified node
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue