Re: [PATCH 4/5] kernel: increase the size of kthread's comm

From: Kees Cook
Date: Wed Sep 29 2021 - 14:20:04 EST


On Wed, Sep 29, 2021 at 11:50:35AM +0000, Yafang Shao wrote:
> This patch increases the size of ktread's comm from 16 to 24, which is
> the same with workqueue's, to improve this situation. After this cahnge,
> [...]
> Because there're only a few of kthreads, so it won't increase too much
> memory.

Even without the performance impact changes, the math here doesn't hold
either, since using kmalloc means there are slabs being allocated to hold
the task "comm"s now (which comes with overhead), and every task added
a pointer to those 16 bytes (i.e. 8 more bytes on 64-bit systems). So
this change, even if there was 0 overhead in using slabs, would be
identical to having just raised TASK_COMM_LEN to 24. 8 byte pointer,
16 byte allocation == 24 bytes.

-Kees

--
Kees Cook