Messages in this thread | | | Date | Wed, 20 Apr 2011 16:19:14 -0700 (PDT) | From | David Rientjes <> | Subject | Re: [PATCH 1/4] export kernel call get_task_comm(). |
| |
On Wed, 20 Apr 2011, Andrew Morton wrote:
> > > But as David pointed out, if there is work other than mine coming that > > > has already been proposed, wouldn't it be good to get this patch in > > > place now to start the encouragement of future eyes to just call this > > > function than re-invent the wheel? > > > > No, then those projects submit the patch to export this, if they happen > > to get to mainline before this one does. > > > > Again, don't export something unless you are using it at the time, no > > "this is to be used hopefully by something in the future" type stuff > > please. Who knows if those future plans ever pan out. > > Well there's an easy solution here. Send the patch to export > get_task_comm(), then send along some patches which fix > > z:/usr/src/linux-2.6.39-rc4> grep -r 'current->comm' drivers | wc -l > 89 >
If we go this route and continue to support /proc/pid/comm, then we're going to need to ensure nothing that dereferences p->comm for any thread p is in a blockable context and that it's acceptable for get_task_comm(p) to take task_lock(p), and that requires not nesting it with write_lock(&tasklist_lock).
I'm thinking that we're going to want to choose something else other than p->alloc_lock to protect p->comm since that lock is protecting so many different members of struct task_struct that we may not know whether it's held when we want to print p->comm.
| |