Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp355735iof; Mon, 6 Jun 2022 04:58:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz9fXwKUvZeGmTUkAvqkxbCS4hKPLckAoFuB+TYLTx/H6TII16mNsC3wioF5kMV/hV9B63n X-Received: by 2002:a17:90b:2316:b0:1e8:41d6:7f34 with SMTP id mt22-20020a17090b231600b001e841d67f34mr16703153pjb.104.1654516733490; Mon, 06 Jun 2022 04:58:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654516733; cv=none; d=google.com; s=arc-20160816; b=mw2x5r2tWCQw41/cEUVxsnlGdrBQk/qFXcmRb8ncrrTxTBjVreSC/LhyLIuBfXaSiE 1n3VIiaGNqnv2zAEpBz+bP4ruVMpTvKqhrRtHkTDpe20scs7amliunY2x7PPRxzHUyiD lMdi9mjIM3fJsBtadnwWvktUgEjE2Z54Yu9Cd12edXwJcr2mKcJOnh0PWycFkA2dkyYU abuIfG/oBXs+saD2hIqNX8eG6yPZiylNj9V2kQtdlCgPa3D9fzHOEDVn1m/l9Ekj81da SLXf/+GrTGCoGtwM1pTH5fTvq+yyJND1PbYO6cyNxdYzdQ0Nu3o7LMV05eFp3CqmnNTo jFVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=xlu15/+lKVtJVGRIM2EJh7uNFJ3vWnmAk6fsZz9mmY0=; b=JsXsofC5SGdxZiWLP8qTkDtLtGi31B78TOi34A4/ogNUTJg7Uw1d8hW6nyxqa+5ZG1 1MAhehvcHHRYoeKwVoQw6Qd6ajeThOO0MathMRWiVbJYWh6PKEnWqjk1ixiz5AQ8Ark5 02sBWOq/P37rozxL1k+tCknZ0nNHrS3UkjqLrf+dgvSxefKyt2zfljpdpf5PUPXvXb34 6uM9MeGAfKwyRclgztO+ZY+/ANU3fVnI+vwNiCdwT7X/6/v6L23Je3YcfIL40WosIn2m ZV5gLe41lMTrtwkDIgJmn/CVb7zgchwXF6ZRaHkUtfbshm7lXnXHvxJ45YcUJU9Rnwx9 8E2Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id b9-20020a170902b60900b00161abfb3230si18487535pls.363.2022.06.06.04.58.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 04:58:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9EA3073796; Mon, 6 Jun 2022 04:55:56 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235859AbiFFLzu (ORCPT + 99 others); Mon, 6 Jun 2022 07:55:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235852AbiFFLzt (ORCPT ); Mon, 6 Jun 2022 07:55:49 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1545D737BE for ; Mon, 6 Jun 2022 04:55:47 -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 sin.source.kernel.org (Postfix) with ESMTPS id 47C18CE1A1F for ; Mon, 6 Jun 2022 11:55:46 +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> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 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