Skip to content

Commit

Permalink
libnvdimm: Schedule device registration on node local to the device
Browse files Browse the repository at this point in the history
Force the device registration for nvdimm devices to be closer to the actual
device. This is achieved by using either the NUMA node ID of the region, or
of the parent. By doing this we can have everything above the region based
on the region, and everything below the region based on the nvdimm bus.

By guaranteeing NUMA locality I see an improvement of as high as 25% for
per-node init of a system with 12TB of persistent memory.

Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Alexander Duyck <alexander.h.duyck@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Alexander Duyck authored and Greg Kroah-Hartman committed Jan 31, 2019
1 parent 8b9ec6b commit af87b9a
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions drivers/nvdimm/bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <linux/ndctl.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/cpu.h>
#include <linux/fs.h>
#include <linux/io.h>
#include <linux/mm.h>
Expand Down Expand Up @@ -534,11 +535,15 @@ void __nd_device_register(struct device *dev)
set_dev_node(dev, to_nd_region(dev)->numa_node);

dev->bus = &nvdimm_bus_type;
if (dev->parent)
if (dev->parent) {
get_device(dev->parent);
if (dev_to_node(dev) == NUMA_NO_NODE)
set_dev_node(dev, dev_to_node(dev->parent));
}
get_device(dev);
async_schedule_domain(nd_async_device_register, dev,
&nd_async_domain);

async_schedule_dev_domain(nd_async_device_register, dev,
&nd_async_domain);
}

void nd_device_register(struct device *dev)
Expand Down

0 comments on commit af87b9a

Please sign in to comment.