From: "Frédéric Weisbecker" <fweisbec@gmail.com>
To: "Ingo Molnar" <mingo@elte.hu>
Cc: "Steven Rostedt" <rostedt@goodmis.org>,
"Linux Kernel" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 3/3] tracing/function-return-tracer: add the overrun field
Date: Fri, 21 Nov 2008 21:07:33 +0100 [thread overview]
Message-ID: <c62985530811211207s730d269ahdaadd6978bd4e6e5@mail.gmail.com> (raw)
In-Reply-To: <20081121194819.GA568@elte.hu>
2008/11/21 Ingo Molnar <mingo@elte.hu>:
>
> * Frédéric Weisbecker <fweisbec@gmail.com> wrote:
>
>> When the tracer will be launched, I will hold the tasklist_lock to
>> allocate/insert the dynamic arrays. So in this atomic context, I
>> will not be able to call kmalloc with GFP_KERNEL. And I fear that
>> using GFP_ATOMIC for possible hundreds of tasks would be clearly
>> unacceptable.
>>
>> What do you think of this way:
>>
>> _tracer activates
>> _a function enters the tracer entry-hooker. If the array is allocated
>> for the current task, that's well. If not I launch a kernel thread
>> that will later allocate an array for the current task (I will pass
>> the pid as a parameter). So the current task will be soon be traced.
>> _ when a process forks, I can allocate a dynamic array for the new
>> task without problem (I hope).
>>
>> So some tasks will not be traced at the early beggining of tracing
>> but they will soon all be traced.... There is perhaps a problem with
>> tasks that are sleeping for long times... There will be some losses
>> once they will be awaken...
>
> i'd suggest a different approach that is simpler:
>
> - step0: set flag that "all newly created tasks need the array
> allocated from now on".
>
> - step1: allocate N arrays outside tasklist_lock
>
> - step2: take tasklist_lock, loop over all tasks that exist and pass
> in the N arrays to all tasks that still need it.
>
> If tasks were 'refilled', drop tasklist_lock and go back to step 1.
>
> - step3: free N (superfluously allocated) arrays
>
> Make N something like 32 to not get into a bad quadratic nr_tasks
> double loop in practice. (Possibly allocate arrays[32] dynamically as
> well at step0 and not have it on the kernel stack - so 32 can be
> changed to 128 or so.)
>
> Ingo
>
Ok. I thought about this method but wondered about the fact that
kmalloc can schedule and then I could run in an infinite loop (or a
too long one).
I will try this. Thanks.
next prev parent reply other threads:[~2008-11-21 20:07 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-17 2:22 [PATCH 3/3] tracing/function-return-tracer: add the overrun field Frederic Weisbecker
2008-11-17 8:49 ` Ingo Molnar
2008-11-17 18:38 ` Frederic Weisbecker
2008-11-18 8:47 ` Ingo Molnar
2008-11-18 14:23 ` Steven Rostedt
2008-11-18 14:51 ` Ingo Molnar
2008-11-18 15:06 ` Steven Rostedt
2008-11-18 15:13 ` Ingo Molnar
2008-11-18 15:22 ` Steven Rostedt
2008-11-18 15:50 ` Ingo Molnar
2008-11-18 16:31 ` Frédéric Weisbecker
2008-11-18 16:40 ` Ingo Molnar
2008-11-18 16:47 ` Frédéric Weisbecker
2008-11-18 16:53 ` Steven Rostedt
2008-11-18 16:58 ` Frédéric Weisbecker
2008-11-18 17:00 ` Frédéric Weisbecker
2008-11-18 21:01 ` Ingo Molnar
2008-11-18 21:03 ` Ingo Molnar
2008-11-19 7:35 ` Frédéric Weisbecker
2008-11-21 19:39 ` Frédéric Weisbecker
2008-11-21 19:48 ` Ingo Molnar
2008-11-21 20:07 ` Frédéric Weisbecker [this message]
2008-11-23 13:18 ` Ingo Molnar
2008-11-18 16:43 ` Steven Rostedt
2008-11-18 14:21 ` Steven Rostedt
2008-11-18 14:48 ` Ingo Molnar
2008-11-18 14:58 ` Steven Rostedt
2008-11-18 15:02 ` Ingo Molnar
2008-11-18 15:11 ` Steven Rostedt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c62985530811211207s730d269ahdaadd6978bd4e6e5@mail.gmail.com \
--to=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=rostedt@goodmis.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.