From: Sam Bradshaw <sbradshaw@micron.com>
To: <axboe@kernel.dk>
Cc: <linux-kernel@vger.kernel.org>, <asamymuthupa@micron.com>
Subject: [PATCH] mtip32xx: switch to vmalloc() to mitigate high order allocation failures
Date: Thu, 13 Mar 2014 15:57:56 -0700 [thread overview]
Message-ID: <532237F4.3010309@micron.com> (raw)
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);
next reply other threads:[~2014-03-13 22:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-13 22:57 Sam Bradshaw [this message]
2014-03-14 7:48 ` [PATCH] mtip32xx: switch to vmalloc() to mitigate high order allocation failures Joe Perches
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=532237F4.3010309@micron.com \
--to=sbradshaw@micron.com \
--cc=asamymuthupa@micron.com \
--cc=axboe@kernel.dk \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.