Bug 33124 - kthread_create doesnt mark kthreads as kthreads.
Summary: kthread_create doesnt mark kthreads as kthreads.
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: Unspecified
Hardware: Any Any
: Normal Affects Only Me
Assignee: John Baldwin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-12-23 21:40 UTC by debolaz
Modified: 2005-09-02 18:52 UTC (History)
0 users

See Also:


Attachments
file.diff (484 bytes, patch)
2001-12-23 21:40 UTC, debolaz
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description debolaz 2001-12-23 21:40:00 UTC
When kthread_create spawns a kernel thread, it doesnt mark it with the flag P_KTHREADP which at least according to its description, should be used to mark kernel threads.

Fix: This is submitted through the web interface and probably wont apply correctly, but it shows how to fix it.
How-To-Repeat: Spawn a kthread and check for P_KTHREADP in p->p_flag.
Comment 1 Sheldon Hearn freebsd_committer freebsd_triage 2002-01-09 14:30:03 UTC
Responsible Changed
From-To: freebsd-bugs->jhb

John has already made a similar change in HEAD, but the change doesn't 
seem to have been merged onto RELENG_4.
Comment 2 John Baldwin freebsd_committer freebsd_triage 2002-01-09 20:19:36 UTC
On 09-Jan-02 sheldonh@FreeBSD.org wrote:
> Synopsis: kthread_create doesnt mark kthreads as kthreads.
> 
> Responsible-Changed-From-To: freebsd-bugs->jhb
> Responsible-Changed-By: sheldonh
> Responsible-Changed-When: Wed Jan 9 06:30:03 PST 2002
> Responsible-Changed-Why: 
> John has already made a similar change in HEAD, but the change doesn't
> seem to have been merged onto RELENG_4.
> 
> http://www.FreeBSD.org/cgi/query-pr.cgi?pr=33124

This is actually kind of bogus.  Nobody uses this flag except aio, and aio just
sets the flag, no code actually checks it.  P_KTHREAD is a new flag in -current
used in a few places.  Unless the submitter has code that actually checks
P_KTHREADP and needs it set for some reason, I would rather see the flag killed.
One thing that might be nice to MFC is changing aio to use kthread_create
rather than using its own home-rolled version.

-- 

John Baldwin <jhb@FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve!"  -  http://www.FreeBSD.org/
Comment 3 John Baldwin freebsd_committer freebsd_triage 2005-09-02 18:51:55 UTC
State Changed
From-To: open->closed

Fixed in 5.x and later and not going to have time to backport this to 4.x.