Skip to contentSkip to conversation

memcg: charge io_uring related objects

PATCH In review Yutian Yang 2 participants 2 messages Jul 19, 2021 – Jul 20, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 memcg: charge io_uring related objects

This patch is a more complete version than the previous one, adding accounting flags to nearly all syscall-triggerable kernel object allocations. The patch does not account for temporary objects, i.e., objects that are freed soon after allocation, to avoid meaningless performance penalty.

Thanks!

Yutian Yang,
Zhejiang University

---
 fs/io-wq.c    |  6 +++---
 fs/io_uring.c | 54 +++++++++++++++++++++++++--------------------------
 2 files changed, 30 insertions(+), 30 deletions(-)
fs/io-wq.c +3 -3
index f72d53848..ab31d01cc 100644
@@ -1086,11 +1086,11 @@ struct io_wq *io_wq_create(unsigned bounded, struct io_wq_data *data)
 	if (WARN_ON_ONCE(!data->free_work || !data->do_work))
 		return ERR_PTR(-EINVAL);
 
-	wq = kzalloc(sizeof(*wq), GFP_KERNEL);
+	wq = kzalloc(sizeof(*wq), GFP_KERNEL_ACCOUNT);
 	if (!wq)
 		return ERR_PTR(-ENOMEM);
 
-	wq->wqes = kcalloc(nr_node_ids, sizeof(struct io_wqe *), GFP_KERNEL);
+	wq->wqes = kcalloc(nr_node_ids, sizeof(struct io_wqe *), GFP_KERNEL_ACCOUNT);
 	if (!wq->wqes)
 		goto err_wq;
 
@@ -1111,7 +1111,7 @@ struct io_wq *io_wq_create(unsigned bounded, struct io_wq_data *data)
 
 		if (!node_online(alloc_node))
 			alloc_node = NUMA_NO_NODE;
-		wqe = kzalloc_node(sizeof(struct io_wqe), GFP_KERNEL, alloc_node);
+		wqe = kzalloc_node(sizeof(struct io_wqe), GFP_KERNEL_ACCOUNT, alloc_node);
 		if (!wqe)
 			goto err;
 		wq->wqes[node] = wqe;
fs/io_uring.c +27 -27

205 lines not on this page · raw message

Signature · 1 line
2.25.1
#1 lore raw
Quoted 7 lines · Yutian Yang

This patch is a more complete version than the previous one, adding accounting flags to nearly all syscall-triggerable kernel object allocations. The patch does not account for temporary objects, i.e., objects that are freed soon after allocation, to avoid meaningless performance penalty.

Quoted 7 lines

Thanks!

Yutian Yang,
Zhejiang University

Can you please bring back the commit message of the previous version (which has the program to trigger the unaccounted allocations) and can add the details on this one to that?