* Thread Scheduler
@ 2014-03-19 9:57 Mahmood Naderan
2014-03-19 11:27 ` Mike Galbraith
0 siblings, 1 reply; 11+ messages in thread
From: Mahmood Naderan @ 2014-03-19 9:57 UTC (permalink / raw)
To: LKML
Hi
Maybe this is a noob question...
Where in the linux kernel source (2.6), the
thread scheduler has been implemented? Searching
the web shows that there should sched_fair.c but
I can not find that in the source directory (the
kernel source has been installed).
Basically, I want to know which part of the code
calculated the priorities of the available
threads and select them for running?
Regards,
Mahmood
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Thread Scheduler
2014-03-19 9:57 Thread Scheduler Mahmood Naderan
@ 2014-03-19 11:27 ` Mike Galbraith
2014-03-19 11:34 ` Mahmood Naderan
0 siblings, 1 reply; 11+ messages in thread
From: Mike Galbraith @ 2014-03-19 11:27 UTC (permalink / raw)
To: Mahmood Naderan; +Cc: LKML
On Wed, 2014-03-19 at 02:57 -0700, Mahmood Naderan wrote:
>
> Hi
> Maybe this is a noob question...
> Where in the linux kernel source (2.6), the
>
> thread scheduler has been implemented? Searching
>
> the web shows that there should sched_fair.c but
>
> I can not find that in the source directory (the
> kernel source has been installed).
The scheduler recently moved to kernel/sched directory. For older
kernels, it's kernel/sched_*.
-Mike
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Thread Scheduler
2014-03-19 11:27 ` Mike Galbraith
@ 2014-03-19 11:34 ` Mahmood Naderan
2014-03-19 12:06 ` Jack Carrozzo
0 siblings, 1 reply; 11+ messages in thread
From: Mahmood Naderan @ 2014-03-19 11:34 UTC (permalink / raw)
To: Mike Galbraith; +Cc: LKML
>On Wednesday, March 19, 2014 3:57 PM, Mike Galbraith <umgwanakikbuti@gmail.com> wrote:
>On Wed, 2014-03-19 at 02:57 -0700, Mahmood Naderan wrote:
>>
>> Hi
>> Maybe this is a noob question...
>> Where in the linux kernel source (2.6), the
>>
>> thread scheduler has been implemented? Searching
>>
>> the web shows that there should sched_fair.c but
>>
>> I can not find that in the source directory (the
>> kernel source has been installed).
>
>The scheduler recently moved to kernel/sched directory. For older
>kernels, it's kernel/sched_*.
>
>-Mike
Please see this information
[root@tiger ~]# uname -a
Linux tiger 2.6.32-279.5.1.el6.x86_64 #1 SMP Tue Aug 14 16:11:42 CDT 2012 x86_64 x86_64 x86_64 GNU/Linux
[root@tiger ~]# ls /usr/src/kernels/2.6.32-279.5.1.el6.x86_64/kernel/
events gcov irq Kconfig.freezer Kconfig.hz Kconfig.preempt Makefile power time trace
[root@tiger ~]# cd /usr/src/kernels/2.6.32-279.5.1.el6.x86_64/
[root@tiger 2.6.32-279.5.1.el6.x86_64]# find . -name sched*
./net/sched
./include/asm-generic/bitops/sched.h
./include/config/group/sched.h
./include/config/cgroup/sched.h
./include/config/schedstats.h
./include/config/fair/group/sched.h
./include/config/have/unstable/sched
./include/config/net/sched.h
./include/config/rt/group/sched.h
./include/config/sched
./include/trace/events/sched.h
./include/linux/sched.h
./include/linux/sunrpc/sched.h
Do you mean include/linux/sched.h ?
Where is he implementation then?
Regards,
Mahmood
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Thread Scheduler
2014-03-19 11:34 ` Mahmood Naderan
@ 2014-03-19 12:06 ` Jack Carrozzo
2014-03-19 20:01 ` Mahmood Naderan
0 siblings, 1 reply; 11+ messages in thread
From: Jack Carrozzo @ 2014-03-19 12:06 UTC (permalink / raw)
To: Mahmood Naderan; +Cc: Mike Galbraith, LKML
On Wed, Mar 19, 2014 at 7:34 AM, Mahmood Naderan <nt_mahmood@yahoo.com> wrote:
>
> [...]
> Do you mean include/linux/sched.h ?
> Where is he implementation then?
Your kernel source is incomplete. You can fetch a vanilla kernel
tarball from http://kernel.org.
jackc@kdev0 ~ $ ls /usr/src/linux-2.6.10/kernel/|grep sched
sched.c
jackc@kdev0 ~ $ ls /usr/src/linux-3.13.5/kernel/sched/
auto_group.c completion.c cpuacct.h cputime.c features.h proc.c
stats.c wait.c
auto_group.h core.c cpupri.c debug.c idle_task.c rt.c stats.h
clock.c cpuacct.c cpupri.h fair.c Makefile sched.h
stop_task.c
-J
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Thread Scheduler
2014-03-19 12:06 ` Jack Carrozzo
@ 2014-03-19 20:01 ` Mahmood Naderan
2014-03-20 2:23 ` Mike Galbraith
0 siblings, 1 reply; 11+ messages in thread
From: Mahmood Naderan @ 2014-03-19 20:01 UTC (permalink / raw)
To: Jack Carrozzo; +Cc: Mike Galbraith, LKML
On Wednesday, March 19, 2014 4:36 PM, Jack Carrozzo <jack@crepinc.com> wrote:
>On Wed, Mar 19, 2014 at 7:34 AM, Mahmood Naderan <nt_mahmood@yahoo.com> wrote:
>
>>
>> [...]
>> Do you mean include/linux/sched.h ?
>> Where is he implementation then?
>
>Your kernel source is incomplete. You can fetch a vanilla kernel
>tarball from http://kernel.org.
>
>jackc@kdev0 ~ $ ls /usr/src/linux-2.6.10/kernel/|grep sched
>sched.c
>jackc@kdev0 ~ $ ls /usr/src/linux-3.13.5/kernel/sched/
>auto_group.c completion.c cpuacct.h cputime.c features.h proc.c
>stats.c wait.c
>auto_group.h core.c cpupri.c debug.c idle_task.c rt.c stats.h
>clock.c cpuacct.c cpupri.h fair.c Makefile sched.h
>stop_task.c
>
>-J
OK I installed the full source and now can see the sched*.c files
One more question. Is it possible to dynamically change the scheduling policy, e.g from fair to clock? Basically, I am trying to find the direction on *how to invoke a new scheduling policy*?
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Thread Scheduler
2014-03-19 20:01 ` Mahmood Naderan
@ 2014-03-20 2:23 ` Mike Galbraith
2014-03-23 11:01 ` Mahmood Naderan
0 siblings, 1 reply; 11+ messages in thread
From: Mike Galbraith @ 2014-03-20 2:23 UTC (permalink / raw)
To: Mahmood Naderan; +Cc: Jack Carrozzo, LKML
On Wed, 2014-03-19 at 13:01 -0700, Mahmood Naderan wrote:
>
> One more question. Is it possible to dynamically change the scheduling
> policy, e.g from fair to clock?
marge:~ # man -k setscheduler getscheduler
sched_setscheduler (2) - set and get scheduling policy/parameters
sched_setscheduler (3p) - set scheduling policy and parameters (REALTIME)
sched_getscheduler (2) - set and get scheduling policy/parameters
sched_getscheduler (3p) - get scheduling policy (REALTIME)
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Thread Scheduler
2014-03-20 2:23 ` Mike Galbraith
@ 2014-03-23 11:01 ` Mahmood Naderan
2014-03-23 14:05 ` Mark Knecht
2014-03-24 20:30 ` Andreas Mohr
0 siblings, 2 replies; 11+ messages in thread
From: Mahmood Naderan @ 2014-03-23 11:01 UTC (permalink / raw)
To: Mike Galbraith; +Cc: Jack Carrozzo, LKML
>On Thursday, March 20, 2014 6:53 AM, Mike Galbraith <umgwanakikbuti@gmail.com> wrote:
>
>marge:~ # man -k setscheduler getscheduler
>sched_setscheduler (2) - set and get scheduling policy/parameters
>sched_setscheduler (3p) - set scheduling policy and parameters (REALTIME)
>sched_getscheduler (2) - set and get scheduling policy/parameters
>sched_getscheduler (3p) - get scheduling policy (REALTIME)
OK I read them and it seems that in order to change the scheduler, I have to write a C code and call the sched_set* functions. Please correct that if I am wrong.
So in order to use my custom scheduler, I have to do the following steps.
1- Write my code using the APIs and save that in kernel/sched_custom.c
2- Invoke sched_custom.c in kernel/sched.c
3- Recompile the kernel source
4- Reboot using the new kernel
5- write a C code and call sched_setschedule() to use my scheduler.
Is that all? Your reply is appreciated.
Regards,
Mahmood
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Thread Scheduler
2014-03-23 11:01 ` Mahmood Naderan
@ 2014-03-23 14:05 ` Mark Knecht
2014-03-23 14:27 ` Mahmood Naderan
2014-03-24 20:30 ` Andreas Mohr
1 sibling, 1 reply; 11+ messages in thread
From: Mark Knecht @ 2014-03-23 14:05 UTC (permalink / raw)
To: Mahmood Naderan; +Cc: Mike Galbraith, Jack Carrozzo, LKML
On Sun, Mar 23, 2014 at 4:01 AM, Mahmood Naderan <nt_mahmood@yahoo.com> wrote:
>
>
>
>
>
>
>>On Thursday, March 20, 2014 6:53 AM, Mike Galbraith <umgwanakikbuti@gmail.com> wrote:
>>
>>marge:~ # man -k setscheduler getscheduler
>>sched_setscheduler (2) - set and get scheduling policy/parameters
>>sched_setscheduler (3p) - set scheduling policy and parameters (REALTIME)
>>sched_getscheduler (2) - set and get scheduling policy/parameters
>>sched_getscheduler (3p) - get scheduling policy (REALTIME)
>
>
>
>
>
> OK I read them and it seems that in order to change the scheduler, I have to write a C code and call the sched_set* functions. Please correct that if I am wrong.
>
> So in order to use my custom scheduler, I have to do the following steps.
>
> 1- Write my code using the APIs and save that in kernel/sched_custom.c
> 2- Invoke sched_custom.c in kernel/sched.c
> 3- Recompile the kernel source
> 4- Reboot using the new kernel
> 5- write a C code and call sched_setschedule() to use my scheduler.
>
> Is that all? Your reply is appreciated.
>
>
> Regards,
> Mahmood
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
In terms of changing the scheduler I think that you possibly missed
reading Documentation/block/switching-sched.txt in the kernel's
documentation directory.
HTH,
Mark
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Thread Scheduler
2014-03-23 14:05 ` Mark Knecht
@ 2014-03-23 14:27 ` Mahmood Naderan
2014-03-23 15:04 ` Mark Knecht
0 siblings, 1 reply; 11+ messages in thread
From: Mahmood Naderan @ 2014-03-23 14:27 UTC (permalink / raw)
To: Mark Knecht; +Cc: Mike Galbraith, Jack Carrozzo, LKML
On Sunday, March 23, 2014 6:35 PM, Mark Knecht <markknecht@gmail.com> wrote:
>In terms of changing the scheduler I think that you possibly missed
>reading Documentation/block/switching-sched.txt in the kernel's
>documentation directory.
>
>HTH,
>Mark
That is IO scheduler. Can we use the same for threads/processes?
echo deadline > /proc/10100
Or something like that?
Regards,
Mahmood
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Thread Scheduler
2014-03-23 14:27 ` Mahmood Naderan
@ 2014-03-23 15:04 ` Mark Knecht
0 siblings, 0 replies; 11+ messages in thread
From: Mark Knecht @ 2014-03-23 15:04 UTC (permalink / raw)
To: Mahmood Naderan; +Cc: Mike Galbraith, Jack Carrozzo, LKML
On Sun, Mar 23, 2014 at 7:27 AM, Mahmood Naderan <nt_mahmood@yahoo.com> wrote:
>
>
>
>
> On Sunday, March 23, 2014 6:35 PM, Mark Knecht <markknecht@gmail.com> wrote:
>>In terms of changing the scheduler I think that you possibly missed
>>reading Documentation/block/switching-sched.txt in the kernel's
>>documentation directory.
>>
>>HTH,
>>Mark
>
> That is IO scheduler. Can we use the same for threads/processes?
> echo deadline > /proc/10100
>
> Or something like that?
>
>
>
> Regards,
> Mahmood
>
Sorry, you're right. My mistake.
- Mark
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Thread Scheduler
2014-03-23 11:01 ` Mahmood Naderan
2014-03-23 14:05 ` Mark Knecht
@ 2014-03-24 20:30 ` Andreas Mohr
1 sibling, 0 replies; 11+ messages in thread
From: Andreas Mohr @ 2014-03-24 20:30 UTC (permalink / raw)
To: Mahmood Naderan; +Cc: Mike Galbraith, Jack Carrozzo, LKML
Hi,
> OK I read them and it seems that in order to change the scheduler, I have to write a C code and call the sched_set* functions. Please correct that if I am wrong.
>
> So in order to use my custom scheduler, I have to do the following steps.
>
> 1- Write my code using the APIs and save that in kernel/sched_custom.c
> 2- Invoke sched_custom.c in kernel/sched.c
> 3- Recompile the kernel source
> 4- Reboot using the new kernel
> 5- write a C code and call sched_setschedule() to use my scheduler.
>
> Is that all? Your reply is appreciated.
No, AFAIK these are *user-space* APIs, thus they're supposed to be used by
applications (correct me if I'm wrong).
So the question would be what exactly you're trying to achieve:
either you want to actively modify the kernel-side scheduler sources,
in which case these APIs probably are not what you want (to use there),
or you're trying to modify scheduling configuration of user-space applications,
in which case they possibly are.
Or you want both, in which case you probably
modify kernel scheduler implementation *and* use sched_*() in user-space
with the intent to ensure that that modified scheduler implementation
gets chosen.
HTH,
Andreas Mohr
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2014-03-24 20:30 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-19 9:57 Thread Scheduler Mahmood Naderan
2014-03-19 11:27 ` Mike Galbraith
2014-03-19 11:34 ` Mahmood Naderan
2014-03-19 12:06 ` Jack Carrozzo
2014-03-19 20:01 ` Mahmood Naderan
2014-03-20 2:23 ` Mike Galbraith
2014-03-23 11:01 ` Mahmood Naderan
2014-03-23 14:05 ` Mark Knecht
2014-03-23 14:27 ` Mahmood Naderan
2014-03-23 15:04 ` Mark Knecht
2014-03-24 20:30 ` Andreas Mohr
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).