Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp8417553rwn; Wed, 14 Sep 2022 14:12:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7MDQjqbgW4YV6EXqSe5CGoYJcqI8dwQGSHmpTRHA6dp6Lz8PPTPNKsw+oYdKfBL0kxeZHu X-Received: by 2002:a17:903:248:b0:172:7520:db04 with SMTP id j8-20020a170903024800b001727520db04mr899960plh.99.1663189962059; Wed, 14 Sep 2022 14:12:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663189962; cv=none; d=google.com; s=arc-20160816; b=AY4RRzzm6GZS7fGBAmQzFXk7WUqOkPqfFi+4id8CgGbJtm+ahmvUq9pKI9Mx9+ny1C Zj4LXXOOOXw8S7gmBj0QyQ+atm4oc0EUZDGYngJj63YdGSHfNZMhvanOkLutVFoGwncR EkzoR8lMvIK2hyBqAqgbfiRKW7mmXb7feclZUn+Hf76XtjN8MkQ1myL+Dsn0G0all5nF kN2LNurpSkHDR64XZ2Z3bJLsIe8gR9Wucx2e68WGwGf8nU/bHHlJ6DJXcus3/wXhZmXg jdu590xjVw93skKVpSpoy9lvDqz5N/0ziMpzosf51hc8sBq/VlO8E6OI+Urwl4R5BBzi EfBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=QNOK6bg3WNCxMIPSeQHjNvu0ozBqcVbsBe3WZ1KA250=; b=WY/WalbVIglOYa2qXqR7ufqoNYUKlps9E6aLKuaOrzEzN7yWqsiD3SpzucYrLYY7MW Xd4g08fBTA1z1udRNeJmVHtGVL7F3VfA7Ff9aXxmEV2vz6E/LKctNrpHPP6Mh69g+znx QfyUVzVsZerzeVH8dqVHYNV05xkmumOeN4dEFIZDTN0AUvRtNGykhcmg3DLpD6Yinxwh aplLg3l7UCY1mFxJY7UBCplUPUv/7d7k7JoTgjpKXfl4AY4oShRAnTMoajOpLHbk/nvz x3JtdS57GGZM4NcH8BvifZv0aJ5q8LXDwDvzJAOvKxwnIge0+LFwjJBUnCCBD8vmfpko 0Klg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=Akde85+O; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u18-20020a632352000000b00430622d4f41si16045240pgm.256.2022.09.14.14.12.29; Wed, 14 Sep 2022 14:12:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=Akde85+O; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229531AbiINU6j (ORCPT + 99 others); Wed, 14 Sep 2022 16:58:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229639AbiINU6b (ORCPT ); Wed, 14 Sep 2022 16:58:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C7F482F8F; Wed, 14 Sep 2022 13:58:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id ECE1261EFA; Wed, 14 Sep 2022 20:58:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4DC3BC433D6; Wed, 14 Sep 2022 20:58:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1663189107; bh=13Kqr57N7WjSLCxogiNCCLJj2p5+iCJdoNC3K8yMzSg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Akde85+OMf9K7zWrWyB8xjCRDyztlflzLDljpgIRiaNvhG1YuewX3TzsCsos/n0CF FSDkgjnoPrs/wbb6mdVtNpr9V/SIgYlHlSPnP5rKQDodKX5TsEBKejNy96oj2yAlrw 8/yUPR2n+bMbVgfeBxozthIYbqniW3FLwGUj1BG0= Date: Wed, 14 Sep 2022 13:58:25 -0700 From: Andrew Morton To: Mike Kravetz Cc: Doug Berger , Jonathan Corbet , Rob Herring , Krzysztof Kozlowski , Frank Rowand , Muchun Song , Mike Rapoport , Christoph Hellwig , Marek Szyprowski , Robin Murphy , Borislav Petkov , "Paul E. McKenney" , Neeraj Upadhyay , Randy Dunlap , Damien Le Moal , Florian Fainelli , David Hildenbrand , Zi Yan , Oscar Salvador , Hari Bathini , Kees Cook , - , KOSAKI Motohiro , Mel Gorman , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-mm@kvack.org, iommu@lists.linux.dev Subject: Re: [PATCH 02/21] mm/hugetlb: correct max_huge_pages accounting on demote Message-Id: <20220914135825.88814aa1699e93c8a782abc6@linux-foundation.org> In-Reply-To: References: <20220913195508.3511038-1-opendmb@gmail.com> <20220913195508.3511038-3-opendmb@gmail.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-8.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 14 Sep 2022 10:23:05 -0700 Mike Kravetz wrote: > On 09/13/22 12:54, Doug Berger wrote: > > When demoting a hugepage to a smaller order, the number of pages > > added to the target hstate will be the size of the large page > > divided by the size of the smaller page. > > > > Fixes: 8531fc6f52f5 ("hugetlb: add hugetlb demote page support") > > Signed-off-by: Doug Berger > > --- > > mm/hugetlb.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/mm/hugetlb.c b/mm/hugetlb.c > > index e070b8593b37..79949893ac12 100644 > > --- a/mm/hugetlb.c > > +++ b/mm/hugetlb.c > > @@ -3472,7 +3472,8 @@ static int demote_free_huge_page(struct hstate *h, struct page *page) > > * based on pool changes for the demoted page. > > */ > > h->max_huge_pages--; > > - target_hstate->max_huge_pages += pages_per_huge_page(h); > > + target_hstate->max_huge_pages += pages_per_huge_page(h) / > > + pages_per_huge_page(target_hstate); > > > > return rc; > > } > > This has already been fixed here, > > https://lore.kernel.org/linux-mm/20220823030209.57434-2-linmiaohe@huawei.com/ Neither version tells us the user-visible runtime effects of the change :(