[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAOm6qnm4QzHG=wBucEu3HnS0=B_v6Jhq7oPz3JV2RSBat8z3qA@mail.gmail.com>
Date: Mon, 6 Jan 2025 09:45:02 +0800
From: Weikang Guo <guoweikang.kernel@...il.com>
To: Catalin Marinas <catalin.marinas@....com>
Cc: Mike Rapoport <rppt@...nel.org>, Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] mm/memmap: Prevent double scanning of memmap by kmemleak
Thanskļ¼ Catalin
Catalin Marinas <catalin.marinas@....com> wrote on Friday, 3 January
2025 at 22:28
>
> 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.
>
Thank you for the suggestion! I agree that placing the comment before
the 'if' statement is
a better approach. I will update the patch accordingly.
> > @@ -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.
>
Here is the order I actually refer to `mm/sparse.c`, but after looking at
other files, I think your suggestion is better.
> Apart from these minor things, the patch looks fine.
>
Tanks!
> Reviewed-by: Catalin Marinas <catalin.marinas@....com>
>
> Thanks.
>
> --
> Catalin
---
Guo
Powered by blists - more mailing lists