From patchwork Tue Aug 23 03:02:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 12951656 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7AB3CC28D13 for ; Tue, 23 Aug 2022 03:02:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 16F438D0008; Mon, 22 Aug 2022 23:02:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 080C48D0001; Mon, 22 Aug 2022 23:02:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AE2638D0001; Mon, 22 Aug 2022 23:02:41 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 630A58D0001 for ; Mon, 22 Aug 2022 23:02:41 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 3BE83161379 for ; Tue, 23 Aug 2022 03:02:41 +0000 (UTC) X-FDA: 79829359722.05.C1845EA Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by imf16.hostedemail.com (Postfix) with ESMTP id 989D6180009 for ; Tue, 23 Aug 2022 03:02:40 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.53]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4MBYpg5lkbz1N7Yg; Tue, 23 Aug 2022 10:59:07 +0800 (CST) Received: from huawei.com (10.175.124.27) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Tue, 23 Aug 2022 11:02:35 +0800 From: Miaohe Lin To: , , CC: , , , Subject: [PATCH v2 1/6] mm/hugetlb: fix incorrect update of max_huge_pages Date: Tue, 23 Aug 2022 11:02:04 +0800 Message-ID: <20220823030209.57434-2-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220823030209.57434-1-linmiaohe@huawei.com> References: <20220823030209.57434-1-linmiaohe@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1661223760; a=rsa-sha256; cv=none; b=ZnqWEHsHoLQAMtG3jWjqxzv+eE4+XJxBlWdlxrsAjcfI53CrgwEkjwvgq623haDWqTjFzl heOy0zUmJCdsdTmZkO4JJ36hwXRNMPARxngv3UWb1uulHZmdW85PBZq6bivNvYsinznGB5 x1vL3jbhaozsjHdoLqBnAjmWMIvfgXU= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf16.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.255 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661223760; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=keVTywJflwEJgCckn2VIGDICCp5S9FDDsuQUkAZ/RHk=; b=4euD5mtC8rzqzzDcH9hfSUVmdI01B9IXhruwVdZhvXybjLjmg8rakz29ftyzwmnKiO6XAt Vl4m+g6O2BLm42yxCtSNoZReXHV1QR36a8zB9y/iaBoyp6AW740nseDPMwX9QpiT2RnAoX yitjx8My6BUJ3KwWRELlvJY4a9JZcmQ= X-Rspam-User: Authentication-Results: imf16.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf16.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.255 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 989D6180009 X-Stat-Signature: pe4auop1mn8e8kzuins6jhee9t59ozme X-HE-Tag: 1661223760-494626 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: There should be pages_per_huge_page(h) / pages_per_huge_page(target_hstate) pages incremented for target_hstate->max_huge_pages when page is demoted. Update max_huge_pages accordingly for consistency. Signed-off-by: Miaohe Lin Reviewed-by: Muchun Song --- mm/hugetlb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index f8f1540108ab..19a7a83af569 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -3473,7 +3473,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; }