How to configure the standard kernel scheduler (CFS) to behave more like BFS

Search This thread


Senior Member
Dec 7, 2009
First an introduction (sorry, if this got a little long, just wanted to make clear for everybody what we are talking about).

What is a scheduler?
The scheduler is a built-in part of the Linux kernel. It is that part of the kernel which decides how the available cpu power is divided among all running processes. As the cpu can only work for one process at any given time, the scheduler is responsible to assign cpu time-slices fairly to running processes.

Because of this the scheduler (among other things) plays an essential role on how responsive a system "feels" for the user. That's because responsiveness depends among other things on the time how long it takes from user input until the cpu handles the input (i.e. until "your" task/process gets cpu-cycles).

Current state of the art:
The standard Linux kernel uses the so called "Completely Fair Scheduler" (CFS) since some time (October 2007) now and seems to be useful for most use-cases (server, desktop, smartphone..).

As you may have already heard, since August 2009 there is a new player on the field, namely the "Brain **** Scheduler" (BFS). BFS promises some better latency behaviour on smaller platforms with fewer cpu-cores and mobile devices. Altough it wasn't accepted into the official Linux kernel tree, it was used by cyanogen and also adopted by Google into the mainline Android kernel (and as we are having kernel sources now, I'm sure you will see some more BFS-enabled kernels for the Hero, too).

But back to topic:
So, what I am going to talk about applies to those of you who DON'T have a kernel with the BSF scheduler (i.e. which have the standard CFS scheduler) which should be the majority of ROMs at the moment.

Tuning the CFS scheduler:
Even it's said that BFS may be better for small devices it's also possible to configure CFS for our needs:

While searching around I learned that the behaviour of the CFS scheduler can be influenced at runtime by a few parameters. All these settings can be applied at runtime and will be gone after a reboot. So it is safe to play around a little bit.

One interesting parameter I found was "NO_NEW_FAIR_SLEEPERS". As stated by some people on the Linux kernel mailinglist :

NO_NEW_FAIR_SLEEPERS is something that will turn the scheduler into a more classic fair scheduler (like BFS is too)

If this is true, maybe it will let the CFS behave better optimized for small devices.

But let's try it out! Let's see if it gives us some improvements. :)

How to to this:
# Step 1: Mount debugfs (which is a virtual filesystem like /proc/ or /sys/)
mount -t debugfs none /sys/kernel/debug

# Step 2 (optional): Display the current scheduler flags
cat /sys/kernel/debug/sched_features

# Step 3: Set the flag NO_NEW_FAIR_SLEEPERS
echo "NO_NEW_FAIR_SLEEPERS" > /sys/kernel/debug/sched_features

# Step 4: Unmount debugfs again
umount /sys/kernel/debug

As said before: These changes are NOT PERMANENT. They will be gone after a reboot. But therefore it's safe to play around here.

Tuning the scheduler will not give you plain speed improvements, so testing with Linpack is useless here. Instead it changes the way how the system reacts if there is a lot of multi-tasking.
So when you have changed the settings try testing around a little bit when the system is under load (like playing music while doing CPU intensive stuff or things like that) and report if it behaves better/worse than with default settings.

How to undo the setting:
Simple reboot your phone.
Or redo the steps above and replace the command in Step 3 with this one (note that the prefix "NO_" is ommited here):

echo "NEW_FAIR_SLEEPERS" > /sys/kernel/debug/sched_features

Feel free to test and share your findings! :)


I guess I can copy paste the lines and use GScript to run them.

Any way to make this permanent? Put something in init.d maybe?


Senior Member
Dec 7, 2009
I guess I can copy paste the lines and use GScript to run them.

Of course. You will find 2 scripts for gscript in the attached zip-file:

So you can simply switch for easy testing.

For those who don't know GScript: It's an app from the market to easily execute scripts on your phone. Pretty handy if you are testing things before you add them to an init-script.

  • Install "GScript Lite" from the market
  • Unzip the 2 scripts and place it on the sd-card into the folder gscript
  • Launch GScript Lite, press "Menu" -> "Add script" -> "Load file" and select the scripts you just placed into "gscript" folder.
  • Make sure the "Need SU?" checkbox is checked and press "Save"
  • Tap on the script to launch it.

Any way to make this permanent? Put something in init.d maybe?
Correct. You would need to place the commands into an init script, which are located in "/system/etc/init.d" on most ROMs.


    724 bytes · Views: 337


Senior Member
Dec 7, 2009
Hard to test.. :)

I underclocked my Hero to 245Mhz, started the music player, launched NeoCore benchmark and via adb launched 10 instances of "md5sum /dev/urandom".

Music still not choppy. No matter whether the tweak is enabled or disabled.

The scheduler seems too good to exploit it.. :)

just got a NeoCore benchmark if 02.8 FPS :) Yeahh, that's stresstesting..


Senior Member
Jul 12, 2010
Wow! Thanks for the tip. After reading it sparked my curiosity in the Linux kernel so I went hunting on the web for more detailed info on this particular parameter (NEW_FAIR_SLEEPERS) but I found no useful info as to what exactly it is or what it does. unfortunately, the name doesnt give too much away either (to the layman).

Anyway eventually I came across a site that a couple of other SLEEPER parameters are mentioned. and it claimed that tweaking these as well as changing the sched_latency and sched_granulairty parameters will enhance android phone performance. Again I searched for explanations of these parameters but to no avail (im obviously not very good at searching!). In the end I thought id just apply the tweaks and see what happened. and voila! the phone is the smoothest I have ever felt it!

As I said I dont know which tweak is responsible for the smoothness or if its just a combination of all three but my phone is really nice to use now. I can scroll long lists and actually see scrolling instead of a stutter from start to finish! I am running elelinux 1.8 and flykernel10a at 528MHz and its smoother than i've had it when running at > 600MHz.

I have no idea what implications the changes have on the overall performance of the phone but its smooth and not overclocked! cant be bad??

so heres the changes I applied: (from ./adb shell or terminal emulator on phone)
$ su
# mount -o remount,rw /system
# echo 'kernel.sched_latency_ns = 600000' >> /etc/sysctl.conf
# echo 'kernel.sched_min_granularity_ns = 400000' >> /etc/sysctl.conf
# echo 'kernel.sched_features = 24188' >> /etc/sysctl.conf
# mount -o remount,ro /system
# sysctl -p
kernel.sched_latency_ns = 600000
kernel.sched_min_granularity_ns = 400000
kernel.sched_features = 24188
# exit
$ exit

the 24188 parameter disables a couple of sleepers and the other two change some timings in the kernel. The changes are supposedly ONLY suitable for non-BFS kernels. but they are supposed to make the CFS kernel behave more like the BFS kernel in general.

Anyway try it and see if you want and report back if it makes your phone any better or worse. Or if there are any Linux gurus maybe you can shed more light on what these parameters actually do.


Senior Member
Jan 31, 2009
I know this thread is a little old, but I wanted to report that those settings worked great on my MyTouch Slide! I'm also overclocked/underclocked to 825/245 and using the autokiller memory optimizer, with the settings you suggest my phone is amazingly fast!

I did a little research on these settings as well, and will report back as I do some more testing to see what works best with the specs in this specific phone. At that time I will post a link to a new thread on this in the section for my specific phone.

Thanks for the great tips! :cool:
Our Apps
Get our official app!
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone