Re: [PATCH v7 00/11] extend task comm from 16 to 24

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2 Nov 2021 09:09:50 +0800
Yafang Shao <laoar.shao@xxxxxxxxx> wrote:

> So if no one against, I will do it in two steps,
> 
> 1. Send the task comm cleanups in a separate patchset named "task comm cleanups"
>     This patchset includes patch #1, #2, #4,  #5, #6, #7 and #9.
>     Cleaning them up can make it less error prone, and it will be
> helpful if we want to extend task comm in the future :)

Agreed.

> 
> 2.  Keep the current comm[16] as-is and introduce a separate pointer
> to store kthread's long name

I'm OK with this. Hopefully more would chime in too.

>      Now we only care about kthread, so we can put the pointer into a
> kthread specific struct.
>      For example in the struct kthread, or in kthread->data (which may
> conflict with workqueue).

No, add a new field to the structure. "full_name" or something like that.
I'm guessing it should be NULL if the name fits in TASK_COMM_LEN and
allocated if the name had to be truncated.

Do not overload data with this. That will just make things confusing.
There's not that many kthreads, where an addition of an 8 byte pointer is
going to cause issues.

> 
>      And then dynamically allocate a longer name if it is truncated,
> for example,
>      __kthread_create_on_node
>          len = vsnprintf(name, sizeof(name), namefmt, args);
>          if (len >= TASK_COMM_LEN) {
>              /* create a longer name */

And make sure you have it fail the kthread allocation if it fails to
allocate.

>          }
> 
>      And then we modify proc_task_name(), so the user can get
> kthread's longer name via /proc/[pid]/comm.

Agreed.

> 
>      And then free the allocated memory when the kthread is destroyed.

Correct.

Thanks,

-- Steve



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux