Wake up sleeping CPU for sched_setaffinity on android

212 Views Asked by At

I work on application which runs several threads, one thread is most important and must run on strongest cpu. I successfully attach this thread to chosen cpu with c++ function sched_setaffinity.

syscallres = syscall(__NR_sched_setaffinity, pid, sizeof(cpu_set), &cpu_set);

On my android device is first cpu strongest, 3 others are weaker and 4 last are power saving. First is strongest and is always on, however based on docs, cpu may sleep and must awaken before I attach the thread to cpu and really, based on posts here on stackoverflow people were not able pin thread to cpu while was sleeping. I cannot simulate it on my device, I always successfully attach thread to picked cpu, maybe it's OS dependent. So my question is, what is correct way for getting cpu on before I call "sched_setaffinity"?

0

There are 0 best solutions below