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: 13300830 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 C128EEB64DD for ; Tue, 4 Jul 2023 09:23:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D803C90000F; Tue, 4 Jul 2023 05:23:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D0A9990000D; Tue, 4 Jul 2023 05:23:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BD0FB90000F; Tue, 4 Jul 2023 05:23:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id AA06190000D for ; Tue, 4 Jul 2023 05:23:26 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 6C2FCA09C4 for ; Tue, 4 Jul 2023 09:23:26 +0000 (UTC) X-FDA: 80973391212.16.DAA9B00 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by imf05.hostedemail.com (Postfix) with ESMTP id 656DA100007 for ; Tue, 4 Jul 2023 09:23:22 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf05.hostedemail.com: domain of liushixin2@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=liushixin2@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1688462604; 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=DCEW6luKPIK1u+WT7WvYB6+sJAa8u8f3YeEv9WEZCx4=; b=gZNttWhiEyc8KVoSMzcNwGJ9A1t/6OOybLysvUrO9FZQFLzkHYsFLrNieHVCBkzWw6oGgK O/rRiAgjUg5Dvi80qchUVvc1b76eqy4lP+McnpF4ImHNyPwBs76TjzuPeMY5fwmSPuseXP 4uLbqYIx129V6smpMtnYd22A3lWsmao= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf05.hostedemail.com: domain of liushixin2@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=liushixin2@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1688462604; a=rsa-sha256; cv=none; b=8OY/B0rmkU3kM2Uigd9DSCsTioG/HwZ2uHcxTRvaDM4s8Exn8fQzQHRuVCYBpZFjw7nFQ9 9rbVtVpgkJ98iR2wN3ihRgJDMNXLFqVrXqLJ6qHqGqLyh/fgkQnZCA5S+8DuQlbthjdJbo DpJq7UxTkTdYBHx7f1hFyAJggizRGDI= 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-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 656DA100007 X-Stat-Signature: dpu5pume5fcaz6y7jask5bzywhw7ts3m X-Rspam-User: X-HE-Tag: 1688462602-100419 X-HE-Meta: U2FsdGVkX19Dimlpetks9UykzyAuJRHjbGixgmr2wu1vDi+aFU2GlSx9iAJdhC/J5tpbrOGNaGMNG8wWj+FvIoCuIfdwvOvVKRpAlsvuQYWwuK2OuRCFhxFRCrtI/QgPZoFtrv4bGBvTOXJGosmYlMVu/0uUG3ChGzmIJ7sHRrwyFjCIbt7lHsvRJyPxJh5GXrNMdsA59tryc+SPjKhBw7N0u6AJjdjV3GQt7hBIo59xDIL6wO8P8Bj8Arjm6ENhOIwsISQEbeONmaSwxAejX3ISd/4j6SmSEpo6FSyoW4y3aXd2WLAoGOBcffK//SXoXP5n8iQYKjpicw+sK9NhAI0g69I4x6k9ilV4v4ZdRtr8oBFZQ879uEtQy8ALZgzW/Fy2LgXMlb+cs+//gj6fQJA4fFciRNh0GDahLOAteBVPVL2p92UMirHwJ2WkrR9iIDhmir3MciViwyFphT7gJP+m6G1qQBaIUZNNDfeted6BCOrBstueSdu0h7hmS3st2XhvHxl+7SyAvE6RS37JaXKr2UHeKU2kD/vGM93EamunJ2sckB3Wsy8Mo9t1n1jxpV6bnDml4w8XGF5gJL+LZps2ja+VpyD+8i5te2sdx3gdHTgpYdLYWxyiYbIArwtw5qWudDc8nodSJCJkZ5LrTBCaCIyYamsflFQzstPtvljpE4F57tlhRzWDO3+LPSuECzbzR1TD9nR01MpR5hok4hDUpvFzy3TSBlMkctaOSfBFji1z7m5+w7g7bzgieaNnLmV5Fi7BjL4/s+Bu0Hnobk/Rm3OY3Ti8Q2YsdZSMG8N+4zNil9o895C3OLjWzfNPpSUcSho06lEaYGnvGcvUihxO6sA8RQe+rJt8jN597P/DLfJ4Tk1dCkjgZM8PcJY6tjCaFiv3Xryo+ECQ80LgK+yVHyMUuoK/jSn+M+BPrj/cfm90JX0jw5aUkyRn7leqRXhKdZkr87THjiBZb57 qBNa1ojF zsE6CdMkrWyfyWrbrxtZQ6YdwfXVIC9Xb7mGz9tAPktle/ctZVwabZ39J9KPWweb78vg44mOkFhlcv8W6xzTOJTqcCe5ccxgmzlBApvdPEwmGcF8hW4Jkda+sLmrKIxNH4uUY9CIkvkFZXRUzMKlhhWXh4amfLVHhMDhK19mh+Q1LBfNKI8gyQ4DXAUvWGvuzsngB 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: 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