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 1242CC433EF for ; Mon, 6 Jun 2022 11:55:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 57AAE6B0071; Mon, 6 Jun 2022 07:55:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 529B68D0001; Mon, 6 Jun 2022 07:55:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3EEF76B0074; Mon, 6 Jun 2022 07:55:47 -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 2B65F6B0071 for ; Mon, 6 Jun 2022 07:55:47 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id F3708607B7 for ; Mon, 6 Jun 2022 11:55:46 +0000 (UTC) X-FDA: 79547656692.03.B99F990 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf27.hostedemail.com (Postfix) with ESMTP id 0115A40038 for ; Mon, 6 Jun 2022 11:55:41 +0000 (UTC) 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 2282960F84; Mon, 6 Jun 2022 11:55:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 546C7C385A9; Mon, 6 Jun 2022 11:55:43 +0000 (UTC) Date: Mon, 6 Jun 2022 12:55:39 +0100 From: Catalin Marinas To: Patrick Wang Cc: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, yee.lee@mediatek.com Subject: Re: [PATCH v2 1/4] mm: kmemleak: add OBJECT_PHYS flag for objects allocated with physical address Message-ID: References: <20220603035415.1243913-1-patrick.wang.shcn@gmail.com> <20220603035415.1243913-2-patrick.wang.shcn@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220603035415.1243913-2-patrick.wang.shcn@gmail.com> Authentication-Results: imf27.hostedemail.com; dkim=none; spf=pass (imf27.hostedemail.com: domain of cmarinas@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=cmarinas@kernel.org; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=arm.com (policy=none) X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 0115A40038 X-Rspam-User: X-Stat-Signature: uwcfe8qop54hxh6ykzwtwb6eqgfo91td X-HE-Tag: 1654516541-587977 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: On Fri, Jun 03, 2022 at 11:54:12AM +0800, Patrick Wang wrote: > diff --git a/mm/kmemleak.c b/mm/kmemleak.c > index a182f5ddaf68..1e9e0aa93ae5 100644 > --- a/mm/kmemleak.c > +++ b/mm/kmemleak.c > @@ -172,6 +172,8 @@ struct kmemleak_object { > #define OBJECT_NO_SCAN (1 << 2) > /* flag set to fully scan the object when scan_area allocation failed */ > #define OBJECT_FULL_SCAN (1 << 3) > +/* flag set for object allocated with physical address */ > +#define OBJECT_PHYS (1 << 4) > > #define HEX_PREFIX " " > /* number of bytes to print per line; must be 16 or 32 */ > @@ -575,7 +577,8 @@ static int __save_stack_trace(unsigned long *trace) > * memory block and add it to the object_list and object_tree_root. > */ > static struct kmemleak_object *create_object(unsigned long ptr, size_t size, > - int min_count, gfp_t gfp) > + int min_count, gfp_t gfp, > + bool is_phys) The patch looks fine but I wonder whether we should have different functions for is_phys true/false, we may end up fewer changes overall since most places simply pass is_phys == false: static struct kmemleak_object *__create_object(unsigned long ptr, size_t size, int min_count, gfp_t gfp, bool is_phys); static struct kmemleak_object *create_object(unsigned long ptr, size_t size, int min_count, gfp_t gfp) { return __create_object(ptr, size, min_count, gfp, false); } static struct kmemleak_object *create_object_phys(unsigned long ptr, size_t size, int min_count, gfp_t gfp) { return __create_object(ptr, size, min_count, gfp, true); } Same for the other patches that change a few more functions. -- Catalin