Re: How to write a kernel patch to expose a kernel-level function?
- From: Jean-David Beyer <jeandavid8@xxxxxxxxxxx>
- Date: Tue, 31 Jan 2006 13:01:58 GMT
Peter T. Breuer wrote:
> John Hasler <john@xxxxxxxxxx> wrote:
>> hzmonte writes:
>>> What I want, and what smp_processor_id() returns, is which logical
>>> processor the calling thread is running on. Is CPU0, CPU1, or CPU2, for
>>> example?
>
>> Why? Of what possible use could that information be? What problem are you
>> trying to solve?
>
> Dunno. Probably some mistaken idea. But anyway it would be simple to do
> - some ioctl which returns what he wants. But doesn't he have the info
> in proc anyway?
>
How would that do any good? When the process makes the kernel call on ioctl,
a process switch will occur and what would the ioctl return? The
processor-id that the process _used to_ run on, not the one it will run on
once the ioctl returns.
He is doomed. The only way I can think of that will work is to examine the
code of the kernel in the area where process switching occurs. I looked in
there a while ago, and it really tries to return a process to the same
processor it ran on before to try to maintain a high cache hit ratio, but
with the puny caches on my processors (1 Megabit L3 caches) compared to
process sizes (50Megabytes and up for some of the large ones), this may be
of only minor importance.
It depends on the working set size of all the processes currently running. I
have a dbms that runs many processes, and does a lot of IO. Runs pretty well
unless I let BOINC run 4 compute-limited processes at nice 19. Running BOINC
this way should take up all the otherwise unused CPU cycles and not
interfere with the higher priority processes, but it spoils the database
application(s). They try to do a disk write and suspend. Then a BOINC
process runs and dirtys up the caches, so when the IO for the dbms completes
and the dbms process resumes, the cache is completely dirty so it runs at
RAM speeds (533MHz) instead of processor speeds (3.06GHz).
--
.~. Jean-David Beyer Registered Linux User 85642.
/V\ PGP-Key: 9A2FC99A Registered Machine 241939.
/( )\ Shrewsbury, New Jersey http://counter.li.org
^^-^^ 07:50:00 up 10 days, 23:17, 3 users, load average: 4.16, 4.11, 4.03
.
- Follow-Ups:
- References:
- How to write a kernel patch to expose a kernel-level function?
- From: hzmonte
- Re: How to write a kernel patch to expose a kernel-level function?
- From: Tauno Voipio
- Re: How to write a kernel patch to expose a kernel-level function?
- From: hzmonte
- Re: How to write a kernel patch to expose a kernel-level function?
- From: John Hasler
- Re: How to write a kernel patch to expose a kernel-level function?
- From: Peter T. Breuer
- How to write a kernel patch to expose a kernel-level function?
- Prev by Date: Re: Linux Multi-CPU performance
- Next by Date: Re: backups on big, busy, networked drive
- Previous by thread: Re: How to write a kernel patch to expose a kernel-level function?
- Next by thread: Re: How to write a kernel patch to expose a kernel-level function?
- Index(es):
Relevant Pages
|