Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp27405881rwd; Tue, 4 Jul 2023 02:28:19 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4Azx8f8mJZpRBPavx0p1ly8Bo8dq+qDTaKCq7dEDugaE1QMB0iQRoY4Bzy3mqmzQJ2yQF6 X-Received: by 2002:a05:6808:b2a:b0:3a3:7505:700a with SMTP id t10-20020a0568080b2a00b003a37505700amr11347915oij.44.1688462898906; Tue, 04 Jul 2023 02:28:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688462898; cv=none; d=google.com; s=arc-20160816; b=hMnoIUfQQUxWYssW8za+EOGQOby+5laNEzbMAPfQeX1U36/eZYXZZTz3xwzI7APB+K 3F0lErL0NadCeDt8wSKDb3BCIyMV3cVHcupQzGOaudAyaSaMfbCmuq0232/T5C49YxnI GdMEiOLXXW7ZTQk22nYXuULK5+qjpa8/fR3O+CclsIAly/u446OuQaJpWMMibdPwOdZ5 sGhDUxcvXKJTDDODr0fHaG+j8MCBI1Es4wrf7zDHDEyGAWAIelZ6GQlV6EJMYTHszK2d PExqbrWbduH8j6YkRlGdebSlZz/mCXBVpmJrt/JEC03MF3wJZwycoC8/zVFFFGx3xcFx MM3Q== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nl2-20020a17090b384200b00263ad259d9esi6607415pjb.0.2023.07.04.02.28.06; Tue, 04 Jul 2023 02:28:18 -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 S231159AbjGDJYU (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 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII 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 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 --- 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 -- 2.25.1