I realized I need to call release_task() to get rid of the task_struct after finish reading the page you mentioned, and it does work accordingly! Thank YOU very much :-D On 2/23/06, Sandeep Kumar <sandeepksinha@xxxxxxxxx> wrote: > On 2/22/06, James Yu <cyu021@xxxxxxxxx> wrote: > > I just found this thread on > > "http://mail.nl.linux.org/kernelnewbies/2003-09/msg00285.html" > > and have an exactly opposite question. > > > > How do I remove a kernel thread in kernel mode ? > > I write a C-function in one of the Linux source files and create a > > kernel thread by invoking kernel_thread() to run the function, like: > > "kernel_thread(a1, NULL, CLONE_FS | CLONE_FILES | CLONE_SIGNAL);" > > Function a1 simply invokes printk() to output some message on console. > > I invoke do_exit(0); at the end of a1, but a1's task_struct still > > exists in in task_struct list after its execution. > > How do I remove it a1's task_struct upon its completion? I thought > > explicitly invoke do_exit() ensures the removal of task_struct? > > > > -- > > Kernelnewbies: Help each other learn about the Linux kernel. > > Archive: http://mail.nl.linux.org/kernelnewbies/ > > FAQ: http://kernelnewbies.org/faq/ > > > > > > Also try using release_task ( ) explicitly, if you want to remove the > task_struct entry from teh list . > > > -- > Regards, > Sandeep > > > > > > A man with one watch knows what time it is; a man with two watches is > never quite sure. > -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/