Skip to content

Commit 0e041fb

Browse files
Allen Hubbejonmason
authored andcommitted
NTB: Use NUMA memory in Intel driver
Allocate memory for the NUMA node of the NTB device. Signed-off-by: Allen Hubbe <[email protected]> Signed-off-by: Jon Mason <[email protected]>
1 parent 1199aa6 commit 0e041fb

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

drivers/ntb/hw/intel/ntb_hw_intel.c

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -413,10 +413,12 @@ static int ndev_init_isr(struct intel_ntb_dev *ndev,
413413
int msix_shift, int total_shift)
414414
{
415415
struct pci_dev *pdev;
416-
int rc, i, msix_count;
416+
int rc, i, msix_count, node;
417417

418418
pdev = ndev_pdev(ndev);
419419

420+
node = dev_to_node(&pdev->dev);
421+
420422
/* Mask all doorbell interrupts */
421423
ndev->db_mask = ndev->db_valid_mask;
422424
ndev->reg->db_iowrite(ndev->db_mask,
@@ -425,11 +427,13 @@ static int ndev_init_isr(struct intel_ntb_dev *ndev,
425427

426428
/* Try to set up msix irq */
427429

428-
ndev->vec = kcalloc(msix_max, sizeof(*ndev->vec), GFP_KERNEL);
430+
ndev->vec = kzalloc_node(msix_max * sizeof(*ndev->vec),
431+
GFP_KERNEL, node);
429432
if (!ndev->vec)
430433
goto err_msix_vec_alloc;
431434

432-
ndev->msix = kcalloc(msix_max, sizeof(*ndev->msix), GFP_KERNEL);
435+
ndev->msix = kzalloc_node(msix_max * sizeof(*ndev->msix),
436+
GFP_KERNEL, node);
433437
if (!ndev->msix)
434438
goto err_msix_alloc;
435439

@@ -1955,10 +1959,12 @@ static int intel_ntb_pci_probe(struct pci_dev *pdev,
19551959
const struct pci_device_id *id)
19561960
{
19571961
struct intel_ntb_dev *ndev;
1958-
int rc;
1962+
int rc, node;
1963+
1964+
node = dev_to_node(&pdev->dev);
19591965

19601966
if (pdev_is_bwd(pdev)) {
1961-
ndev = kzalloc(sizeof(*ndev), GFP_KERNEL);
1967+
ndev = kzalloc_node(sizeof(*ndev), GFP_KERNEL, node);
19621968
if (!ndev) {
19631969
rc = -ENOMEM;
19641970
goto err_ndev;
@@ -1975,7 +1981,7 @@ static int intel_ntb_pci_probe(struct pci_dev *pdev,
19751981
goto err_init_dev;
19761982

19771983
} else if (pdev_is_snb(pdev)) {
1978-
ndev = kzalloc(sizeof(*ndev), GFP_KERNEL);
1984+
ndev = kzalloc_node(sizeof(*ndev), GFP_KERNEL, node);
19791985
if (!ndev) {
19801986
rc = -ENOMEM;
19811987
goto err_ndev;

0 commit comments

Comments
 (0)