[Trac #939] Can save much memory by running a simple display manager
Zarro Boogs per Child
bugtracker at laptop.org
Wed Mar 28 00:50:47 EDT 2007
#939: Can save much memory by running a simple display manager
-----------------------------+----------------------------------------------
Reporter: jg | Owner: cjb
Type: defect | Status: new
Priority: high | Milestone: BTest-3
Component: x window system | Resolution:
Keywords: |
-----------------------------+----------------------------------------------
Comment (by AlbertCahalan):
According to /proc/*/smaps, the shell scripts have 732 KB of dirty data in
RAM. (684 KB of Private_Dirty, plus 96 KB of Shared_Dirty data with 2-way
sharing)
You can do tail-call optimization on the shell scripts via exec. Fixes:
In /usr/local/bin/dm, put "exec " at the beginning of the line that starts
with su. Delete the next (last) line, with the sleep. If the sleep is
truly required, put it up front in some sort of "if" block, but I'll guess
that the sleep is merely a hack to let a fast typist get into runlevel 1.
Getting into runlevel 1 is easier via a reboot, and the sleep prevents
using exec.
Also in /usr/local/bin/dm, change the /usr/local/bin/dm-unpriv invocation
to /usr/bin/startx. (alternately modify /usr/local/bin/dm-unpriv to do an
exec, but running a near-empty script is pointless)
In /usr/bin/startx, add "exec " to the beginning of the line that starts
with "xinit ". The commands below should get moved to the top of the file.
While they are logically "clean-up operations", and thus to be done at the
end, it is perfectly fine to do that clean-up when next starting the X
server.
The su program may need modification. The su command probably hangs around
for some authentication systems that might need a clean-up; this is not
useful here.
Unless I missed something, the end result should be that xinit is a child
of init and 732 KB of RAM is recovered.
--
Ticket URL: <http://dev.laptop.org/ticket/939#comment:4>
One Laptop Per Child <http://laptop.org/>
More information about the Bugs
mailing list