Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5b3a7c00 authored by Vic Yang's avatar Vic Yang
Browse files

Move android_ids from .data.rel.ro to .rodata

Pages in .data.rel.ro are always dirty.  Move whatever we can to
.rodata so that we reduce memory pressure.

The size of rodata, text, and data.rel.ro sections of libc on cuttlefish
before/after this change:
    rodata: 0xfd70 -> 0x101d0 (+1120 bytes)
    text: 0xb5715 -> 0xb56e5 (-48 bytes)
    data.rel.ro: 0x57e0 -> 0x5230 (-1456 bytes)

While this change alone doesn't reduce the number of dirty pages
from data.rel.ro on cuttlefish, it is a step in that direction.

Test: Build and boot cuttlefish
Change-Id: Iff8203940495109dd01c40f31b034cfb2882e7f4
parent 79dddb45
Loading
Loading
Loading
Loading
+8 −2
Original line number Original line Diff line number Diff line
@@ -1108,9 +1108,14 @@ class AIDArrayGen(BaseGenerator):


    _INCLUDE = '#include <private/android_filesystem_config.h>'
    _INCLUDE = '#include <private/android_filesystem_config.h>'


    # Note that the android_id name field is of type 'const char[]' instead of
    # 'const char*'.  While this seems less straightforward as we need to
    # calculate the max length of all names, this allows the entire android_ids
    # table to be placed in .rodata section instead of .data.rel.ro section,
    # resulting in less memory pressure.
    _STRUCT_FS_CONFIG = textwrap.dedent("""
    _STRUCT_FS_CONFIG = textwrap.dedent("""
                         struct android_id_info {
                         struct android_id_info {
                             const char *name;
                             const char name[%d];
                             unsigned aid;
                             unsigned aid;
                         };""")
                         };""")


@@ -1132,12 +1137,13 @@ class AIDArrayGen(BaseGenerator):
    def __call__(self, args):
    def __call__(self, args):


        hdr = AIDHeaderParser(args['hdrfile'])
        hdr = AIDHeaderParser(args['hdrfile'])
        max_name_length = max(len(aid.friendly) + 1 for aid in hdr.aids)


        print AIDArrayGen._GENERATED
        print AIDArrayGen._GENERATED
        print
        print
        print AIDArrayGen._INCLUDE
        print AIDArrayGen._INCLUDE
        print
        print
        print AIDArrayGen._STRUCT_FS_CONFIG
        print AIDArrayGen._STRUCT_FS_CONFIG % max_name_length
        print
        print
        print AIDArrayGen._OPEN_ID_ARRAY
        print AIDArrayGen._OPEN_ID_ARRAY