LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 03-06-2024, 11:51 PM   #1
harry.hycc
LQ Newbie
 
Registered: Feb 2024
Posts: 4

Rep: Reputation: 2
Question Do kernel and kernel modules have their own task_struct?


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_ns
in 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.

Last edited by harry.hycc; 03-06-2024 at 11:59 PM.
 
Old 03-07-2024, 08:17 PM   #2
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,326
Blog Entries: 28

Rep: Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142
This question is way beyond me, but a web search turned up a number of articles that might be germane.

This one looks like a good starting point.
 
1 members found this post helpful.
  


Reply

Tags
kernel, module



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Why don't people like to own their own data anymore? Arct1c_f0x Linux - Virtualization and Cloud 48 07-29-2021 02:24 AM
LXer: Intel Can't Ship Their Own Driver With Their MeeGo OS LXer Syndicated Linux News 0 07-16-2010 01:41 AM
kernel module/program to print the different fields of task_struct and mm_struct muskvar Programming 1 02-17-2009 09:35 AM
Making own modules for own bot alitrix Programming 2 01-06-2005 02:43 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 12:47 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration