[Crash-utility] [RFC PATCH v3 0/2] Show memory overcommit data in dump_kmeminfo()

Dave Anderson anderson at redhat.com
Tue Dec 9 16:48:28 UTC 2014



----- Original Message -----
> The first patch changes dump_kmeminfo() to report overcommit information
> similar to that displayed under the proc/meminfo file. It may be useful to
> indicate memory over commitment abuse, for example with forced vmcores from
> system hangs due to shortage of memory. The intended output is as follows:
> 
>   crash> kmem -i
>                    PAGES        TOTAL      PERCENTAGE
>       TOTAL MEM  1965332       7.5 GB         ----
>            FREE    78080       305 MB    3% of TOTAL MEM
>            USED  1887252       7.2 GB   96% of TOTAL MEM
>          SHARED   789954         3 GB   40% of TOTAL MEM
>         BUFFERS   110606     432.1 MB    5% of TOTAL MEM
>          CACHED  1212645       4.6 GB   61% of TOTAL MEM
>            SLAB   146563     572.5 MB    7% of TOTAL MEM
> 
>      TOTAL SWAP  1970175       7.5 GB         ----
>       SWAP USED        5        20 KB    0% of TOTAL SWAP
>       SWAP FREE  1970170       7.5 GB   99% of TOTAL SWAP
> 
>    COMMIT LIMIT  2952841      11.3 GB         ----
>       COMMITTED  1150595       4.4 GB   38% of TOTAL LIMIT
> 
> The second patch simply removes the mention of dump_zone_page_usage()
> availability from kmem's help page.
> 
> Tested under 3.16.4-200.fc20.x86_64 only.
> Though this should work under RHEL4 (2.6.9-5) and above whereby the
> kernel symbol sysctl_overcommit_memory is available.
> 
> Changelog:
> 
> v2 -> v3:
> 
>  - Appropriately avoid a divide-by-zero when the "allowed" variable
>    is correctly set to 0 (e.g. overcommit_ratio is 0 and swap
>    device is off)
> 
>  - Initialised the following members of offset_table in vm_init():
>    hstate_order, hstate_nr_huge_pages, hstate_free_huge_pages and
>    hstate_name
> 
>  - percpu_counter_struct_count and atomic_t_counter have
>    been added to offset_table and each initialised in kernel_init()

Hi Aaron,

In the interest of moving this patch along, I made three minor changes:

(1) Renamed the offset_table "percpu_counter_struct_count" member to use
    the traditional naming scheme, i.e., "percpu_counter_count".

(2) This construct essentially calls the same function 3 times:

        if (STRUCT_EXISTS("percpu_counter"))
                if (MEMBER_EXISTS("percpu_counter", "count"))
                        MEMBER_OFFSET_INIT(percpu_counter_struct_count,
                                        "percpu_counter", "count");

    All that is necessary is this one-liner:

	MEMBER_OFFSET_INIT(percpu_counter_count, "percpu_counter", "count");

    Worse case, the offset gets set to -1 (INVALID).

(3) Updated the help page's sample "kmem -i" output.  Your patch appended a 11.3 GB COMMIT
    LIMIT to the output of a 256MB i386 machine.  ;-)

Queued for crash-7.1.0:

  https://github.com/crash-utility/crash/commit/2562642c5fc0fa955634b78600f71348e2fcc050

Nice addition.

Thanks,
  Dave

 




More information about the Crash-utility mailing list