• Hugh Dickins's avatar
    x86: fix /proc/meminfo DirectMap · a06de630
    Hugh Dickins authored
    Do we actually want these DirectMap lines in the x86 /proc/meminfo?
    I can see they're interesting to CPA developers and TLB optimizers,
    but they don't fit its usual "where has all my memory gone?" usage.
    If they are to stay, here are some fixes.
    
    1. On x86_32 without PAE, they're not 2M but 4M pages: no need to
       mess with the internal enum, but show the right name to users.
    
    2. Many machines can never show anything but 0 for DirectMap1G,
       so suppress that line unless direct_gbpages are really enabled.
    
    3. The unit in /proc/meminfo is kB not number of pages: HugePages
       messed that up, but they're an example to regret not to follow.
    
    4. Once we use kB, it's easy to see that 1GB has gone missing (which
       explains why CONFIG_CPA_DEBUG=y soon wraps DirectMap2M negative):
       because head_64.S's level2_ident_pgt entries were not counted.
       My fix is not ideal, but works for more and for less than 1G,
       and avoids interfering with early bootup pagetable contortions.
    Signed-off-by: default avatarHugh Dickins <hugh@veritas.com>
    Cc: Andi Kleen <andi@firstfloor.org>
    Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
    a06de630
init_64.c 27 KB