• N
    hugetlb: new sysfs interface · a3437870
    Nishanth Aravamudan 提交于
    Provide new hugepages user APIs that are more suited to multiple hstates
    in sysfs.  There is a new directory, /sys/kernel/hugepages.  Underneath
    that directory there will be a directory per-supported hugepage size,
    e.g.:
    
    /sys/kernel/hugepages/hugepages-64kB
    /sys/kernel/hugepages/hugepages-16384kB
    /sys/kernel/hugepages/hugepages-16777216kB
    
    corresponding to 64k, 16m and 16g respectively.  Within each
    hugepages-size directory there are a number of files, corresponding to the
    tracked counters in the hstate, e.g.:
    
    /sys/kernel/hugepages/hugepages-64/nr_hugepages
    /sys/kernel/hugepages/hugepages-64/nr_overcommit_hugepages
    /sys/kernel/hugepages/hugepages-64/free_hugepages
    /sys/kernel/hugepages/hugepages-64/resv_hugepages
    /sys/kernel/hugepages/hugepages-64/surplus_hugepages
    
    Of these files, the first two are read-write and the latter three are
    read-only.  The size of the hugepage being manipulated is trivially
    deducible from the enclosing directory and is always expressed in kB (to
    match meminfo).
    
    [dave@linux.vnet.ibm.com: fix build]
    [nacc@us.ibm.com: hugetlb: hang off of /sys/kernel/mm rather than /sys/kernel]
    [nacc@us.ibm.com: hugetlb: remove CONFIG_SYSFS dependency]
    Acked-by: NGreg Kroah-Hartman <gregkh@suse.de>
    Signed-off-by: NNishanth Aravamudan <nacc@us.ibm.com>
    Signed-off-by: NNick Piggin <npiggin@suse.de>
    Cc: Dave Hansen <dave@linux.vnet.ibm.com>
    Signed-off-by: NNishanth Aravamudan <nacc@us.ibm.com>
    Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
    a3437870
hugetlb.c 53.0 KB