From patchwork Tue Jul 4 10:19:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Shixin X-Patchwork-Id: 115642 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp1088442vqx; Tue, 4 Jul 2023 02:33:47 -0700 (PDT) X-Google-Smtp-Source: APBJJlGnMIvS5dV4kQt8KpIK7oRnZQTEZAvGDxSGVeEiX7/x/TzH3hRV5hbIva/YcsBR1MTPRHyr X-Received: by 2002:a25:d104:0:b0:c13:34ad:6dc4 with SMTP id i4-20020a25d104000000b00c1334ad6dc4mr13034262ybg.43.1688463227590; Tue, 04 Jul 2023 02:33:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688463227; cv=none; d=google.com; s=arc-20160816; b=cJJIi5gqffDUMd+lRLCi4vk1D/Y32f/Ba61A8lAsOcw9rJ4Y0GfPwepKFShCXufYlq 0a34h5YT56MrXfTJC2F0Zgy+lAumcZaIdPgWCL985bT0QV2zT32gpF4EOOPCrWjRvLsf 2JycfwMClYuJZ/g8RhIH8eb0WUa/d/8biujar+Vgo7UHTJ1lJ28lSA3ymNBQMeejTpsT Pz4PSFRAfBxxYti/0I701gbvP9dS9wHbGxPg6ZtjwiU61gQVyEMCJXhvsAU0sNwiCxkL 1EvJDUzfXSxDPQ8j4tATteeVYDxarH595vX396F1H+HFM8J8How5MASLLi7lvF13G4aw d5Rg== 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 :message-id:date:subject:cc:to:from; bh=DCEW6luKPIK1u+WT7WvYB6+sJAa8u8f3YeEv9WEZCx4=; fh=ZOZ+RVMaZrlpHZ643WXrYbtwhemRLDC8BFMvg42Wgi0=; b=tDdqyv0Emlr+nwdF8kLmop8FzsZbkfP4+FNYPaCKuIcTuThWJBzS+AjCTitg7YUNh8 mAYz8DskM7GHo8UoIQjq82/++H8kx8jl7nQUv5tKLay3v2XpXNGpBa4eS8DasFjtFOjM a2VGywWnE7SimQ5lP9w62QLcfcusep81EQTUW/T5pcIA7Wv45gQTBnuns72IY+wiaLT4 VeCbacxWgfZavlX+R1uzHktjl8IPu6DO9ZDTKC9EVhq7WkHBReqHURA2CAMP+PPtVJOh T5a7K/67nvQosfUNkLd6lGZrA0ivv/f11OVo57KBY4bwQMT+4MvU2j2PZSCj6G9sHJov Q+Lg== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n37-20020a634d65000000b005406e76606csi19650526pgl.900.2023.07.04.02.33.34; Tue, 04 Jul 2023 02:33:47 -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; 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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231207AbjGDJYU (ORCPT + 99 others); Tue, 4 Jul 2023 05:24:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231486AbjGDJYA (ORCPT ); Tue, 4 Jul 2023 05:24:00 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B2C6E5F for ; Tue, 4 Jul 2023 02:23:18 -0700 (PDT) Received: from dggpemm500009.china.huawei.com (unknown [172.30.72.54]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4QwHN047BMzLnnD; Tue, 4 Jul 2023 17:21:04 +0800 (CST) Received: from huawei.com (10.175.113.32) by dggpemm500009.china.huawei.com (7.185.36.225) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Tue, 4 Jul 2023 17:23:15 +0800 From: Liu Shixin To: Muchun Song , Matthew Wilcox , Mike Kravetz , Oscar Salvador , Andrew Morton CC: , , Liu Shixin Subject: [PATCH] bootmem: remove the vmemmap pages from kmemleak in free_bootmem_page Date: Tue, 4 Jul 2023 18:19:42 +0800 Message-ID: <20230704101942.2819426-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: dggems705-chm.china.huawei.com (10.3.19.182) To dggpemm500009.china.huawei.com (7.185.36.225) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770482017459160962?= X-GMAIL-MSGID: =?utf-8?q?1770482017459160962?= commit dd0ff4d12dd2 ("bootmem: remove the vmemmap pages from kmemleak in put_page_bootmem") fix an overlaps existing problem of kmemleak. But the problem still existed when HAVE_BOOTMEM_INFO_NODE is disabled, because in this case, free_bootmem_page() will call free_reserved_page() directly. Fix the problem by adding kmemleak_free_part() in free_bootmem_page() when HAVE_BOOTMEM_INFO_NODE is disabled. Fixes: f41f2ed43ca5 ("mm: hugetlb: free the vmemmap pages associated with each HugeTLB page") Signed-off-by: Liu Shixin Acked-by: Muchun Song --- include/linux/bootmem_info.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/linux/bootmem_info.h b/include/linux/bootmem_info.h index cc35d010fa94..e1a3c9c9754c 100644 --- a/include/linux/bootmem_info.h +++ b/include/linux/bootmem_info.h @@ -3,6 +3,7 @@ #define __LINUX_BOOTMEM_INFO_H #include +#include /* * Types for free bootmem stored in page->lru.next. These have to be in @@ -59,6 +60,7 @@ static inline void get_page_bootmem(unsigned long info, struct page *page, static inline void free_bootmem_page(struct page *page) { + kmemleak_free_part(page_to_virt(page), PAGE_SIZE); free_reserved_page(page); } #endif