From 91d8f5191e8fe6fc6a87aa5353b36f5a7409fbec Mon Sep 17 00:00:00 2001 From: Dennis Zhou Date: Wed, 16 Sep 2020 13:41:05 -0700 Subject: io_uring: add blkcg accounting to offloaded operations There are a few operations that are offloaded to the worker threads. In this case, we lose process context and end up in kthread context. This results in ios to be not accounted to the issuing cgroup and consequently end up as issued by root. Just like others, adopt the personality of the blkcg too when issuing via the workqueues. For the SQPOLL thread, it will live and attach in the inited cgroup's context. Signed-off-by: Dennis Zhou Signed-off-by: Jens Axboe --- fs/io-wq.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'fs/io-wq.h') diff --git a/fs/io-wq.h b/fs/io-wq.h index 2519830c8c55..84bcf6a85523 100644 --- a/fs/io-wq.h +++ b/fs/io-wq.h @@ -87,6 +87,9 @@ struct io_wq_work { struct io_wq_work_node list; struct files_struct *files; struct mm_struct *mm; +#ifdef CONFIG_BLK_CGROUP + struct cgroup_subsys_state *blkcg_css; +#endif const struct cred *creds; struct nsproxy *nsproxy; struct fs_struct *fs; -- cgit v1.2.3