From patchwork Fri Aug 19 09:40:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Shixin X-Patchwork-Id: 12948575 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 12C4BC25B0E for ; Fri, 19 Aug 2022 09:05:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 657AD8D0003; Fri, 19 Aug 2022 05:05:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5DFEB8D0001; Fri, 19 Aug 2022 05:05:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 480EE8D0003; Fri, 19 Aug 2022 05:05:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 31A798D0001 for ; Fri, 19 Aug 2022 05:05:40 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 0482E120948 for ; Fri, 19 Aug 2022 09:05:39 +0000 (UTC) X-FDA: 79815759240.08.A804478 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf26.hostedemail.com (Postfix) with ESMTP id C0ACE140155 for ; Fri, 19 Aug 2022 09:05:37 +0000 (UTC) Received: from dggpemm500020.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4M8G3C4tRZzlWPm; Fri, 19 Aug 2022 17:01:59 +0800 (CST) Received: from dggpemm100009.china.huawei.com (7.185.36.113) by dggpemm500020.china.huawei.com (7.185.36.49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 19 Aug 2022 17:05:06 +0800 Received: from huawei.com (10.175.113.32) by dggpemm100009.china.huawei.com (7.185.36.113) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 19 Aug 2022 17:05:05 +0800 From: Liu Shixin To: Muchun Song , Matthew Wilcox , Mike Kravetz , Oscar Salvador , Andrew Morton CC: , , Liu Shixin Subject: [PATCH -next v2] bootmem: remove the vmemmap pages from kmemleak in put_page_bootmem Date: Fri, 19 Aug 2022 17:40:05 +0800 Message-ID: <20220819094005.2928241-1-liushixin2@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [10.175.113.32] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemm100009.china.huawei.com (7.185.36.113) X-CFilter-Loop: Reflected ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1660899937; 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: references; bh=DcyWUgzzfvO6KnXW/9nH4kMvM5X3ul8quG7ldc23tJ0=; b=bo9D0jLfgTh6sWN8wgLOZXI2J6zhbmsBXxYA5GiGqiM4d1/3AWn4ve81sET9j2XfwLc43f XDSwgd2FsTrxBNq+9Z34NGeOQZRT9+xZR4qjJu46Cd/FvT4G56evVzHEodCYvSWgobmjRG S6ZdACDI0hdR+slFvckazgx7T1wqGO0= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf26.hostedemail.com: domain of liushixin2@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=liushixin2@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1660899937; a=rsa-sha256; cv=none; b=8Kq0TMQEPpzrnKl6p3j50FMz3aXhuZ7f6Z7mMFSwY40+mET/hvYl1LBrXy8UPfLQPoiVPL qm4YU4x7F1z4uom1Uci1wrH74s/WFW975jcZ80zuhhjpLw+cZYNJ3Pmyml/G/S5a+FuhGO POhnpSMzMs5kxSbpPa2tzUqMwHjeN74= Authentication-Results: imf26.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf26.hostedemail.com: domain of liushixin2@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=liushixin2@huawei.com X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: C0ACE140155 X-Stat-Signature: zjiz53rqfer6p6yhr6c6kyz6hij9wfju X-Rspam-User: X-HE-Tag: 1660899937-313472 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: The vmemmap pages is marked by kmemleak when allocated from memblock. Remove it from kmemleak when free the page. Otherwise, when we reuse the page, kmemleak may report such an error and then stop working. kmemleak: Cannot insert 0xffff98fb6eab3d40 into the object search tree (overlaps existing) kmemleak: Kernel memory leak detector disabled kmemleak: Object 0xffff98fb6be00000 (size 335544320): kmemleak: comm "swapper", pid 0, jiffies 4294892296 kmemleak: min_count = 0 kmemleak: count = 0 kmemleak: flags = 0x1 kmemleak: checksum = 0 kmemleak: backtrace: Fixes: f41f2ed43ca5 (mm: hugetlb: free the vmemmap pages associated with each HugeTLB page) Signed-off-by: Liu Shixin Reviewed-by: Muchun Song --- mm/bootmem_info.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mm/bootmem_info.c b/mm/bootmem_info.c index f18a631e7479..b1efebfcf94b 100644 --- a/mm/bootmem_info.c +++ b/mm/bootmem_info.c @@ -12,6 +12,7 @@ #include #include #include +#include void get_page_bootmem(unsigned long info, struct page *page, unsigned long type) { @@ -33,6 +34,7 @@ void put_page_bootmem(struct page *page) ClearPagePrivate(page); set_page_private(page, 0); INIT_LIST_HEAD(&page->lru); + kmemleak_free_part(page_to_virt(page), PAGE_SIZE); free_reserved_page(page); } }