[git commit] use_less_ram: tweak a bit

Denys Vlasenko vda.linux at googlemail.com
Fri Apr 22 16:57:01 UTC 2016


commit: https://git.busybox.net/busybox-website/commit/?id=ded5069c0b26a567693150598abfab8347675993
branch: https://git.busybox.net/busybox-website/commit/?id=refs/heads/master

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 use_less_ram.html | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/use_less_ram.html b/use_less_ram.html
index 9a8afbe..a4d9428 100644
--- a/use_less_ram.html
+++ b/use_less_ram.html
@@ -34,11 +34,6 @@ well-designed programs don't put constant data into RW sections,
 therefore in practice almost all RW data or bss pages which were
 touched by the program are modified).
 </p><p>
-It is important to minimize the number of RW pages your program touches.
-Data, bss and stack pages are never freed, therefore for large,
-and especially for temporary allocations, it's best to use malloc()
-or mmap().
-</p><p>
 When process starts executing, two more mappings appear. One is the stack.
 It is usually located ner the top of virtual address space, and contains
 program command line, environment and ELF auxiliary vector.
@@ -64,6 +59,11 @@ shows its own memory map:
 f76fe000       8K r--p  [vvar]
 f7700000       8K r-xp  [vdso]
 ff82a000     132K rw-p  [stack]       - stack</pre>
+</p><p>
+It is important to minimize the number of RW pages your program touches.
+Data, bss and stack pages are never freed, therefore for large,
+and especially for temporary allocations, it's best to use malloc()
+or mmap().
 </p>
 <h4>Optimizing start of data</h4>
 <p>
@@ -115,7 +115,7 @@ padding for tiny data objects (e.g. bool variables).
 </p><p>
 The alignment can be relaxed by explicit ALIGN1 or ALIGN2 attributes on such arrays:
 </p><p>
-static const char extn[][5] ALIGN1 = { ".zip", ".ZIP" };
+<pre>static const char extn[][5] ALIGN1 = { ".zip", ".ZIP" };</pre>
 </p><p>
 The above prevents 2 bytes of padding in the binary.
 </p><p>
@@ -133,18 +133,18 @@ is anonymous. We can save a bit of memory on the kernel side, for every process,
 by not requiring two VMAs. This can be achieved by changing linker script
 to place all formerly-bss variables to data:
 </p><p>
-<pre>  .data           :
+<pre>  .data:
   {
     *(.data .data.* .gnu.linkonce.d.*)
     SORT(CONSTRUCTORS)
   }
   ......................
-  .bss            :
+  .bss:
   {
-   *(.dynbss)                       ---
-   *(.bss .bss.* .gnu.linkonce.b.*) --- move these lines to .data {} block
-   *(COMMON)                        ---
-   . = ALIGN(. != 0 ? 64 / 8 : 1);
+    *(.dynbss)                       ---
+    *(.bss .bss.* .gnu.linkonce.b.*) --- move these lines to .data {} block
+    *(COMMON)                        ---
+    . = ALIGN(. != 0 ? 64 / 8 : 1);
   }</pre>
 </p><p>
 The result of this change is visible in pmap as absense of "[ anon ]" mapping:


More information about the busybox-cvs mailing list