[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.02.1401021400160.21537@chino.kir.corp.google.com>
Date: Thu, 2 Jan 2014 14:03:53 -0800 (PST)
From: David Rientjes <rientjes@...gle.com>
To: Grygorii Strashko <grygorii.strashko@...com>
cc: Santosh Shilimkar <santosh.shilimkar@...com>,
akpm@...ux-foundation.org, tj@...nel.org, linux-mm@...ck.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
Yinghai Lu <yinghai@...nel.org>
Subject: Re: [PATCH] mm/memblock: use WARN_ONCE when MAX_NUMNODES passed as
input parameter
On Mon, 30 Dec 2013, Grygorii Strashko wrote:
> > > diff --git a/mm/memblock.c b/mm/memblock.c
> > > index 71b11d9..6af873a 100644
> > > --- a/mm/memblock.c
> > > +++ b/mm/memblock.c
> > > @@ -707,11 +707,9 @@ void __init_memblock __next_free_mem_range(u64 *idx,
> > > int nid,
> > > struct memblock_type *rsv = &memblock.reserved;
> > > int mi = *idx & 0xffffffff;
> > > int ri = *idx >> 32;
> > > - bool check_node = (nid != NUMA_NO_NODE) && (nid != MAX_NUMNODES);
> > >
> > > - if (nid == MAX_NUMNODES)
> > > - pr_warn_once("%s: Usage of MAX_NUMNODES is depricated. Use
> > > NUMA_NO_NODE instead\n",
> > > - __func__);
> > > + if (WARN_ONCE(nid == MAX_NUMNODES, "Usage of MAX_NUMNODES is
> > > deprecated. Use NUMA_NO_NODE instead\n"))
> > > + nid = NUMA_NO_NODE;
> > >
> > > for ( ; mi < mem->cnt; mi++) {
> > > struct memblock_region *m = &mem->regions[mi];
> >
> > Um, why do this at runtime? This is only used for
> > for_each_free_mem_range(), which is used rarely in x86 and memblock-only
> > code. I'm struggling to understand why we can't deterministically fix the
> > callers if this condition is possible.
> >
>
>
> Unfortunately, It's not so simple as from first look :(
> We've modified __next_free_mem_range_x() functions which are part of
> Memblock APIs (like memblock_alloc_xxx()) and Nobootmem APIs.
> These APIs are used as directly as indirectly (as part of callbacks from other
> MM modules like Sparse), as result, it's not trivial to identify all places
> where MAX_NUMNODES will be used as input parameter.
>
These functions are only used for for_each_free_mem_range() and
for_each_free_mem_range_reverse(). I can very easily find which callers
are passing MAX_NUMNODES deterministically.
NACK to doing this at runtime.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists