Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp311583ybh; Mon, 20 Jul 2020 17:42:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzgnpiMtmxakH0lyQnVS4MtseWwg225g/ZYjSu+q6ZntAFc23oFn+QZvKIQ95Az30RqqIjw X-Received: by 2002:a17:906:81d2:: with SMTP id e18mr22189678ejx.341.1595292154202; Mon, 20 Jul 2020 17:42:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595292154; cv=none; d=google.com; s=arc-20160816; b=Ngi3fgQuPgqz7zjXVDkVosNLQrQHcuidX5j1A5OnzOqboc0XHu2zRGiLqPTG5utC1n sa99ESGvCpg0DmqI5SEkOLauyLpwYBGBb+q+ng79HrJ0/sviBKdmaTNVso9oz9IWxeG9 bDuZhnT0O/+Pk7a5RQ0xpS/R+g6F8+N8HDlzTVrfHLp5d+/d3cHUVqGiDWUmkzJfXol/ thJ4E1eXytYyXUqSVcmpFPPpZt2fqS484M/aKRqiKnZEFVWjpYyoSu0mtBchDU9UZxoR NecZaQE1NRHh2uHXmuy9Jruf7WnGGVuJXFnU9MDTHDxXz87bOUkilcfIdEVwR7Sqm8CO 2W+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=SOydNk4NfHk1SJHZ5z8aPTebLmt7sZyrmhdUciJmqm0=; b=drDYTGcPpf4vYXovs4tJtUJRPlYgDVCO88CQb95fRrc4fClBlfxAmhXmxxrnj0gZjP rLlv/8tgRP2o5e1uUjeL/Cp55YfYV8g637h5xcF5orscUJfbWkGotqK0jwzzC4WAG3Zz LwyE/hKrdpVtAk5Ll1mp1a6bzZL94LBAZOmWXt2OB5IXcyM1h459JnSWAypHq4rwU0yJ SmQfxdhsxveWH8OI0oOmTz847frj37b6eHzgTPueURAo3v+mlEfNJcxm9qKFsrsKYZZn dGNIPCtI1BmEYfD4xTb2eKM1rWXQoUtdtoXfRS1/yP07YFkuZDzxBtve3kVNJYllJm8h ZYBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=SC9zbmmh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l14si11432469edq.355.2020.07.20.17.42.11; Mon, 20 Jul 2020 17:42:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=SC9zbmmh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728315AbgGUAjV (ORCPT + 99 others); Mon, 20 Jul 2020 20:39:21 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:50722 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728270AbgGUAjS (ORCPT ); Mon, 20 Jul 2020 20:39:18 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 06L0d26p152395; Tue, 21 Jul 2020 00:39:02 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=SOydNk4NfHk1SJHZ5z8aPTebLmt7sZyrmhdUciJmqm0=; b=SC9zbmmhSIUB4w52bDf26AOXZg0ED7+FHkmp/iEfIJERyHBeIwOud8BH26xClMFDlNaB 0RGUbvfrbfjAY964CsQvZ+Jh6RtIAjXMRz27wX6GdcsdedqwX2mfl5rcReYJyBIThN/c dB8upDd2BFGT8ukmz9QxFH6ZM8U6teKX6StiN6l0NFpZXRhAvaywI1YNY0kaXWZpGWyS /6+VWCU/Z1lY2RZjuGG8bB6q8cBz75hMuRNKqwKZvmWUv+FRRARl6YtpjsGP0iKByC3/ FbYM8MB1zOuBWw3URFr6ZmtogwYEdineaCTsAqoI7ZQDTXm0XHMpb1QoIZCZk+HoDtHP Lg== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2130.oracle.com with ESMTP id 32brgra1cd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 21 Jul 2020 00:39:02 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 06L0MvAh194983; Tue, 21 Jul 2020 00:39:01 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userp3030.oracle.com with ESMTP id 32dnmq8q63-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 21 Jul 2020 00:39:01 +0000 Received: from abhmp0006.oracle.com (abhmp0006.oracle.com [141.146.116.12]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 06L0d0Jh022871; Tue, 21 Jul 2020 00:39:00 GMT Received: from [192.168.2.112] (/50.38.35.18) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 20 Jul 2020 17:39:00 -0700 Subject: Re: [PATCH 5/5] mm/hugetl.c: warn out if expected count of huge pages adjustment is not achieved To: Baoquan He , linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, akpm@linux-foundation.org References: <20200720062623.13135-1-bhe@redhat.com> <20200720062623.13135-6-bhe@redhat.com> From: Mike Kravetz Message-ID: Date: Mon, 20 Jul 2020 17:38:59 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: <20200720062623.13135-6-bhe@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9688 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 adultscore=0 phishscore=0 bulkscore=0 suspectscore=2 mlxscore=0 malwarescore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2007210000 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9688 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 bulkscore=0 spamscore=0 impostorscore=0 suspectscore=2 adultscore=0 clxscore=1015 mlxlogscore=999 priorityscore=1501 phishscore=0 lowpriorityscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2007210001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/19/20 11:26 PM, Baoquan He wrote: > A customer complained that no any message is printed out when failed to > allocate explicitly specified number of persistent huge pages. That > specifying can be done by writing into /proc/sys/vm/nr_hugepages to > increase the persisten huge pages. > > In the current code, it takes the best effort way to allocate the expected > number of huge pages. If only succeeding to get part of them, no any > information is printed out. > > Here try to send out warning message if the expected number of huge pages > adjustment is not achieved, including increasing and decreasing the count > of persistent huge pages. Perhaps change the wording a bit, 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 > --- > mm/hugetlb.c | 13 ++++++++++++- > 1 file changed, 12 insertions(+), 1 deletion(-) I am not opposed to this patch. However, I believe the best way for a user to determine if their request was successful is to compare the value of nr_hugepages to the value which was written. > > diff --git a/mm/hugetlb.c b/mm/hugetlb.c > index 467894d8332a..1dfb5d9e4e06 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; > 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,6 +2780,16 @@ static int set_max_huge_pages(struct hstate *h, unsigned long count, int nid, > } > out: > h->max_huge_pages = persistent_huge_pages(h); > + if (count != h->max_huge_pages) { > + 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 - h->max_huge_pages)); > + } > spin_unlock(&hugetlb_lock); I would prefer if we drop the lock before logging the message. That would involve grabbing the value of h->max_huge_pages before dropping the lock. -- Mike Kravetz > > NODEMASK_FREE(node_alloc_noretry); >