The mtip_port kmalloc() allocation is relatively high order, in particular 
since the recent doubling of the size of the scatterlist container.  The 
allocation has been shown to fail during SRSI under fragmented or low memory 
conditions.  Switching to vmalloc() mitigates the problem.  Converted both 
mtip_port and driver_data allocations for consistency.

Signed-off-by: Sam Bradshaw <[email protected]>
diff --git a/drivers/block/mtip32xx/mtip32xx.c 
b/drivers/block/mtip32xx/mtip32xx.c
index 624e9d9..f55e3e5 100644
--- a/drivers/block/mtip32xx/mtip32xx.c
+++ b/drivers/block/mtip32xx/mtip32xx.c
@@ -3116,7 +3116,7 @@ static int mtip_free_orphan(struct driver_data *dd)
                        dd->queue = NULL;
                }
        }
-       kfree(dd);
+       vfree(dd);
        return 0;
 }
 
@@ -3495,8 +3495,7 @@ static int mtip_hw_init(struct driver_data *dd)
 
        hba_setup(dd);
 
-       dd->port = kzalloc_node(sizeof(struct mtip_port), GFP_KERNEL,
-                               dd->numa_node);
+       dd->port = vzalloc_node(sizeof(struct mtip_port), dd->numa_node);
        if (!dd->port) {
                dev_err(&dd->pdev->dev,
                        "Memory allocation: port structure\n");
@@ -3680,7 +3679,7 @@ out2:
 
 out1:
        /* Free the memory allocated for the for structure. */
-       kfree(dd->port);
+       vfree(dd->port);
 
        return rv;
 }
@@ -3724,7 +3723,7 @@ static int mtip_hw_exit(struct driver_data *dd)
        mtip_dma_free(dd);
 
        /* Free the memory allocated for the for structure. */
-       kfree(dd->port);
+       vfree(dd->port);
        dd->port = NULL;
 
        return 0;
@@ -4512,7 +4511,7 @@ static int mtip_pci_probe(struct pci_dev *pdev,
                my_node, pcibus_to_node(pdev->bus), dev_to_node(&pdev->dev),
                cpu_to_node(smp_processor_id()), smp_processor_id());
 
-       dd = kzalloc_node(sizeof(struct driver_data), GFP_KERNEL, my_node);
+       dd = vzalloc_node(sizeof(struct driver_data), my_node);
        if (dd == NULL) {
                dev_err(&pdev->dev,
                        "Unable to allocate memory for driver data\n");
@@ -4670,7 +4669,7 @@ setmask_err:
        pcim_iounmap_regions(pdev, 1 << MTIP_ABAR);
 
 iomap_err:
-       kfree(dd);
+       vfree(dd);
        pci_set_drvdata(pdev, NULL);
        return rv;
 done:
@@ -4731,7 +4730,7 @@ static void mtip_pci_remove(struct pci_dev *pdev)
        spin_unlock_irqrestore(&dev_lock, flags);
 
        if (!dd->sr)
-               kfree(dd);
+               vfree(dd);
        else
                set_bit(MTIP_DDF_REMOVE_DONE_BIT, &dd->dd_flag);
 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to