Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp635960ybh; Wed, 22 Jul 2020 09:19:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxJ3W7cHTEO6zbVLp2TYqgSEm5GIqmC0AzBmtTt6t3SC9Z9wtBEaGGZrAm5b8yAVCFCSPBE X-Received: by 2002:a50:dacf:: with SMTP id s15mr270289edj.136.1595434750916; Wed, 22 Jul 2020 09:19:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595434750; cv=none; d=google.com; s=arc-20160816; b=jzGJyKWHrxf1dlGp239fkcyK0cYd0uALv4lz64/T5w3OfYmzMhLkunugYvarOi9EC4 PMDdMCrWMFz1v+XXFa837LNGCu9SIP3t84p09PgOd44o24ZZjjPcg/mYBCzgGuYDSgNP S8zDFdgtQgpQRfw87OFjhZbpCAPDYS9EiWUgHewXrJYbzaIG8OWD7ERO0ote5vYegnzd wZtgmitfOZ4lrCK7DYmj+G2eVCOPZeOwIlLGFtYayLG3Aesf/TSCDBBn+9trnlY2b2XL XtZEI+j/2YEcyYWXV8r8umtRCnEOlOHPT98sXJUGDCKCO5qlyviZO5BJ1YK3hDXCr/90 /YsQ== 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:references:cc:to:subject:from:dkim-signature; bh=uPAPFWdtI0KQEaKyHfYLGNdcmjbd8o6N+HGuwvE/79A=; b=rLFcvxu7CvSjwH/UtFMJZfkGcVBVsJevRBvsgLwXH2gQKTD1KAAyQiR1VvqueJ2dup LY9c9YO27qw3ly3SbXAd6jZBwQsYOhgEL4pTGGRz5U68Fh+EsNSeRE9ib3V/tly0mztJ P9KkIo8VhMoISLddhW8kMHFD1K2ErnG9/ygrJkXl7wtlAJEthPqMduQoyPgnU2sba8rj cfzmCOE2bMX/rats+VyMgsB6o+dvA1eP+gR7w44bWcF7FwgBxWN5JSpA5fTPb7vDyOm/ osW+6YLaIaB1hqDS9FhUYG9cJ1wtNGsayaOf8nbTTgWr8GXvSV097y+lzN4zCBO/3vV9 fe7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=m28HDV4b; 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 h1si305164ejc.200.2020.07.22.09.18.47; Wed, 22 Jul 2020 09:19:10 -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=m28HDV4b; 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 S1728612AbgGVQQH (ORCPT + 99 others); Wed, 22 Jul 2020 12:16:07 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:35096 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726784AbgGVQQH (ORCPT ); Wed, 22 Jul 2020 12:16:07 -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 06MFuVwQ190232; Wed, 22 Jul 2020 16:16:01 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : subject : to : cc : references : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=uPAPFWdtI0KQEaKyHfYLGNdcmjbd8o6N+HGuwvE/79A=; b=m28HDV4bWX/I0XDBy/fQ2oq3s+klNc5FVa8kc6cPr7fT0Ra11o0t7v054Re8GYjCOwQ4 Xhx06ojHaOD+oNA4Jvsq4bU3KtWk4kZ/LLB0iIFPPMCZyZirP8e7YAme69i7kNinqUJK nkFMEkzj+0AJvY0nqvAWlLfm99LlleZRAZVb8GzPEFu6CE0LwfdTRX0lcobD/JiBwlKP stKw/5YcgWckPkTS/j0AZ/4pq799LvtcF0UAdhgHA9lErY3/QunhGjW4i4T1DnQfji9B 2kNDM8bmoZrVNbwrs1FRB5TLZiJjqCRRgcN8JY9EFXDuMcfMPe+pQ8SUQl97QYuC3NPx JQ== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2130.oracle.com with ESMTP id 32brgrmasw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 22 Jul 2020 16:16:01 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 06MFwB5Z096647; Wed, 22 Jul 2020 16:16:00 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserp3030.oracle.com with ESMTP id 32erheh1b8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 22 Jul 2020 16:16:00 +0000 Received: from abhmp0013.oracle.com (abhmp0013.oracle.com [141.146.116.19]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 06MGFxPT013028; Wed, 22 Jul 2020 16:15:59 GMT Received: from [192.168.2.112] (/50.38.35.18) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 22 Jul 2020 09:15:59 -0700 From: Mike Kravetz Subject: Re: [PATCH 5/5] mm/hugetl.c: warn out if expected count of huge pages adjustment is not achieved To: Baoquan He Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org References: <20200720062623.13135-1-bhe@redhat.com> <20200720062623.13135-6-bhe@redhat.com> <20200722084913.GO32539@MiWiFi-R3L-srv> Message-ID: <05d5dfde-4c1f-8f62-9526-a9a81c5ffdc1@oracle.com> Date: Wed, 22 Jul 2020 09:15:58 -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: <20200722084913.GO32539@MiWiFi-R3L-srv> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9690 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 spamscore=0 suspectscore=2 mlxlogscore=999 adultscore=0 mlxscore=0 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2007220108 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9690 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-2007220108 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/22/20 1:49 AM, Baoquan He wrote: > On 07/20/20 at 05:38pm, Mike Kravetz wrote: >>> + 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. > > Do you think the below change is OK to you to move the message logging > after lock dropping? If yes, I will repost with updated patches. > > diff --git a/mm/hugetlb.c b/mm/hugetlb.c > index 6a9b7556ce5b..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, old_max; > + unsigned long min_count, ret, old_max, new_max; > NODEMASK_ALLOC(nodemask_t, node_alloc_noretry, GFP_KERNEL); > > /* > @@ -2780,7 +2780,10 @@ 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) { > + 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); > @@ -2788,9 +2791,8 @@ static int set_max_huge_pages(struct hstate *h, unsigned long count, int nid, > count > old_max ? "increasing" : "decreasing", > abs(count - old_max), buf, > count > old_max ? "increased" : "decreased", > - abs(old_max - h->max_huge_pages)); > + abs(old_max - new_max)); > } > - spin_unlock(&hugetlb_lock); > > NODEMASK_FREE(node_alloc_noretry); Yes, that looks better. Thank you. -- Mike Kravetz