• David Rientjes's avatar
    mm, hugetlb_cgroup: round limit_in_bytes down to hugepage size · 297880f4
    David Rientjes authored
    The page_counter rounds limits down to page size values.  This makes
    sense, except in the case of hugetlb_cgroup where it's not possible to
    charge partial hugepages.  If the hugetlb_cgroup margin is less than the
    hugepage size being charged, it will fail as expected.
    
    Round the hugetlb_cgroup limit down to hugepage size, since it is the
    effective limit of the cgroup.
    
    For consistency, round down PAGE_COUNTER_MAX as well when a
    hugetlb_cgroup is created: this prevents error reports when a user
    cannot restore the value to the kernel default.
    Signed-off-by: 's avatarDavid Rientjes <rientjes@google.com>
    Cc: Michal Hocko <mhocko@kernel.org>
    Cc: Nikolay Borisov <kernel@kyup.com>
    Cc: Johannes Weiner <hannes@cmpxchg.org>
    Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
    Signed-off-by: 's avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: 's avatarLinus Torvalds <torvalds@linux-foundation.org>
    297880f4
hugetlb_cgroup.c 10.9 KB