Re: [PATCH 1/1] page_alloc.c: remove argument topageblock_default_order

From: Mel Gorman
Date: Thu May 10 2012 - 09:35:01 EST


On Thu, May 03, 2012 at 04:37:49PM -0700, Andrew Morton wrote:
> On Thu, 3 May 2012 22:45:12 +0530
> rajman mekaco <rajman.mekaco@xxxxxxxxx> wrote:
>
> > When CONFIG_HUGETLB_PAGE_SIZE_VARIABLE is not defined, then
> > pageblock_default_order has an argument to it.
> >
> > However, free_area_init_core will call it without any argument
> > anyway.
> >
> > Remove the argument to pageblock_default_order when
> > CONFIG_HUGETLB_PAGE_SIZE_VARIABLE is not defined.
> >
> > Signed-off-by: rajman mekaco <rajman.mekaco@xxxxxxxxx>
> > ---
> > mm/page_alloc.c | 2 +-
> > 1 files changed, 1 insertions(+), 1 deletions(-)
> >
> > diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> > index a712fb9..4b95412 100644
> > --- a/mm/page_alloc.c
> > +++ b/mm/page_alloc.c
> > @@ -4274,7 +4274,7 @@ static inline void __init set_pageblock_order(unsigned int order)
> > * at compile-time. See include/linux/pageblock-flags.h for the values of
> > * pageblock_order based on the kernel config
> > */
> > -static inline int pageblock_default_order(unsigned int order)
> > +static inline int pageblock_default_order(void)
> > {
> > return MAX_ORDER-1;
> > }
>
> Interesting. It has been that way since at least 3.1.
>

/me slaps self

> It didn't break the build because pageblock_default_order() is only
> ever invoked by set_pageblock_order(), with:
>
> set_pageblock_order(pageblock_default_order());
>
> and set_pageblock_order() is a macro:
>
> #define set_pageblock_order(x) do {} while (0)
>
> There's yet another reason not to use macros, dammit - they hide bugs.
>
>
> Mel, can you have a think about this please? Can we just kill off
> pageblock_default_order() and fold its guts into
> set_pageblock_order(void)? Only ia64 and powerpc can define
> CONFIG_HUGETLB_PAGE_SIZE_VARIABLE.
>

This looks reasonable to me.

--
Mel Gorman
SUSE Labs
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/