* [PATCH] mtip32xx: switch to vmalloc() to mitigate high order allocation failures
@ 2014-03-13 22:57 Sam Bradshaw
2014-03-14 7:48 ` Joe Perches
0 siblings, 1 reply; 2+ messages in thread
From: Sam Bradshaw @ 2014-03-13 22:57 UTC (permalink / raw)
To: axboe; +Cc: linux-kernel, asamymuthupa
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 <sbradshaw@micron.com>
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);
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-03-14 7:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-13 22:57 [PATCH] mtip32xx: switch to vmalloc() to mitigate high order allocation failures Sam Bradshaw
2014-03-14 7:48 ` Joe Perches
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.