You are not logged in.

#1 2012-06-26 14:44:26

kfpanda
Member
Registered: 2012-06-26
Posts: 4

How to execute something on a specified CPU

I want to write a simple test bash script which implements a function on the CPU of my choice.
How do I specify the function and the target CPU ?
Thank you

Offline

#2 2012-06-26 18:18:30

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: How to execute something on a specified CPU

Offline

#3 2012-06-26 18:45:31

kfpanda
Member
Registered: 2012-06-26
Posts: 4

Re: How to execute something on a specified CPU

I wrote a kernel module and am using the functions sched_setaffinity() to  the affinity .. I have included "linux/sched.h" in the kernel module
However when I build the module, I am get the error that the sched_setaffinity() is undefined.
What might be the solution ?Thank you

Offline

#4 2012-06-26 18:58:36

Cloudef
Member
Registered: 2010-10-12
Posts: 636

Re: How to execute something on a specified CPU

@kfpanda try defining _GNU_SOURCE before including <sched.h>

Last edited by Cloudef (2012-06-26 19:00:53)

Offline

#5 2012-06-26 21:59:50

kfpanda
Member
Registered: 2012-06-26
Posts: 4

Re: How to execute something on a specified CPU

I discovered the solution to my problem. I needed the kernel to have these function symbols sched_setaffinity to be exported

Offline

#6 2012-06-27 20:47:04

Darksoul71
Member
Registered: 2010-04-12
Posts: 319

Re: How to execute something on a specified CPU

Please do not forget to add solved to your title.
Thanks...


My archlinux x86_64 host:
AMD E350 (2x1.6GHz) / 8GB DDR3 RAM / GeForce 9500GT (passive) / Arch running from 16GB USB Stick

Offline

Board footer

Powered by FluxBB