Skip to content

Commit

Permalink
config: Switch CONFIG_PREEMPT to CONFIG_PREEMPT_VOLUNTARY
Browse files Browse the repository at this point in the history
See discussion here: #1216
  • Loading branch information
popcornmix committed Dec 15, 2015
1 parent d33d029 commit 853eff4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions arch/arm/configs/bcm2709_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ CONFIG_BCM2709_DT=y
CONFIG_SMP=y
CONFIG_HAVE_ARM_ARCH_TIMER=y
CONFIG_VMSPLIT_2G=y
CONFIG_PREEMPT=y
CONFIG_PREEMPT_VOLUNTARY=y
CONFIG_AEABI=y
CONFIG_OABI_COMPAT=y
CONFIG_CLEANCACHE=y
Expand Down Expand Up @@ -1230,7 +1230,6 @@ CONFIG_BOOT_PRINTK_DELAY=y
CONFIG_DEBUG_MEMORY_INIT=y
CONFIG_DETECT_HUNG_TASK=y
CONFIG_TIMER_STATS=y
# CONFIG_DEBUG_PREEMPT is not set
CONFIG_IRQSOFF_TRACER=y
CONFIG_SCHED_TRACER=y
CONFIG_STACK_TRACER=y
Expand Down
3 changes: 1 addition & 2 deletions arch/arm/configs/bcmrpi_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ CONFIG_MAC_PARTITION=y
CONFIG_CFQ_GROUP_IOSCHED=y
CONFIG_ARCH_BCM2708=y
CONFIG_BCM2708_DT=y
CONFIG_PREEMPT=y
CONFIG_PREEMPT_VOLUNTARY=y
CONFIG_AEABI=y
CONFIG_OABI_COMPAT=y
CONFIG_CLEANCACHE=y
Expand Down Expand Up @@ -1223,7 +1223,6 @@ CONFIG_BOOT_PRINTK_DELAY=y
CONFIG_DEBUG_MEMORY_INIT=y
CONFIG_DETECT_HUNG_TASK=y
CONFIG_TIMER_STATS=y
# CONFIG_DEBUG_PREEMPT is not set
CONFIG_LATENCYTOP=y
CONFIG_IRQSOFF_TRACER=y
CONFIG_SCHED_TRACER=y
Expand Down

6 comments on commit 853eff4

@clivem
Copy link

@clivem clivem commented on 853eff4 Dec 15, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not trying to second guess you, honest...... But are you sure you want to do this without increasing HZ to 200/250/300. I suspect desktop users are not going to thank you for this, switching from full PREEMPT to VOLUNTARY without a corresponding increase in HZ from the default 100HZ.

@Ferroin
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, doing this without a corresponding change in HZ will make latency suffer horribly. It may not seem obvious, but PREEMPT_FULL has been hiding the latency inherent in running with HZ=100 on such a small system (and doing a very good job of it I might add).

Not long after I got my hands on my first Raspberry Pi shortly after the initial production run, I tried running it with PREEMPT_NONE and HZ=100. That attempt ended when I had set /proc/sys/kernel/hung_task_timeout to 7200 (2 hours), and was still getting warnings in the kernel log about hung tasks. With PREEMPT_VOLUNTARY and HZ=100, I had to set it to 1800 (30 minutes) to get the warnings to go away. With PREEMPT_FULL and HZ=100, I still have to set it to 600 (10 minutes) to get the warnings to go away. With PREEMPT_VOLUNTARY and HZ=250, I can get by with about 450 (7.5 minutes).

@popcornmix
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you can find a use case where something obviously goes wrong with this change, then please create a github issue describing how to reproduce.
Ideally start with clean install and type a sequence of commands and get a bad result.

@Ferroin
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's exactly the problem though. Nothing breaks because of this from a purely software focused perspective. No application will stop working as long as you set their timeouts high enough. What breaks is usability for non computationally intensive usage (IOW, for almost everyone out there using a Pi as anything but a compute node in a cluster system).

If you actually look at either of the systems you referenced in your final comment in that thread, they don't just set PREEMPT_VOLUNTARY, they also set a higher HZ, and that's because running anything but PREEMPT_FULL on a low power system like this with HZ=100 results in horrible latency. They can afford to use PREEMPT_VOLUNTARY because they have a higher scheduler frequency, not the other way around.

As I stated in my first comment, the longest running tasks on my Pi when I got it and tested this (in that case, building software packages under Gentoo) tied up the CPU for up to 3 times as long with PREEMPT_VOLUNTARY as they did with PREEMPT_FULL when using HZ=100. The point of /proc/sys/kernel/hung_task_timeout is to warn due to tasks that are stuck in uninterruptible sleep (usually doing I/O) for longer than some threshold. In this case, with PREEMPT_FULL and HZ=100, I had tasks that were stuck doing I/O for almost 10 minutes. With PREEMPT_VOLUNTARY and HZ=100, those same tasks took almost 30 minutes to do the exact same I/O. While they were doing said I/O, the system ran extremely slow (think like using a terminal over a 1200 baud serial line), and was at times completely unresponsive.

@popcornmix
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See if you can reproduce that with latest kernel.
We can try building, say, ffmpeg with -j4 (or higher). If we get hung_task_timeout messages with this update and not without then that will be useful evidence that either this change needs reverting, or HZ needs increasing. But we'd like a reproducible example to help make these decisions.

@Ferroin
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As of right now, I don't have a working system to test on. Once I do, I'll be happy to try and come up with something to deomnstrate this.

That being said, I think it may be more instructive to set hung_task_warning to something lower (the default upstream is 2 minutes, I usually use 2.5 on most of my non-embedded systems), and then count how many warnings are produced. I also think it may be more instructive to build something a bit bigger than ffmpeg (webkit or firefox maybe, or possibly even llvm (although llvm may take days to finish building, a full build takes multiple hours even on fast x86 hardware)).

Please sign in to comment.