I have a problem with schedule() and sys_perf_event_open.

Minwoo Lee ermaker at gmail.com
Mon Mar 14 14:06:10 EDT 2011


Thanks for reply.

2011/3/15 Mulyadi Santosa <mulyadi.santosa at gmail.com>

> Hi Minwoo...
>
> I am not the best... just trying to give idea here...
>
> On Tue, Mar 15, 2011 at 00:03, Minwoo Lee <ermaker at gmail.com> wrote:
> > Hello.
> > I am hacking the kernel source for studying.
> > I just modified schedule() in kernel/sched.c for profiling processes.
>
>
> basic question is: are you sure the cache misses you see during
> schedule is entirely attributed to the soon-to-be-switched-out
> process? have you consider that during that process run time, on going
> interrupts/exception etc could attribute into the cache misses?
>

You're right. This code is wrong. I wrote the code just for checking that
the perf library runs.
The code should be changed to check cache misses while in a slice time(or an
unit time?).
The main problem is, sys_pref_event_open does not return the valid fd.
I have no idea why sys_perf_event_open returns invalid fd.


>
> and about this line:
> BUG_ON(res != sizeof(u64))
>
> not sure if I read it correctly, but previously I see "res" is
> declared as size_t, right?
>

Yes, res is declared as size_t.
Also type of sizeof() is size_t. Isn't it right?
This line assumes that sys_read() read correctly.
This line is from the code in line 227 at tools/perf/builtin-stat.c,

225                         res = read(fd[cpu][counter][thread],
226                                         single_count, nv * sizeof(u64));
227                         assert(res == nv * sizeof(u64));



>
>
>
> --
> regards,
>
> Mulyadi Santosa
> Freelance Linux trainer and consultant
>
> blog: the-hydra.blogspot.com
> training: mulyaditraining.blogspot.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110315/5a6c6918/attachment.html 


More information about the Kernelnewbies mailing list