View Single Post
Posts: 34 | Thanked: 50 times | Joined on Jun 2010
#690
Hi Guys,

There seems to have been some confusion lately about how the various bits of this script work, and how they're executed by maemo.

First point - rc.local doesn't do anything on an n900. The "speedpatch.sh" file in the current patch creates rc.local and .bashrc, neither of which will be executed in normal operation of the phone. Instead, /etc/event.d/speedpatch does all the work. Drop speedpatch.sh, it's dead weight.

Second point - there doesn't seem to be a lot of info on this thread about how the patch actually works, so here goes with a quick explanation.

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

The Following 12 Users Say Thank You to thingonaspring For This Useful Post: