Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp584730ybh; Tue, 21 Jul 2020 02:56:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwEww5zJuLqCFCpsTmkTfNWjIFR5ulkIKc6CH7ixQHIC3YO2EBihifAuCF8a4nDUhQ5udQ/ X-Received: by 2002:aa7:c398:: with SMTP id k24mr24642808edq.95.1595325360572; Tue, 21 Jul 2020 02:56:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595325360; cv=none; d=google.com; s=arc-20160816; b=aaJBro+IQnorMbdRPPxzLUodwY0mMJ+VRq9XDkEDfCeA8LPvHmelTpwQErLGPrpO9S MM1sAjiTXjFXX5Ew3Vw7BpF+hvfTXI17bMXP5Xb/SZz/TfZcMzZCIM4ir0pxB3jeoyzj 9WdoJZ5mYCHGxxdx+iQS7uPgb7PMW+DDXVIYCDDuEmBjK51zEkRBTCFZya8gtJmlRewY jG+by3YmiDayuvL+C6H4lT3OQs11MkXJt9DDceSxY+ZUtLWPuzaHhix7dXEJGcTIVzDM EP3wI8HMRYGVN8WcnqifSFWcinvkkWF3N+gtZontX8cH7NpMzagOr8PKkM7x8vihnN65 mDGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=1XnvnThZnc7BMSa0y7ll+MrXkseUeXuMgZvuNS+LSeM=; b=d5qv6XOQ5NnwfROoSAHePgT6KuhRR9JJ+6UFA8IGmS+dxzkVTL6bhSKihceZcatxK8 Rc0sLWMhORXm/V/gU3juT6wK0el1GFIUnWa6NT2FZ7yxEyynYRoW71I+6ZlU6JR1PDBS 2/BuRorjViWMSNPXZA7TMv+A/+W1BFQifNSmxAzuV9ImNkZzWD0F/EY9GnxbVexd9Oqg mCqoswembL0kGRXoDfffZWvqVcSWUu4CK5pUN2n9HSbXeKLrPO6kxUbo06zIknwVLQzE LGunNREXpbjBrilEoC8LzOAzHaIKZrWh6TfHuSToGGl5FNze05rneByYBKtIha2TVKMh oozg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=bDUf0yko; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e10si12046696edq.65.2020.07.21.02.55.37; Tue, 21 Jul 2020 02:56:00 -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=@redhat.com header.s=mimecast20190719 header.b=bDUf0yko; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729051AbgGUJza (ORCPT + 99 others); Tue, 21 Jul 2020 05:55:30 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:47840 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729035AbgGUJz2 (ORCPT ); Tue, 21 Jul 2020 05:55:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1595325326; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=1XnvnThZnc7BMSa0y7ll+MrXkseUeXuMgZvuNS+LSeM=; b=bDUf0ykotFD1kUvXvhNLHfqc3iGWYE7S5VRtdAMv/AB7OXLV2Fj/ACn4CfS6LCs5PVbXwq YUIZis7fQPCg+nJXnow1SzssiwrqnQiCXdWDltTLQYYFgU2RF9p90FiUnkcIhqdTL/hhaK 7T/Q5uPrIkigFnwh/WDjRdi3uSTMRiE= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-475-AdemcYfsN6Wr2Mh9BhQkmQ-1; Tue, 21 Jul 2020 05:55:24 -0400 X-MC-Unique: AdemcYfsN6Wr2Mh9BhQkmQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5A1FE1B2C980; Tue, 21 Jul 2020 09:55:23 +0000 (UTC) Received: from localhost (ovpn-12-170.pek2.redhat.com [10.72.12.170]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AECD7C0060; Tue, 21 Jul 2020 09:55:22 +0000 (UTC) Date: Tue, 21 Jul 2020 17:55:20 +0800 From: Baoquan He To: Mike Kravetz Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org Subject: Re: [PATCH 5/5] mm/hugetl.c: warn out if expected count of huge pages adjustment is not achieved Message-ID: <20200721095520.GN32539@MiWiFi-R3L-srv> References: <20200720062623.13135-1-bhe@redhat.com> <20200720062623.13135-6-bhe@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/20/20 at 05:38pm, Mike Kravetz wrote: > 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. Thanks, sounds much better, I will use these to replace the old log. > > > > > 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. Agree. While from our customer's request, they told the log can help 'Easily detect and analyse previous reservation failures'. > > > > > 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. Sure, will change. We should try to release the lock's burden. Thanks.