Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1571262 > unrolled thread
| Started by | Shaohua Li <shli@fb.com> |
|---|---|
| First post | 2017-02-01 05:30 +0100 |
| Last post | 2017-02-01 10:40 +0100 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 2/2] nvme: allocate nvme_queue in correct node Shaohua Li <shli@fb.com> - 2017-02-01 05:30 +0100
Re: [PATCH 2/2] nvme: allocate nvme_queue in correct node Christoph Hellwig <hch@lst.de> - 2017-02-01 10:40 +0100
| From | Shaohua Li <shli@fb.com> |
|---|---|
| Date | 2017-02-01 05:30 +0100 |
| Subject | [PATCH 2/2] nvme: allocate nvme_queue in correct node |
| Message-ID | <t5UIp-1aG-3@gated-at.bofh.it> |
nvme_queue is per-cpu queue (mostly). Allocating it in node where blk-mq
will use it.
Signed-off-by: Shaohua Li <shli@fb.com>
---
drivers/nvme/host/pci.c | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 3faefab..f81c0ed 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -1041,9 +1041,10 @@ static int nvme_alloc_sq_cmds(struct nvme_dev *dev, struct nvme_queue *nvmeq,
}
static struct nvme_queue *nvme_alloc_queue(struct nvme_dev *dev, int qid,
- int depth)
+ int depth, int node)
{
- struct nvme_queue *nvmeq = kzalloc(sizeof(*nvmeq), GFP_KERNEL);
+ struct nvme_queue *nvmeq = kzalloc_node(sizeof(*nvmeq), GFP_KERNEL,
+ node);
if (!nvmeq)
return NULL;
@@ -1219,7 +1220,8 @@ static int nvme_configure_admin_queue(struct nvme_dev *dev)
nvmeq = dev->queues[0];
if (!nvmeq) {
- nvmeq = nvme_alloc_queue(dev, 0, NVME_AQ_DEPTH);
+ nvmeq = nvme_alloc_queue(dev, 0, NVME_AQ_DEPTH,
+ dev_to_node(dev->dev));
if (!nvmeq)
return -ENOMEM;
}
@@ -1309,9 +1311,18 @@ static int nvme_create_io_queues(struct nvme_dev *dev)
{
unsigned i, max;
int ret = 0;
+ const struct cpumask *mask;
for (i = dev->queue_count; i <= dev->max_qid; i++) {
- if (!nvme_alloc_queue(dev, i, dev->q_depth)) {
+ int node = dev_to_node(dev->dev);
+
+ mask = pci_irq_get_affinity(to_pci_dev(dev->dev), i);
+ if (mask) {
+ node = cpu_to_node(cpumask_first(mask));
+ node = local_memory_node(node);
+ }
+
+ if (!nvme_alloc_queue(dev, i, dev->q_depth, node)) {
ret = -ENOMEM;
break;
}
--
2.9.3
[toc] | [next] | [standalone]
| From | Christoph Hellwig <hch@lst.de> |
|---|---|
| Date | 2017-02-01 10:40 +0100 |
| Message-ID | <t5Zyp-4a5-7@gated-at.bofh.it> |
| In reply to | #1571262 |
> + mask = pci_irq_get_affinity(to_pci_dev(dev->dev), i);
> + if (mask) {
> + node = cpu_to_node(cpumask_first(mask));
> + node = local_memory_node(node);
> + }
Can you move this to a PCI-layer helper, e.g. something like:
int pci_irq_get_node(struct pci_dev *dev, unsigned vec)
{
const struct cpumask *mask = pci_irq_get_affinity(dev), i);
if (mask)
return local_memory_node(cpu_to_node(cpumask_first(mask)));
return dev_to_node(&dev->dev);
}
Otherwise this looks fine.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web