ionic: Use vzalloc for large per-queue related buffers
Use vzalloc for per-queue info structs that don't need any DMA mapping to help relieve memory pressure found when used in our limited SOC environment. Signed-off-by: Brett Creeley <brett@pensando.io> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
12b1b997c0
commit
116dce0ff0
1 changed files with 6 additions and 8 deletions
|
@ -393,11 +393,11 @@ static void ionic_qcq_free(struct ionic_lif *lif, struct ionic_qcq *qcq)
|
||||||
ionic_qcq_intr_free(lif, qcq);
|
ionic_qcq_intr_free(lif, qcq);
|
||||||
|
|
||||||
if (qcq->cq.info) {
|
if (qcq->cq.info) {
|
||||||
devm_kfree(dev, qcq->cq.info);
|
vfree(qcq->cq.info);
|
||||||
qcq->cq.info = NULL;
|
qcq->cq.info = NULL;
|
||||||
}
|
}
|
||||||
if (qcq->q.info) {
|
if (qcq->q.info) {
|
||||||
devm_kfree(dev, qcq->q.info);
|
vfree(qcq->q.info);
|
||||||
qcq->q.info = NULL;
|
qcq->q.info = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -528,8 +528,7 @@ static int ionic_qcq_alloc(struct ionic_lif *lif, unsigned int type,
|
||||||
new->q.dev = dev;
|
new->q.dev = dev;
|
||||||
new->flags = flags;
|
new->flags = flags;
|
||||||
|
|
||||||
new->q.info = devm_kcalloc(dev, num_descs, sizeof(*new->q.info),
|
new->q.info = vzalloc(num_descs * sizeof(*new->q.info));
|
||||||
GFP_KERNEL);
|
|
||||||
if (!new->q.info) {
|
if (!new->q.info) {
|
||||||
netdev_err(lif->netdev, "Cannot allocate queue info\n");
|
netdev_err(lif->netdev, "Cannot allocate queue info\n");
|
||||||
err = -ENOMEM;
|
err = -ENOMEM;
|
||||||
|
@ -550,8 +549,7 @@ static int ionic_qcq_alloc(struct ionic_lif *lif, unsigned int type,
|
||||||
if (err)
|
if (err)
|
||||||
goto err_out;
|
goto err_out;
|
||||||
|
|
||||||
new->cq.info = devm_kcalloc(dev, num_descs, sizeof(*new->cq.info),
|
new->cq.info = vzalloc(num_descs * sizeof(*new->cq.info));
|
||||||
GFP_KERNEL);
|
|
||||||
if (!new->cq.info) {
|
if (!new->cq.info) {
|
||||||
netdev_err(lif->netdev, "Cannot allocate completion queue info\n");
|
netdev_err(lif->netdev, "Cannot allocate completion queue info\n");
|
||||||
err = -ENOMEM;
|
err = -ENOMEM;
|
||||||
|
@ -640,14 +638,14 @@ err_out_free_cq:
|
||||||
err_out_free_q:
|
err_out_free_q:
|
||||||
dma_free_coherent(dev, new->q_size, new->q_base, new->q_base_pa);
|
dma_free_coherent(dev, new->q_size, new->q_base, new->q_base_pa);
|
||||||
err_out_free_cq_info:
|
err_out_free_cq_info:
|
||||||
devm_kfree(dev, new->cq.info);
|
vfree(new->cq.info);
|
||||||
err_out_free_irq:
|
err_out_free_irq:
|
||||||
if (flags & IONIC_QCQ_F_INTR) {
|
if (flags & IONIC_QCQ_F_INTR) {
|
||||||
devm_free_irq(dev, new->intr.vector, &new->napi);
|
devm_free_irq(dev, new->intr.vector, &new->napi);
|
||||||
ionic_intr_free(lif->ionic, new->intr.index);
|
ionic_intr_free(lif->ionic, new->intr.index);
|
||||||
}
|
}
|
||||||
err_out_free_q_info:
|
err_out_free_q_info:
|
||||||
devm_kfree(dev, new->q.info);
|
vfree(new->q.info);
|
||||||
err_out_free_qcq:
|
err_out_free_qcq:
|
||||||
devm_kfree(dev, new);
|
devm_kfree(dev, new);
|
||||||
err_out:
|
err_out:
|
||||||
|
|
Loading…
Add table
Reference in a new issue