linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* changing timeslice in linux
@ 2012-08-19 18:58 Xin Tong
  2012-08-20  5:54 ` Mike Galbraith
  0 siblings, 1 reply; 6+ messages in thread
From: Xin Tong @ 2012-08-19 18:58 UTC (permalink / raw)
  To: linux-kernel

I have 2 questions about linux 2.6 x86_64 scheduler.

1. is the default scheduling algorithm SCHED_NORMAL in linux ?
2. how do i change the time slice in linux source code ?

Xin

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: changing timeslice in linux
  2012-08-19 18:58 changing timeslice in linux Xin Tong
@ 2012-08-20  5:54 ` Mike Galbraith
  2012-08-20 14:51   ` Xin Tong
  0 siblings, 1 reply; 6+ messages in thread
From: Mike Galbraith @ 2012-08-20  5:54 UTC (permalink / raw)
  To: Xin Tong; +Cc: linux-kernel

On Sun, 2012-08-19 at 11:58 -0700, Xin Tong wrote: 
> I have 2 questions about linux 2.6 x86_64 scheduler.
> 
> 1. is the default scheduling algorithm SCHED_NORMAL in linux ?

Yes.

> 2. how do i change the time slice in linux source code ?

You shouldn't need to.  You can tune "slice" by adjusting
sched_latency_ns and sched_min_granularity_ns, but note that "slice" is
not a fixed quantum.  Also note that CFS preemption decisions are based
upon instantaneous state.  A task may have received a full (variable)
"slice" of CPU time, but preemption will be triggered only if a more
deserving task is available, so a "slice" is not the "max uninterrupted
CPU time" that you may expect it to be.. but it is somewhat similar.

-Mike


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: changing timeslice in linux
  2012-08-20  5:54 ` Mike Galbraith
@ 2012-08-20 14:51   ` Xin Tong
  2012-08-21  0:16     ` Namhyung Kim
  0 siblings, 1 reply; 6+ messages in thread
From: Xin Tong @ 2012-08-20 14:51 UTC (permalink / raw)
  To: Mike Galbraith; +Cc: linux-kernel

On Sun, Aug 19, 2012 at 10:54 PM, Mike Galbraith <efault@gmx.de> wrote:
> On Sun, 2012-08-19 at 11:58 -0700, Xin Tong wrote:
>> I have 2 questions about linux 2.6 x86_64 scheduler.
>>
>> 1. is the default scheduling algorithm SCHED_NORMAL in linux ?
>
> Yes.
Is there any document describing what the sched_normal is ? it is more
difficult than SCHED_RR to infer its meaning just based on its name ?
>
>> 2. how do i change the time slice in linux source code ?
>
> You shouldn't need to.  You can tune "slice" by adjusting
> sched_latency_ns and sched_min_granularity_ns, but note that "slice" is
> not a fixed quantum.  Also note that CFS preemption decisions are based
> upon instantaneous state.  A task may have received a full (variable)
> "slice" of CPU time, but preemption will be triggered only if a more
> deserving task is available, so a "slice" is not the "max uninterrupted
> CPU time" that you may expect it to be.. but it is somewhat similar.
>
> -Mike
>
This can be done without recompiling and reinstalling the kernel ?
maybe one simply needs to write to a device file under /dev ?

Xin

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: changing timeslice in linux
  2012-08-20 14:51   ` Xin Tong
@ 2012-08-21  0:16     ` Namhyung Kim
  2012-08-28 20:15       ` Xin Tong
  0 siblings, 1 reply; 6+ messages in thread
From: Namhyung Kim @ 2012-08-21  0:16 UTC (permalink / raw)
  To: Xin Tong; +Cc: Mike Galbraith, linux-kernel

On Mon, 20 Aug 2012 07:51:52 -0700, Xin Tong wrote:
> On Sun, Aug 19, 2012 at 10:54 PM, Mike Galbraith <efault@gmx.de> wrote:
>> On Sun, 2012-08-19 at 11:58 -0700, Xin Tong wrote:
>>> I have 2 questions about linux 2.6 x86_64 scheduler.
>>>
>>> 1. is the default scheduling algorithm SCHED_NORMAL in linux ?
>>
>> Yes.
> Is there any document describing what the sched_normal is ? it is more
> difficult than SCHED_RR to infer its meaning just based on its name ?
>>
>>> 2. how do i change the time slice in linux source code ?
>>
>> You shouldn't need to.  You can tune "slice" by adjusting
>> sched_latency_ns and sched_min_granularity_ns, but note that "slice" is
>> not a fixed quantum.  Also note that CFS preemption decisions are based
>> upon instantaneous state.  A task may have received a full (variable)
>> "slice" of CPU time, but preemption will be triggered only if a more
>> deserving task is available, so a "slice" is not the "max uninterrupted
>> CPU time" that you may expect it to be.. but it is somewhat similar.
>>
>> -Mike
>>
> This can be done without recompiling and reinstalling the kernel ?
> maybe one simply needs to write to a device file under /dev ?

You can find those files under /proc/sys/kernel/.

Thanks,
Namhyung

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: changing timeslice in linux
  2012-08-21  0:16     ` Namhyung Kim
@ 2012-08-28 20:15       ` Xin Tong
  2012-08-28 20:16         ` Xin Tong
  0 siblings, 1 reply; 6+ messages in thread
From: Xin Tong @ 2012-08-28 20:15 UTC (permalink / raw)
  To: Namhyung Kim; +Cc: Mike Galbraith, linux-kernel

i changed the TIMESLICE defined in the sched.c

  109 /*
  110  * These are the 'tuning knobs' of the scheduler:
  111  *
  112  * default timeslice is 100 msecs (used only for SCHED_RR tasks).
  113  * Timeslices get refilled after they expire.
  114  */
  115 #define DEF_TIMESLICE           (20 * HZ / 1000)


I compiled and installed the modified kernel, but when i looked at the
, i get a different number

root@elm:~# cat /proc/sys/kernel/sched_rt_period_us
1000000


Xin

On Mon, Aug 20, 2012 at 5:16 PM, Namhyung Kim <namhyung@kernel.org> wrote:
> On Mon, 20 Aug 2012 07:51:52 -0700, Xin Tong wrote:
>> On Sun, Aug 19, 2012 at 10:54 PM, Mike Galbraith <efault@gmx.de> wrote:
>>> On Sun, 2012-08-19 at 11:58 -0700, Xin Tong wrote:
>>>> I have 2 questions about linux 2.6 x86_64 scheduler.
>>>>
>>>> 1. is the default scheduling algorithm SCHED_NORMAL in linux ?
>>>
>>> Yes.
>> Is there any document describing what the sched_normal is ? it is more
>> difficult than SCHED_RR to infer its meaning just based on its name ?
>>>
>>>> 2. how do i change the time slice in linux source code ?
>>>
>>> You shouldn't need to.  You can tune "slice" by adjusting
>>> sched_latency_ns and sched_min_granularity_ns, but note that "slice" is
>>> not a fixed quantum.  Also note that CFS preemption decisions are based
>>> upon instantaneous state.  A task may have received a full (variable)
>>> "slice" of CPU time, but preemption will be triggered only if a more
>>> deserving task is available, so a "slice" is not the "max uninterrupted
>>> CPU time" that you may expect it to be.. but it is somewhat similar.
>>>
>>> -Mike
>>>
>> This can be done without recompiling and reinstalling the kernel ?
>> maybe one simply needs to write to a device file under /dev ?
>
> You can find those files under /proc/sys/kernel/.
>
> Thanks,
> Namhyung

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: changing timeslice in linux
  2012-08-28 20:15       ` Xin Tong
@ 2012-08-28 20:16         ` Xin Tong
  0 siblings, 0 replies; 6+ messages in thread
From: Xin Tong @ 2012-08-28 20:16 UTC (permalink / raw)
  To: Namhyung Kim; +Cc: Mike Galbraith, linux-kernel

another question is that when i try to launch many (24) RT processes.
some of them do not seem to get scheduled. i query their scheduling
properties. they all have SCHED_RR with priority 99, but some of them
simply are not taking any CPU.

Xin


On Tue, Aug 28, 2012 at 1:15 PM, Xin Tong <xerox.time.tech@gmail.com> wrote:
> i changed the TIMESLICE defined in the sched.c
>
>   109 /*
>   110  * These are the 'tuning knobs' of the scheduler:
>   111  *
>   112  * default timeslice is 100 msecs (used only for SCHED_RR tasks).
>   113  * Timeslices get refilled after they expire.
>   114  */
>   115 #define DEF_TIMESLICE           (20 * HZ / 1000)
>
>
> I compiled and installed the modified kernel, but when i looked at the
> , i get a different number
>
> root@elm:~# cat /proc/sys/kernel/sched_rt_period_us
> 1000000
>
>
> Xin
>
> On Mon, Aug 20, 2012 at 5:16 PM, Namhyung Kim <namhyung@kernel.org> wrote:
>> On Mon, 20 Aug 2012 07:51:52 -0700, Xin Tong wrote:
>>> On Sun, Aug 19, 2012 at 10:54 PM, Mike Galbraith <efault@gmx.de> wrote:
>>>> On Sun, 2012-08-19 at 11:58 -0700, Xin Tong wrote:
>>>>> I have 2 questions about linux 2.6 x86_64 scheduler.
>>>>>
>>>>> 1. is the default scheduling algorithm SCHED_NORMAL in linux ?
>>>>
>>>> Yes.
>>> Is there any document describing what the sched_normal is ? it is more
>>> difficult than SCHED_RR to infer its meaning just based on its name ?
>>>>
>>>>> 2. how do i change the time slice in linux source code ?
>>>>
>>>> You shouldn't need to.  You can tune "slice" by adjusting
>>>> sched_latency_ns and sched_min_granularity_ns, but note that "slice" is
>>>> not a fixed quantum.  Also note that CFS preemption decisions are based
>>>> upon instantaneous state.  A task may have received a full (variable)
>>>> "slice" of CPU time, but preemption will be triggered only if a more
>>>> deserving task is available, so a "slice" is not the "max uninterrupted
>>>> CPU time" that you may expect it to be.. but it is somewhat similar.
>>>>
>>>> -Mike
>>>>
>>> This can be done without recompiling and reinstalling the kernel ?
>>> maybe one simply needs to write to a device file under /dev ?
>>
>> You can find those files under /proc/sys/kernel/.
>>
>> Thanks,
>> Namhyung

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-08-28 20:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-19 18:58 changing timeslice in linux Xin Tong
2012-08-20  5:54 ` Mike Galbraith
2012-08-20 14:51   ` Xin Tong
2012-08-21  0:16     ` Namhyung Kim
2012-08-28 20:15       ` Xin Tong
2012-08-28 20:16         ` Xin Tong

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).