change kthread priority
From: loody <hidden>
Date: 2011-07-11 03:55:46
hi: 2011/7/11 Mulyadi Santosa [off-list ref]:
Hi... On Sun, Jul 10, 2011 at ?is 17:27, loody [off-list ref] wrote:quoted
Dear all: I have some questions about kthread: 1. can we change kthread priority through user mode program?Theoritically you can, but only if the priority not fixed and/or you have required capability to do soquoted
2. I found some functions that may be helpful. sched_getscheduler sched_setscheduler When I use them in user mode, the return value of sched_setscheduler ?is fail.did you do that as root? anything blocking you doing that withing SELinux or AppArmor policy?
I execute it as root. what is "SELinux or AppArmor policy"?
quoted
there is a thread talking about this, http://www.spinics.net/lists/linux-rt-users/msg06588.html What makes me confuse is "these 2 functions is used in user mode or kernel mode?"AFAIK they are user mode libc functions...
I found there are the same export_symbols in kernel. I use them to dynamically change the priority. It works but I found something interesting: 1. if thread use schedule algorithm of SCHED_NORMAL, it cannot change the priority. 2. can we set the priority to any number less than (MAX_USER_RT_PRIO-1)? ( I tried to set the priority as 99, but it fail) 3. can we get the name of thread from task_struct or pid? (I use "cat /proc/338/status", I can see the name of thread. But I look around the task_struct, I cannot find any name information in it.) Thanks for your kind help,