lkml.org 
[lkml]   [2020]   [Jul]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH v2 4/4] mm/hugetl.c: warn out if expected count of huge pages adjustment is not achieved
    Date
    A customer complained that no message is logged when the number of
    persistent huge pages is not changed to the exact value written to
    the sysfs or proc nr_hugepages file.

    In the current code, a best effort is made to satisfy requests made
    via the nr_hugepages file. However, requests may be only partially
    satisfied.

    Log a message if the code was unsuccessful in fully satisfying a
    request. This includes both increasing and decreasing the number
    of persistent huge pages.

    Signed-off-by: Baoquan He <bhe@redhat.com>
    ---
    mm/hugetlb.c | 15 ++++++++++++++-
    1 file changed, 14 insertions(+), 1 deletion(-)

    diff --git a/mm/hugetlb.c b/mm/hugetlb.c
    index c14837854392..b5aa32a13569 100644
    --- a/mm/hugetlb.c
    +++ b/mm/hugetlb.c
    @@ -2661,7 +2661,7 @@ static int adjust_pool_surplus(struct hstate *h, nodemask_t *nodes_allowed,
    static int set_max_huge_pages(struct hstate *h, unsigned long count, int nid,
    nodemask_t *nodes_allowed)
    {
    - unsigned long min_count, ret;
    + unsigned long min_count, ret, old_max, new_max;
    NODEMASK_ALLOC(nodemask_t, node_alloc_noretry, GFP_KERNEL);

    /*
    @@ -2723,6 +2723,7 @@ static int set_max_huge_pages(struct hstate *h, unsigned long count, int nid,
    * pool might be one hugepage larger than it needs to be, but
    * within all the constraints specified by the sysctls.
    */
    + old_max = persistent_huge_pages(h);
    while (h->surplus_huge_pages && count > persistent_huge_pages(h)) {
    if (!adjust_pool_surplus(h, nodes_allowed, -1))
    break;
    @@ -2779,8 +2780,20 @@ static int set_max_huge_pages(struct hstate *h, unsigned long count, int nid,
    }
    out:
    h->max_huge_pages = persistent_huge_pages(h);
    + new_max = h->max_huge_pages;
    spin_unlock(&hugetlb_lock);

    + if (count != new_max) {
    + char buf[32];
    +
    + string_get_size(huge_page_size(h), 1, STRING_UNITS_2, buf, 32);
    + pr_warn("HugeTLB: %s %lu of page size %s failed. Only %s %lu hugepages.\n",
    + count > old_max ? "increasing" : "decreasing",
    + abs(count - old_max), buf,
    + count > old_max ? "increased" : "decreased",
    + abs(old_max - new_max));
    + }
    +
    NODEMASK_FREE(node_alloc_noretry);

    return 0;
    --
    2.17.2
    \
     
     \ /
      Last update: 2020-07-23 05:24    [W:2.577 / U:0.080 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site