Article 6K5BX Do kernel and kernel modules have their own task_struct?

Do kernel and kernel modules have their own task_struct?

by
harry.hycc
from LinuxQuestions.org on (#6K5BX)
I know that in user space, both processes and threads have corresponding task_structs.

I've also found information that kthreads have their own task_structs, with mm_struct=NULL.

But what I'm curious about is, do kernel and modules loaded via insmod/modprobe into the kernel also have their own task_structs?

I'm asking this because I've been using
Code:current->nsproxy->mnt_nsin my own kernel module, but I'm not sure who current represents when executing the code in kernel module. Does it refer to a specific process, or does it point to the kernel itself?

I do that since I want to iterate all current mountpoints through access mnt_list in mount_namespace in my own kernel module

And I found the implement like the function is_local_mountpoint in fs/namespace.c https://elixir.bootlin.com/linux/lat...mespace.c#L763

This has left me quite puzzled, so I'd like to ask for everyone's input.
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments