提交 b6fcf21d 编写于 作者: J Jann Horn 提交者: Joseph Qi

io_uring: use kzalloc instead of kcalloc for single-element allocations

to #26323578

commit ad6e005ca68de7af76f9ed3e4c9b6f0aa2f842e3 upstream.

These allocations are single-element allocations, so don't use the array
allocation wrapper for them.
Signed-off-by: NJann Horn <jannh@google.com>
Signed-off-by: NJens Axboe <axboe@kernel.dk>
Signed-off-by: NJoseph Qi <joseph.qi@linux.alibaba.com>
Acked-by: NXiaoguang Wang <xiaoguang.wang@linux.alibaba.com>
上级 e7436342
...@@ -581,7 +581,7 @@ static bool create_io_worker(struct io_wq *wq, struct io_wqe *wqe, int index) ...@@ -581,7 +581,7 @@ static bool create_io_worker(struct io_wq *wq, struct io_wqe *wqe, int index)
struct io_wqe_acct *acct =&wqe->acct[index]; struct io_wqe_acct *acct =&wqe->acct[index];
struct io_worker *worker; struct io_worker *worker;
worker = kcalloc_node(1, sizeof(*worker), GFP_KERNEL, wqe->node); worker = kzalloc_node(sizeof(*worker), GFP_KERNEL, wqe->node);
if (!worker) if (!worker)
return false; return false;
...@@ -989,7 +989,7 @@ struct io_wq *io_wq_create(unsigned bounded, struct io_wq_data *data) ...@@ -989,7 +989,7 @@ struct io_wq *io_wq_create(unsigned bounded, struct io_wq_data *data)
int ret = -ENOMEM, i, node; int ret = -ENOMEM, i, node;
struct io_wq *wq; struct io_wq *wq;
wq = kcalloc(1, sizeof(*wq), GFP_KERNEL); wq = kzalloc(sizeof(*wq), GFP_KERNEL);
if (!wq) if (!wq)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
...@@ -1011,7 +1011,7 @@ struct io_wq *io_wq_create(unsigned bounded, struct io_wq_data *data) ...@@ -1011,7 +1011,7 @@ struct io_wq *io_wq_create(unsigned bounded, struct io_wq_data *data)
for_each_online_node(node) { for_each_online_node(node) {
struct io_wqe *wqe; struct io_wqe *wqe;
wqe = kcalloc_node(1, sizeof(struct io_wqe), GFP_KERNEL, node); wqe = kzalloc_node(sizeof(struct io_wqe), GFP_KERNEL, node);
if (!wqe) if (!wqe)
break; break;
wq->wqes[i] = wqe; wq->wqes[i] = wqe;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册