Sunday, September 11, 2011

Speed Patch !

Posted on 6:41 PM by SlipKoRnSaad

As stated here, The CFS (completely fair scheduler) in our phone's kernel manages the allocation of resources (cpu/mem) between tasks.

It was designed to cope with server-class machines such as web servers and databases, giving all tasks equal access to resources. This means if a server is really busy, then all tasks on the machine slow down equally.

Desktop/mobile class machines shouldn't work the same way as servers though. They have a human user who expects the machine to respond and give feedback within a certain time. If a machine is slow to respond, the user loses some sense of control over the machine.

This patch addresses the problem by taking note of what the user is doing right now, and using that information to accelerate the current task, and decelerate other tasks on the system. The user won't notice the background stuff going slower, they will just see their app working fast.

The patch does this by creating multiple classes of task
-------------------------------------------
/dev/cgroup/cpu/tasks
/dev/cgroup/cpu/desktop/tasks
/dev/cgroup/cpu/applications/tasks
/dev/cgroup/cpu/applications/standby/tasks
/dev/cgroup/cpu/applications/launcher/tasks
-------------------------------------------

If you look at the contents of these files, you'll see the process IDs of all the tasks in each class. CPU and memory are shared out to these classes using the files "cpu.shares", and "memory_limit_in_bytes". When lots of tasks are demanding CPU/memory at once, the resources are handed out to tasks depending on their share.

This is why your phone feels nicer when you have this patch - the kernel automatically classifies tasks and devotes more of cpu/mem to the "application" and "desktop" class tasks, and much less to other classes like "standby".

No Response to "Speed Patch !"

Leave A Reply