From patchwork Tue Aug 16 13:05:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 12944896 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 7BA29C28B2B for ; Tue, 16 Aug 2022 13:06:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B37838D0008; Tue, 16 Aug 2022 09:06:24 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id ABF338D0009; Tue, 16 Aug 2022 09:06:24 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 78AFF8D0006; Tue, 16 Aug 2022 09:06:24 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 4DC0C8D0008 for ; Tue, 16 Aug 2022 09:06:24 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 29B52141056 for ; Tue, 16 Aug 2022 13:06:24 +0000 (UTC) X-FDA: 79805479488.03.13054FC Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf11.hostedemail.com (Postfix) with ESMTP id 83D1C401D1 for ; Tue, 16 Aug 2022 13:06:23 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4M6WXf2C2LzkWQq; Tue, 16 Aug 2022 21:02:58 +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, 16 Aug 2022 21:06:17 +0800 From: Miaohe Lin To: , , CC: , , Subject: [PATCH 1/6] mm/hugetlb: fix incorrect update of max_huge_pages Date: Tue, 16 Aug 2022 21:05:48 +0800 Message-ID: <20220816130553.31406-2-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220816130553.31406-1-linmiaohe@huawei.com> References: <20220816130553.31406-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=1660655183; a=rsa-sha256; cv=none; b=dHxwF/2afde6PJN26ufPwGaIrm3yMRPqfrYuCf+6fU8UFyaNspQAMI5NAk2p3QMFyVcoJ6 +FyhFO0jLCTH76QILbngn5qqDw6oqZjuyVIoyhc0PcsxegmQP4Ai4E8LW39Nh/kGUtEZJl pgfbFtfYZG5OTBOfFk3hdKmbbVUtJs0= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf11.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 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=1660655183; 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=pc7exYF4oEoKE7cskg6bxhhDm8ODRTE+5SV0ak+pQSY=; b=m/yscaKWnYqai+A64xnNdM86PCcrvyZIv11WQlUUe3LPrKudo8DRuh4Uj+ffn/1zwhXjL8 XUT9XsI121ly7y3jiYOEBHbPiIqxIIvRfqgGs6hgjzPxBlyeN0hMVUZwwJjgoD8AfAeTvb /D09MNNP11iUWtm8QcgOO9SD+ctMa9A= Authentication-Results: imf11.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf11.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 83D1C401D1 X-Stat-Signature: m4skny1j979f7ukmsd4xrj7j5cujkfnt X-Rspam-User: X-HE-Tag: 1660655183-77902 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 ea1c7bfa1cc3..e72052964fb5 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; }