Disable tty2-tty6 to save 11 megs memory on livecd

Bug #501241 reported by Bryan Quigley
18
This bug affects 2 people
Affects Status Importance Assigned to Milestone
upstart (Ubuntu)
Won't Fix
Wishlist
Unassigned

Bug Description

Binary package hint: upstart

Now that byobu is included by default we no longer need tty2-tty6.

Furthermore on the desktop CD (64 bit) it saves about 11 megs of memory. From 322 MiB to 311 MiB(according to gsm).

description: updated
Revision history for this message
Scott James Remnant (Canonical) (canonical-scott) wrote :

It saves zero memory

Changed in upstart (Ubuntu):
status: New → Invalid
Revision history for this message
Bryan Quigley (bryanquigley) wrote :

I tested it and it saves more than "zero" memory (at minimum 3 MiB), here is how I did it:

   1. Figure out how much your computer (when booting off of a liveUSB in my case) needs to boot, open a terminal, and run free -m with using almost no swap.

      [make sure the computer has a swap partition, or else this won't work]

      Do this by booting the kernel with different mem=???M options. And try getting swap close to zero (see it with free -m), but still in positive territory by a few. Mine was mem=450M, and swap used was 3 M
   2. Then make your changes, in my case rm /etc/init/tty[2-6]
   3. Reboot with the same kernel option (mem=450M), run the terminal, run free -m and rejoice in the lack of swap used.

More here: http://gquigs.blogspot.com/2010/01/memory-is-to-hard-to-measure.html

Changed in upstart (Ubuntu):
status: Invalid → New
summary: - Disable tty2-tty6 to save 11 megs memory on livecd
+ Disable tty2-tty6 to save 3 megs memory on livecd
Changed in upstart (Ubuntu):
status: New → Invalid
Changed in upstart (Ubuntu):
status: Invalid → New
Revision history for this message
Milan Bouchet-Valat (nalimilan) wrote : Re: Disable tty2-tty6 to save 3 megs memory on livecd

Bryan, please never change a bug status without comment. The reason why Scott closed the bug in the first place is that gaining 3MB of memory was not considered as worth disabling the consoles. If you don't agree with that, you need to convince developers that it's a good idea, not force the bug open. If you do that, people won't work on the bug anyway, it will just stay around for nothing.

Changed in upstart (Ubuntu):
importance: Undecided → Wishlist
status: New → Invalid
summary: - Disable tty2-tty6 to save 3 megs memory on livecd
+ Disable tty2-tty6 to save 11 megs memory on livecd
Revision history for this message
Bryan Quigley (bryanquigley) wrote :

Thank you for your concern Milan however the order is slightly different than described.

The bug was closed first by Scott's "zero memory" saved logic. (Comment #1)
I debunk thin in Comment #2 showing that it at least saves 3 MB, Note, my testing method just proves it saves MORE than 3 mb. 3 Mb is definitely less then the actual amount saved.
Jacob changes the title incorrectly to 3 mb and marks it as invalid providing no reason for the change to invalid.
I notice this and change it back to new.

It is acceptable (but I disagree obviously) to close the bug Invalid or Won't Fix if Scott (or another developer) says what you said Milan. Again, at Comment #3 no one has said what you said before.

Apologies for the bug noise, I need to work on communicating more clearly....

(Also of note, I have not suggested disabling all of the ttys, just tty2,3,4,5.. leaving tty1)

Changed in upstart (Ubuntu):
status: Invalid → New
Revision history for this message
Milan Bouchet-Valat (nalimilan) wrote :

So if not merely 3MB, how much memory would this change free? You changed the title again to "11MB", but gnome-system-monitor is not really accurate to measure what we actually gain, and there are several figures to take into account - notably, used vs. free RAM doesn't mean much since the system will try to use all av. Only your method with the "mem" kernel option is IMHO accurate enough, and you don't really say how much we would win according to this test.

Revision history for this message
Scott James Remnant (Canonical) (canonical-scott) wrote :

Since each getty instance is the exact same binary, with the exact same libraries, Linux is smart enough to reuse the same memory for each instance and just map them repeatedly into the address space of each new process.

The only per-getty overhead is whatever heap allocations getty does, and space for the stack; this is a tiny amount of memory in the order of kilobytes not the megabytes you claim.

Changed in upstart (Ubuntu):
status: New → Won't Fix
Revision history for this message
Bryan Quigley (bryanquigley) wrote : Re: [Bug 501241] Re: Disable tty2-tty6 to save 11 megs memory on livecd

I'll accept this answer... but...

I was referring to the use on the Live CD, not on an installed system. As
far as I can tell bash is the application started, not getty. Furthermore,
it appears to save at least 3 MB which is more than one bash instance.
Also, each (according to bootchart) ends up running a series of checks that
appear to be separate from each other (could be reading wrong).

Thanks for taking the time to answer and your work on Ubuntu!

Revision history for this message
Milan Bouchet-Valat (nalimilan) wrote :

bash is only started once you've logged in, since you could as well use zsh or something else...

Revision history for this message
Bryan Quigley (bryanquigley) wrote :

Try out a liveCD, you'll note that each virtual terminal is logged in after
bootup.

Revision history for this message
Scott James Remnant (Canonical) (canonical-scott) wrote :

While that's true on the Live CD, the Live CD itself requires large amounts of memory simply because it RAM shadows the filesystem - therefore it's not appropriate if you have memory constraints anyway!

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.