All of lore.kernel.org
 help / color / mirror / Atom feed
From: Catalin Marinas <catalin.marinas@arm.com>
To: Guo Weikang <guoweikang.kernel@gmail.com>
Cc: Mike Rapoport <rppt@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] mm/memmap: Prevent double scanning of memmap by kmemleak
Date: Fri, 3 Jan 2025 14:27:59 +0000	[thread overview]
Message-ID: <Z3fz7_1_-dwnHOtb@arm.com> (raw)
In-Reply-To: <20250103110150.1352226-1-guoweikang.kernel@gmail.com>

On Fri, Jan 03, 2025 at 07:01:50PM +0800, Guo Weikang wrote:
> diff --git a/mm/mm_init.c b/mm/mm_init.c
> index 24b68b425afb..71b58f5f2492 100644
> --- a/mm/mm_init.c
> +++ b/mm/mm_init.c
> @@ -1580,6 +1580,10 @@ static void __init free_area_init_core(struct pglist_data *pgdat)
>  	}
>  }
>  
> +/*
> + * Kmemleak will explicitly scan mem_map by traversing all valid `struct *page`,
> + * so memblock does not need to be added to the scan list.
> + */
>  void __init *memmap_alloc(phys_addr_t size, phys_addr_t align,
>  			  phys_addr_t min_addr, int nid, bool exact_nid)
>  {

Nitpick: normally I'd place the comment in the code, before the 'if'
statement. We keep the comments above functions for a description of
the function.

> @@ -1587,11 +1591,11 @@ void __init *memmap_alloc(phys_addr_t size, phys_addr_t align,
>  
>  	if (exact_nid)
>  		ptr = memblock_alloc_exact_nid_raw(size, align, min_addr,
> -						   MEMBLOCK_ALLOC_ACCESSIBLE,
> +						   MEMBLOCK_ALLOC_NOLEAKTRACE,
>  						   nid);
>  	else
>  		ptr = memblock_alloc_try_nid_raw(size, align, min_addr,
> -						 MEMBLOCK_ALLOC_ACCESSIBLE,
> +						 MEMBLOCK_ALLOC_NOLEAKTRACE,
>  						 nid);
>  
>  	if (ptr && size > 0)
> diff --git a/mm/sparse-vmemmap.c b/mm/sparse-vmemmap.c
> index cec67c5f37d8..903a5422907b 100644
> --- a/mm/sparse-vmemmap.c
> +++ b/mm/sparse-vmemmap.c
> @@ -27,7 +27,7 @@
>  #include <linux/spinlock.h>
>  #include <linux/vmalloc.h>
>  #include <linux/sched.h>
> -
> +#include "internal.h"
>  #include <asm/dma.h>
>  #include <asm/pgalloc.h>

Another nit: if the original authors of this file preferred the includes
to be in blocks, I'd keep the internal.h include as a separate block
after the asm/ includes.

Apart from these minor things, the patch looks fine.

Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>

Thanks.

-- 
Catalin


  reply	other threads:[~2025-01-03 14:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-03 11:01 [PATCH v2] mm/memmap: Prevent double scanning of memmap by kmemleak Guo Weikang
2025-01-03 14:27 ` Catalin Marinas [this message]
2025-01-06  1:45   ` Weikang Guo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z3fz7_1_-dwnHOtb@arm.com \
    --to=catalin.marinas@arm.com \
    --cc=akpm@linux-foundation.org \
    --cc=guoweikang.kernel@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=rppt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.