From mboxrd@z Thu Jan 1 00:00:00 1970 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 9384FC43334 for ; Sat, 25 Jun 2022 06:38:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D8EC28E0292; Sat, 25 Jun 2022 02:38:37 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D3D088E028E; Sat, 25 Jun 2022 02:38:37 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BB7F18E0292; Sat, 25 Jun 2022 02:38:37 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id A68F08E028E for ; Sat, 25 Jun 2022 02:38:37 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 6E8F434D2A for ; Sat, 25 Jun 2022 06:38:37 +0000 (UTC) X-FDA: 79615804674.22.1BA1439 Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) by imf07.hostedemail.com (Postfix) with ESMTP id 1C05040007 for ; Sat, 25 Jun 2022 06:38:36 +0000 (UTC) Received: by mail-pl1-f178.google.com with SMTP id c4so3849141plc.8 for ; Fri, 24 Jun 2022 23:38:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=nut5kDzyjWGKSE89dkEl9hgFYVipo4uRdXMhdN0CtF8=; b=B1neMVHcMORyelS8eOpCDybJFSjRkeDCckipXzpceUt+t3rFCqM5pczwluTtqv8j6N 1l0c4W7m80xJwMhE82WvrvToEbv04kijbH+5XoilRdlY82dBADKac4sYAWQp6McMniMA BtsQrl6PNYMVhVVrOqoIYhjx4hm+m/6sfNoo75FDBGAi1ceWQt719UKT7UA5mSUTGEBR EdTA+Knu+vqufDme5aoNfN4nYFW8u/7qQkG8RbKrntyyM/5h2or/A0tzYTOqfwqwzyhI GEsWxcjbW38JVzRf4v3QfZ+dr+YfjWlWKBEDy0Kn66P7CXDXl8vEMizbBQwtWFcMlUl8 +POw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=nut5kDzyjWGKSE89dkEl9hgFYVipo4uRdXMhdN0CtF8=; b=OdK+NO3xVGhhtBMZYMosLNYLA12YusSt5WI7T33CVXgAyyMCP1x06BIG8rpZ+4YRbD aI96M4qTjJDNIkIqvw/D8YAn/+DvuqJ0Cduh27YDRi/sbAkwI5ZIoJFNyxNODAXyESkD RtAgz50KYo/qhxoaCg9iNL273sOqUIf4dm69Aj/nDTMQDEbUfNBS2ovs25WxTUFMeLds QDrUnPqjB+j97KYiXjAyoyRpCiykfcklHSoKQsbKyBXj1F54qklZ27bXAs4KvrGUiJlw DvMUISRNOwb5+w8X+k86nRogb4ZNqiByvpGBjrm8g1oGZH0DRsBe3zZwsRVThWEzkJv6 yLLg== X-Gm-Message-State: AJIora/L9y8QL3uAwy1CiH5LpSDxV0B0+Kofm+WZB63Psk6nFzr/ye7L agutYVQ2/kHWbikQrAqeEjQ= X-Google-Smtp-Source: AGRyM1u+uvJmg4vfpayP2/4SySDJpTxBHsSoeb+Ncv7VlwWT1xE8S54uZUIKf6JaxXO63fbS3zNn/Q== X-Received: by 2002:a17:90b:3e86:b0:1ec:f7e8:e4e4 with SMTP id rj6-20020a17090b3e8600b001ecf7e8e4e4mr8405003pjb.218.1656139115981; Fri, 24 Jun 2022 23:38:35 -0700 (PDT) Received: from [192.168.1.104] ([101.228.25.62]) by smtp.gmail.com with ESMTPSA id a20-20020a17090a481400b001e882d2eb02sm2858118pjh.23.2022.06.24.23.38.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 24 Jun 2022 23:38:35 -0700 (PDT) Message-ID: <50b253d5-7719-ac79-d72a-a28b83af1049@gmail.com> Date: Sat, 25 Jun 2022 14:38:29 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH v4 3/4] mm: kmemleak: add rbtree and store physical address for objects allocated with PA Content-Language: en-US To: Yee Lee , catalin.marinas@arm.com, akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20220611035551.1823303-1-patrick.wang.shcn@gmail.com> <20220611035551.1823303-4-patrick.wang.shcn@gmail.com> <09d9066b3e55966c108670219711482791d38880.camel@mediatek.com> <10660122efb538669144e4c46558b83400125d79.camel@mediatek.com> From: Patrick Wang In-Reply-To: <10660122efb538669144e4c46558b83400125d79.camel@mediatek.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1656139117; a=rsa-sha256; cv=none; b=Bwk0NXdTr1ws9PxhTnhlxKL3Hrv/GFbCYBIXYLws1kZs8Y44eLV3Jpdjf4/Yfe/ZeuscNP +2V/se2CV70CnHxaoLpsppFjeWxleKbtyzN4A0uVRJn8gtuAH8mBitqhEczinZtuQBo7wb qXL3qjWw7/e9Mj6edxlBK1rHGNbZ82c= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=B1neMVHc; spf=pass (imf07.hostedemail.com: domain of patrick.wang.shcn@gmail.com designates 209.85.214.178 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=1656139117; 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:in-reply-to:references:references:dkim-signature; bh=nut5kDzyjWGKSE89dkEl9hgFYVipo4uRdXMhdN0CtF8=; b=r6ep1Wsimxvz4CA1b+kg358T+gaAyWBy3C0+AWIvUbrDJlPZtRaQebxtgy2fz2LA2e6hQo tw5QGwBjRvLndfI+rvjQ8zGHi2HZRtAd6531dV01+6gFPd0pDBiUpy9kXEBaem+CErKmVp 2y7kqrGr9Pl3WZdoP/8U6HGTHfOoZ7g= X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 1C05040007 Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=B1neMVHc; spf=pass (imf07.hostedemail.com: domain of patrick.wang.shcn@gmail.com designates 209.85.214.178 as permitted sender) smtp.mailfrom=patrick.wang.shcn@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspam-User: X-Stat-Signature: jp9scaernzwffnzdiiyfc44z1mc6q6as X-HE-Tag: 1656139116-67505 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000004, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 2022/6/23 19:25, Yee Lee wrote: > On Thu, 2022-06-23 at 16:45 +0800, Yee Lee wrote: >> Now we have seperated rb_tree for phys and virts addresses. But why >> can't we have kmemleak_free_phys()? It may apply the same format to >> delete_object_full(). >> >> Some users would request to remove the kmemleak object from the phys >> tree but we don't have this one. > > Please check this, an issue happened at kfence with the latest kmemleak > patches. kfence pool allocated memory from memblock but have no way to > free it from the phys tree. > https://lkml.org/lkml/2022/6/23/486 Hi Yee, Thanks for your information. Similar situation appears in percpu.c (address allocated with memblock, object freed with kmemleak_free(), if I didn't miss others). Kmemleak_ignore_phys() could replace kmemleak_free() for physical objects like Catalin said. And adding kmemleak_free_phys() might not be essential, because there are few places that meet the above situation. Thanks, Patrick