Message ID | 20230704101942.2819426-1-liushixin2@huawei.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> 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 <rfc822;ybw1215001957@gmail.com> + 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 <rfc822;linux-kernel@vger.kernel.org>); 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 <linux-kernel@vger.kernel.org>; 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 <liushixin2@huawei.com> To: Muchun Song <songmuchun@bytedance.com>, Matthew Wilcox <willy@infradead.org>, Mike Kravetz <mike.kravetz@oracle.com>, Oscar Salvador <osalvador@suse.de>, Andrew Morton <akpm@linux-foundation.org> CC: <linux-kernel@vger.kernel.org>, <linux-mm@kvack.org>, Liu Shixin <liushixin2@huawei.com> 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: <linux-kernel.vger.kernel.org> 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?= |
Series |
bootmem: remove the vmemmap pages from kmemleak in free_bootmem_page
|
|
Commit Message
Liu Shixin
July 4, 2023, 10:19 a.m. UTC
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 <liushixin2@huawei.com>
---
include/linux/bootmem_info.h | 2 ++
1 file changed, 2 insertions(+)
Comments
On Tue, Jul 4, 2023 at 5:23 PM Liu Shixin <liushixin2@huawei.com> wrote: > > 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 <liushixin2@huawei.com> Acked-by: Muchun Song <songmuchun@bytedance.com> Thanks.
On Tue, 4 Jul 2023 18:19:42 +0800 Liu Shixin <liushixin2@huawei.com> wrote: > 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. So I take it that with CONFIG_HAVE_BOOTMEM_INFO_NODE=n, the issue described in dd0ff4d12dd2 still occurs? That kmemleak reports an error and stops working? So we want a cc:stable on this fix, yes? > 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") > ...
On 2023/7/5 0:28, Andrew Morton wrote: > On Tue, 4 Jul 2023 18:19:42 +0800 Liu Shixin <liushixin2@huawei.com> wrote: > >> 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. > So I take it that with CONFIG_HAVE_BOOTMEM_INFO_NODE=n, the issue > described in dd0ff4d12dd2 still occurs? That kmemleak reports an error > and stops working? Yes, you're right. > > So we want a cc:stable on this fix, yes? Yes. > >> 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") >> ... > . >
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 <linux/mm.h> +#include <linux/kmemleak.h> /* * 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