Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3119772rwb; Mon, 15 Aug 2022 18:36:08 -0700 (PDT) X-Google-Smtp-Source: AA6agR5B5G1OlKnWMTiZ0P5Sj+4E92R+h5ram3XQjq9m1mBbKdPsVKK83WMUdEZBVNBysuJCgX3Z X-Received: by 2002:a17:90b:1bcf:b0:1f5:53cf:c01d with SMTP id oa15-20020a17090b1bcf00b001f553cfc01dmr31512540pjb.37.1660613768506; Mon, 15 Aug 2022 18:36:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660613768; cv=none; d=google.com; s=arc-20160816; b=MZrHzBV4rpIiwYVmAgwI+bAcqszzkiMOAjoeqlXeoa6qbOJvIijb26T8c4cCxRO6W1 Q0NqwoA90Tec3Vdg/9Kaa9+LKyWQOxmg7wIZj1/77lj/QBZgjdKRe8JRGBfI+VFqZkWt tUP6hWtKHalbWjDdi1z1v9sgfv2Xba6VxUXHM/OiMrfcAFkOeAdTNBSmJ+nC6NjMObGr RM3Ci+lWOGj23NjD8ZvVi4s3L/QAkKwy6metp0cs97cMl+qjCLTTL/uvPNKxuIYZm9QO JLQnDUgflTfMBMSsPuqQVq3iWUextWWgpWUaMGycFzRsEbtxTqhKt2JvJFrN1f/idkas dTgw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=HyBlAjAKdAGGxX0RKVhivSJI68KCwzDlir36o5xQPgk=; b=wpFjyYqmXoUdgVJ5aEfCygCSTV/J7qcDZhcRVNGlO6uRkYlDfFsAukeb3ZHnimQU9y GKwv4s5lJdlKK26HgLbFQvK521THvg4NCjEv0qG8JSnTCdlba5u3EWfNOztns88RPrEv sWVpE71btcB3xYuTO9rMzeoLFgHC0EHDMrZVfed6ZVLd68xpWhuVGOHH7i/RjuFc9wDy SHeF/Df7A09NMhzEfMITp9UqZ1Ljxn9C78o+sLYS4QK6eSRRt3zniL0tJPzpJWe5i/QV rJKFaHQX+MF7jaiMQMzCGE3YZnNTmPgq2WuXLQIjv76N7Y1Zkx6gdR06y8ElLY/B9aMq CU7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PKxrsOOk; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d1-20020a170903230100b0016d9877e753si13583704plh.46.2022.08.15.18.35.57; Mon, 15 Aug 2022 18:36:08 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PKxrsOOk; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234094AbiHPAYQ (ORCPT + 99 others); Mon, 15 Aug 2022 20:24:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353101AbiHPAUn (ORCPT ); Mon, 15 Aug 2022 20:20:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C220717B822; Mon, 15 Aug 2022 13:33:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8C4CF6117D; Mon, 15 Aug 2022 20:33:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 74EA3C433D6; Mon, 15 Aug 2022 20:33:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660595611; bh=3DYUns0bvxVARDYeCIucXBYeeHnzF1psCJsi+8eGx64=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PKxrsOOkUB5HmtOu4i5MxqWBg1VXMODRJnvNAyaihnKSQ2L3UmvLDFBdSKmz1R9tq UmjgDECoiA0FcCa8lYsEoKWOuk+F8K5t+jZdRbtceZzuw+Vmb2PYeME2VpyGhxo928 CnXDMDfFKy03i+QYbSSbKBAFkvke/xPUb4j1prWQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Patrick Wang , Dennis Zhou , Tejun Heo , Christoph Lameter , Catalin Marinas , Andrew Morton , Sasha Levin Subject: [PATCH 5.19 0819/1157] mm: percpu: use kmemleak_ignore_phys() instead of kmemleak_free() Date: Mon, 15 Aug 2022 20:02:55 +0200 Message-Id: <20220815180512.251603428@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 From: Patrick Wang [ Upstream commit a317ebccaa3609917a2c021af870cf3fa607ab0c ] Kmemleak recently added a rbtree to store the objects allocted with physical address. Those objects can't be freed with kmemleak_free(). According to the comments, percpu allocations are tracked by kmemleak separately. Kmemleak_free() was used to avoid the unnecessary tracking. If kmemleak_free() fails, those objects would be scanned by kmemleak, which is unnecessary but shouldn't lead to other effects. Use kmemleak_ignore_phys() instead of kmemleak_free() for those objects. Link: https://lkml.kernel.org/r/20220705113158.127600-1-patrick.wang.shcn@gmail.com Fixes: 0c24e061196c ("mm: kmemleak: add rbtree and store physical address for objects allocated with PA") Signed-off-by: Patrick Wang Cc: Dennis Zhou Cc: Tejun Heo Cc: Christoph Lameter Cc: Catalin Marinas Signed-off-by: Andrew Morton Signed-off-by: Sasha Levin --- 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; -- 2.35.1