This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: proc memory statistics tapset
On 10/06/2009 10:25 AM, Mark Wielaard wrote:
>> "Task isn't coopted
>> by a kernel thread" doesn't make sense to me either -- kernel threads
>> have their own current task_struct, represented by that KTHREAD flag.
>
> I am not 100% sure that is correct. Task flags is set the PT_KTHREAD in
> INIT_TASK() before it is fully created. I even extended that check to:
> current->flags & (_STP_PF_KTHREAD | PF_EXITING | PF_STARTING)
> just to be fully paranoid we never query some task-mm struct that isn't
> setup right. Feel free to proof me wrong in being that paranoid :)
INIT_TASK() is not a generic initializer -- it's only used to create the
specific "init_task". Everybody else is copied from their parent in
copy_process().
I think your paranoia is ok to make sure there's a meaningful mm. I was
more interested in what you meant by "coopted by" -- in which cases
could a kernel thread pop in without changing current to itself?
An interrupt handler could be considered such a case, but I don't think
those should be filtered out. A timer.profile fires in softIRQ context,
but it's probably reasonable to profile your memory usage this way.
Even our own trap handlers could be seen as "coopting" the process.
Josh