[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130923153853.GC14547@htj.dyndns.org>
Date: Mon, 23 Sep 2013 11:38:53 -0400
From: Tejun Heo <tj@...nel.org>
To: Tang Chen <tangchen@...fujitsu.com>
Cc: rjw@...k.pl, lenb@...nel.org, tglx@...utronix.de, mingo@...e.hu,
hpa@...or.com, akpm@...ux-foundation.org, toshi.kani@...com,
zhangyanfei@...fujitsu.com, liwanp@...ux.vnet.ibm.com,
trenn@...e.de, yinghai@...nel.org, jiang.liu@...wei.com,
wency@...fujitsu.com, laijs@...fujitsu.com,
isimatu.yasuaki@...fujitsu.com, izumi.taku@...fujitsu.com,
mgorman@...e.de, minchan@...nel.org, mina86@...a86.com,
gong.chen@...ux.intel.com, vasilis.liaskovitis@...fitbricks.com,
lwoodman@...hat.com, riel@...hat.com, jweiner@...hat.com,
prarit@...hat.com, x86@...nel.org, linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-mm@...ck.org,
linux-acpi@...r.kernel.org
Subject: Re: [PATCH v3 1/5] memblock: Introduce allocation direction to
memblock.
Hello,
Sorry about the delay. Was traveling.
On Fri, Sep 13, 2013 at 05:30:51PM +0800, Tang Chen wrote:
> +/* Allocation order. */
> +#define MEMBLOCK_DIRECTION_HIGH_TO_LOW 0
> +#define MEMBLOCK_DIRECTION_LOW_TO_HIGH 1
> +#define MEMBLOCK_DIRECTION_DEFAULT MEMBLOCK_DIRECTION_HIGH_TO_LOW
Can we please settle on either top_down/bottom_up or
high_to_low/low_to_high? The two seem to be used interchangeably in
the patch series. Also, it'd be more customary to use enum for things
like above, but more on the interface below.
> +static inline bool memblock_direction_bottom_up(void)
> +{
> + return memblock.current_direction == MEMBLOCK_DIRECTION_LOW_TO_HIGH;
> +}
Maybe just memblock_bottom_up() would be enough?
Also, why not also have memblock_set_bottom_up(bool enable) as the
'set' interface?
> /**
> + * memblock_set_current_direction - Set current allocation direction to allow
> + * allocating memory from higher to lower
> + * address or from lower to higher address
> + *
> + * @direction: In which order to allocate memory. Could be
> + * MEMBLOCK_DIRECTION_{HIGH_TO_LOW|LOW_TO_HIGH}
> + */
> +void memblock_set_current_direction(int direction);
Function comments should go with the function definition. Dunno what
happened with set_current_limit but let's please not spread it.
> +void __init_memblock memblock_set_current_direction(int direction)
> +{
> + if (direction != MEMBLOCK_DIRECTION_HIGH_TO_LOW &&
> + direction != MEMBLOCK_DIRECTION_LOW_TO_HIGH) {
> + pr_warn("memblock: Failed to set allocation order. "
> + "Invalid order type: %d\n", direction);
> + return;
> + }
> +
> + memblock.current_direction = direction;
> +}
If set_bottom_up() style interface is used, the above will be a lot
simpler, right? Also, it's kinda weird to have two separate patches
to introduce the flag and actually implement bottom up allocation.
Thanks.
--
tejun
--
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