This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Scheduling / Timeslice

Hello, I have a question regarding timing behaviour especially in SCHED_RR (use an OMAP3).

If there are running 2...5 jobs with same priority - how can I setup (and measure) a timeslice?

I checked some Kernel settings:

CONFIG_OMAP_32K_TIMER_HZ=128 CONFIG_NO_HZ=y CONFIG_HZ=128 CONFIG_TIMERFD=y # CONFIG_OMAP_MPU_TIMER is not set CONFIG_OMAP_32K_TIMER=y CONFIG_OMAP_32K_TIMER_HZ=128 CONFIG_OMAP_DM_TIMER=y CONFIG_HIGH_RES_TIMERS=y

Somewhere I read that the timeslice is 1/HZ -> 1/128 = 7.8ms ? Is this true, or what meaning does this CONFIG_HZ has?

Otherwise CONFIG_NO_HZ is set. What does this mean? How can I get a more predictable behaviour of the system?

  • Arno,

    When CONFIG_NO_HZ is set, what I understand is that kernel is running in tickless mode. Basically if the task queue is empty and idle task is triggered it will remain in idle till a task is queued or an interrupt occurs (not timer). Timer interrupt will not be triggered in this case. This will reduce the frequent wakeup/sleep of kernel even if there are no tasks that are scheduled. It will help saving power. And if there are active tasks I believe clock will tick periodic CONFIG_HZ duration.

    I have played around with CONFIG_HZ and I got good performance improvement when the value is 1000.

  • Thanks for your message.

    I can't found the setting CONFIG_HZ via menuconfig of kernel - it is just there as

    Symbol: HZ [=128] 

    I can found in in the omap3_evm_defconfig I use, but changes there are not affect the .config file I generate. I always thought the the defconfig file is somewhat the main default configuration that can be used as a starting point for changes via menuconfig. 
    Where this is set to 128? Which file I have to change? Does a simple change in .config has effect on building the kernel?

    -regards Arno

  • Arno,

    The value will be hardcoded in arch/arm/Kconfig.

  • Thanks Renjith!

    That's almost true. It is set there, but to the value of CONFIG_OMAP_32K_TIMER_HZ. I didn't found this as there is no CONFIG_HZ entry there.

    HZ is due to this line:

    default OMAP_32K_TIMER_HZ if ARCH_OMAP && OMAP_32K_TIMER

    As the default is set to 128 - is there a need to set it to the power of 2 value? I hope changing this value will not have to many sideeffects - clocks of other interfaces (SPI, I2C shouldn't be affected)

    -Regards Arno

  • Arno,

    There will not be any impact with respect to drivers. Go ahead and change the values.