From patchwork Tue Jul 5 11:31:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: patrick wang X-Patchwork-Id: 12906429 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 7056FCCA47C for ; Tue, 5 Jul 2022 11:32:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CF57F6B0071; Tue, 5 Jul 2022 07:32:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CA44C6B0073; Tue, 5 Jul 2022 07:32:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B6BC16B0074; Tue, 5 Jul 2022 07:32:38 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id AA41E6B0071 for ; Tue, 5 Jul 2022 07:32:38 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 70A9921472 for ; Tue, 5 Jul 2022 11:32:38 +0000 (UTC) X-FDA: 79652833596.04.FB325DE Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) by imf09.hostedemail.com (Postfix) with ESMTP id 17AA114005E for ; Tue, 5 Jul 2022 11:32:37 +0000 (UTC) Received: by mail-pl1-f172.google.com with SMTP id j12so3960912plj.8 for ; Tue, 05 Jul 2022 04:32:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ric4fzw9LJrNcSTyTbiVbmxdWQkgNYXNndpMyI1IIbo=; b=bno77WZ9RFLUA1l5FIyvVKOlbQeZOgroHT8krb9x/2BeGPyEyF3d4DMC/A6FJPLsIy Xh68b6iMHQDHj6wr4x0VhPEDYyIcjrLT37xsEAvLNUArogpa23P8Il09lM0o+gNssS0c 0tuD3JCPSpIqHWokuxBFhr6jv7arq2VtVzQiYVkDR+pepwn+xsRP4CflanZGLpfngjWO bHq5EH89mKUZHb1HEFXYk9Ovy0bYsflOcQRJ0pLomQ90Dso8+QCeR+xy5hQt+Dpi4uCI zH0WRDo1y3pVD3Q3jWm8nUkRAsKpWjh28ibSovr6OrIEATo/+SoKGJJp+2rVyVNPIKYC FGqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ric4fzw9LJrNcSTyTbiVbmxdWQkgNYXNndpMyI1IIbo=; b=eWjUE8jRgsGAs+1/ZQoZGHbvKdXCGt6rAiY9ziRlrkmS3187679i1xZreNw+LsQtx0 GpHxAx3+WGaGrXqt5QJqstB7MrVgDETr5ssa5AfI85MMU5LyLUsgcqAiOe0bcXNRMM0g JateKArbEp/8ZjfVNpyn7qBtCtGCUuvzfNtMLjgCmqwlHKmnMAZcF43JfU0MSTamnU26 cFYJKq4h2BZV3MF7sOCBTGj7vzMCTNGYBXjB2UYP0mLIm8NmRq1QyzA23TN8KuZFmFuM iNCbSzYC3pWVK3mF+oHbI0TKaaJp28dQg/1e/MR9S/MKiCvf6Nzj2V4uoR0lzSleWA9a AusQ== X-Gm-Message-State: AJIora9SxeSjuRg+x9LQU4q+cgac2Y09EPDpdBcDK3HyWgRzfj0qCvYm lhEssSeoS/xn29CGp3MZwxY= X-Google-Smtp-Source: AGRyM1syeOueifblOfmGpwHkIsqecYbc6DEx/9cbc/zkvhAdvSCi4VFFxj0dlcUjXP518boRxTLjyQ== X-Received: by 2002:a17:902:d405:b0:16b:f1ee:27c0 with SMTP id b5-20020a170902d40500b0016bf1ee27c0mr2873828ple.10.1657020757077; Tue, 05 Jul 2022 04:32:37 -0700 (PDT) Received: from localhost ([101.86.201.206]) by smtp.gmail.com with ESMTPSA id p10-20020a170902bd0a00b00161ac982b9esm23121878pls.185.2022.07.05.04.32.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Jul 2022 04:32:36 -0700 (PDT) From: Patrick Wang To: dennis@kernel.org, tj@kernel.org, cl@linux.com, akpm@linux-foundation.org Cc: catalin.marinas@arm.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, patrick.wang.shcn@gmail.com Subject: [PATCH] mm: percpu: use kmemleak_ignore_phys() instead of kmemleak_free() Date: Tue, 5 Jul 2022 19:31:58 +0800 Message-Id: <20220705113158.127600-1-patrick.wang.shcn@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1657020758; a=rsa-sha256; cv=none; b=qweOHmTFDPEpPM5bnMSCe5dCYNSCX/PRm649mQgXSgjfwtbZTGv14NI/eOKAGHuwyssrpC 8WNPkztNce95lFzsh5eroCXtwZwTL5zv5umHVG8ZWRBjkkvtxmuhc7euQ/eKUpfDjhOV68 rlDJyHQ26+5EOHNjeasPttGSI4/OxbM= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=bno77WZ9; spf=pass (imf09.hostedemail.com: domain of patrick.wang.shcn@gmail.com designates 209.85.214.172 as permitted sender) smtp.mailfrom=patrick.wang.shcn@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1657020758; 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-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=ric4fzw9LJrNcSTyTbiVbmxdWQkgNYXNndpMyI1IIbo=; b=qHfO9RsHbF8k7DDVT/PW9tMxnLQFzuEQw84V04eWm/rxERSJun2XINsB7rQyxhEsHA8Uu+ V4tkljDKNiem06VZraCPIhp96wfZpE7FcfcIBa6XLIZJkjkxunMthIJ2R+LL9gAYq+P/oB DR35jJlpx70BusPSmCVIohEUM2iA/J4= X-Stat-Signature: b6d7mhrp7wrjigiq7r1gxqcoufpq19uj X-Rspamd-Queue-Id: 17AA114005E Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=bno77WZ9; spf=pass (imf09.hostedemail.com: domain of patrick.wang.shcn@gmail.com designates 209.85.214.172 as permitted sender) smtp.mailfrom=patrick.wang.shcn@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspam-User: X-Rspamd-Server: rspam12 X-HE-Tag: 1657020757-850355 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: Kmemleak recently added a rbtree to store the objects allocted with physical address. Those objects can't be freed with kmemleak_free(). Use kmemleak_ignore_phys() instead of kmemleak_free() for those objects. Signed-off-by: Patrick Wang Reviewed-by: Catalin Marinas --- Similar to: https://lkml.kernel.org/r/20220628113714.7792-2-yee.lee@mediatek.com mm/percpu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/percpu.c b/mm/percpu.c index 3633eeefaa0d..27697b2429c2 100644 --- a/mm/percpu.c +++ b/mm/percpu.c @@ -3104,7 +3104,7 @@ int __init pcpu_embed_first_chunk(size_t reserved_size, size_t dyn_size, goto out_free_areas; } /* kmemleak tracks the percpu allocations separately */ - kmemleak_free(ptr); + kmemleak_ignore_phys(__pa(ptr)); areas[group] = ptr; base = min(ptr, base); @@ -3304,7 +3304,7 @@ int __init pcpu_page_first_chunk(size_t reserved_size, pcpu_fc_cpu_to_node_fn_t goto enomem; } /* kmemleak tracks the percpu allocations separately */ - kmemleak_free(ptr); + kmemleak_ignore_phys(__pa(ptr)); pages[j++] = virt_to_page(ptr); } } @@ -3417,7 +3417,7 @@ void __init setup_per_cpu_areas(void) if (!ai || !fc) panic("Failed to allocate memory for percpu areas."); /* kmemleak tracks the percpu allocations separately */ - kmemleak_free(fc); + kmemleak_ignore_phys(__pa(fc)); ai->dyn_size = unit_size; ai->unit_size = unit_size;