[sugar] [RFC] teach sugar to update oom_adj

Joshua N Pritikin jpritikin
Sat Feb 17 10:22:44 EST 2007


On Sat, Feb 17, 2007 at 02:55:26PM +0100, Marco Pesenti Gritti wrote:
> On Sat, 2007-02-17 at 16:24 +0530, Joshua N Pritikin wrote:
> > This is my first real patch for sugar. Does it look OK? Did I add code 
> > in the appropriate place? FYI, this patch is in reference to:
> > 
> > http://www.redhat.com/archives/olpc-software/2006-March/msg00205.html
> > http://www.redhat.com/archives/olpc-software/2006-March/msg00227.html
> > 
> > Currently the write fails with "Operation not permitted." I presume some 
> > minor tweaks to the kernel are necessary?
> 
> Can you summarize the purpose of the patch? (and possibly the outcomes
> of the mail thread).

The XO only has 128M of RAM and little or no swap. Even if there are no 
bugs in the software, it is certain that the oom_killer will be 
triggered during normal operation. When that happens, we need to take 
extra care about which process we kill. The idea discussed in the thread 
above is to tell the kernel to kill processes in approximately this 
order:

1. Activities which are not in the foreground
2. The current activity
3. Everything else

My patch takes two steps in this direction:

1. I added a method to Activity so sugar can find out the PID of an 
activity (is there a better way?).

2. Whenever the current activity changes, sugar sets (tries to set) 
oom_adj for the past and future current activity.

-- 
Make April 15 just another day, visit http://fairtax.org


More information about the Sugar-devel mailing list