From: Tang Chen <tangchen@cn.fujitsu.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: jiang.liu@huawei.com, wujianguo@huawei.com, hpa@zytor.com,
wency@cn.fujitsu.com, laijs@cn.fujitsu.com,
linfeng@cn.fujitsu.com, yinghai@kernel.org,
isimatu.yasuaki@jp.fujitsu.com, rob@landley.net,
kosaki.motohiro@jp.fujitsu.com, minchan.kim@gmail.com,
mgorman@suse.de, rientjes@google.com, guz.fnst@cn.fujitsu.com,
rusty@rustcorp.com.au, lliubbo@gmail.com,
jaegeuk.hanse@gmail.com, tony.luck@intel.com,
glommer@parallels.com, linux-kernel@vger.kernel.org,
linux-mm@kvack.org
Subject: Re: [PATCH 2/3] acpi, memory-hotplug: Extend movablemem_map ranges to the end of node.
Date: Mon, 28 Jan 2013 09:53:46 +0800 [thread overview]
Message-ID: <5105DA2A.9030105@cn.fujitsu.com> (raw)
In-Reply-To: <20130125163615.4f82bf9d.akpm@linux-foundation.org>
Hi Andrew,
On 01/26/2013 08:36 AM, Andrew Morton wrote:
>
> The patch generates a bunch of rejects, partly due to linux-next
> changes but I think I fixed everything up OK.
Thank you for your fixing. :)
>
>> index 4ddf497..f841d0e 100644
>> --- a/arch/x86/mm/srat.c
>> +++ b/arch/x86/mm/srat.c
>> @@ -141,11 +141,16 @@ static inline int save_add_info(void) {return 1;}
>> static inline int save_add_info(void) {return 0;}
>> #endif
>>
>> +#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
>> +extern struct movablemem_map movablemem_map;
>> +#endif /* CONFIG_HAVE_MEMBLOCK_NODE_MAP */
>
> Well.
>
> a) we shouldn't put extern declarations in C files - put them in
> headers so we can be assured that all compilation units agree on the
> type.
OK, got it. :)
>
> b) the ifdefs are unneeded - a unused extern declaration is OK (as
> long as the type itself is always defined!)
I think struct movablemem_map is defined in mm.h, protected by
CONFIG_HAVE_MEMBLOCK_NODE_MAP.
So the declaration needs to be protected by CONFIG_HAVE_MEMBLOCK_NODE_MAP.
>
> c) movablemem_map is already declared in memblock.h.
Hum, yes, it is defined in mm.h, included by memblock.h :)
>
> So I zapped the above three lines.
>
>> @@ -178,9 +185,57 @@ acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma)
>>
>> node_set(node, numa_nodes_parsed);
>>
>> - printk(KERN_INFO "SRAT: Node %u PXM %u [mem %#010Lx-%#010Lx]\n",
>> + printk(KERN_INFO "SRAT: Node %u PXM %u [mem %#010Lx-%#010Lx] %s\n",
>> node, pxm,
>> - (unsigned long long) start, (unsigned long long) end - 1);
>> + (unsigned long long) start, (unsigned long long) end - 1,
>> + hotpluggable ? "Hot Pluggable": "");
>> +
>> +#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
>> + int overlap;
>> + unsigned long start_pfn, end_pfn;
>
> no, we don't put declarations of locals in the middle of C statements
> like this:
>
> arch/x86/mm/srat.c: In function 'acpi_numa_memory_affinity_init':
> arch/x86/mm/srat.c:185: warning: ISO C90 forbids mixed declarations and code
>
> Did your compiler not emit this warning?
Sorry, I think it did, but I missed it.
THanks for fixing that. :)
>
> I fixed this by moving the code into a new function
> "handle_movablemem". Feel free to suggest a more appropriate name!
>
>
> From: Andrew Morton<akpm@linux-foundation.org>
> Subject: acpi-memory-hotplug-extend-movablemem_map-ranges-to-the-end-of-node-fix
>
> clean up code, fix build warning
>
> Cc: "Brown, Len"<len.brown@intel.com>
> Cc: "H. Peter Anvin"<hpa@zytor.com>
> Cc: Ingo Molnar<mingo@elte.hu>
> Cc: Jiang Liu<jiang.liu@huawei.com>
> Cc: Jianguo Wu<wujianguo@huawei.com>
> Cc: KOSAKI Motohiro<kosaki.motohiro@jp.fujitsu.com>
> Cc: Kamezawa Hiroyuki<kamezawa.hiroyu@jp.fujitsu.com>
> Cc: Lai Jiangshan<laijs@cn.fujitsu.com>
> Cc: Len Brown<lenb@kernel.org>
> Cc: Tang Chen<tangchen@cn.fujitsu.com>
> Cc: Thomas Gleixner<tglx@linutronix.de>
> Cc: Wu Jianguo<wujianguo@huawei.com>
> Cc: Yasuaki Ishimatsu<isimatu.yasuaki@jp.fujitsu.com>
> Signed-off-by: Andrew Morton<akpm@linux-foundation.org>
> ---
>
> arch/x86/mm/srat.c | 93 ++++++++++++++++++++++---------------------
> 1 file changed, 49 insertions(+), 44 deletions(-)
>
> diff -puN arch/x86/mm/srat.c~acpi-memory-hotplug-extend-movablemem_map-ranges-to-the-end-of-node-fix arch/x86/mm/srat.c
> --- a/arch/x86/mm/srat.c~acpi-memory-hotplug-extend-movablemem_map-ranges-to-the-end-of-node-fix
> +++ a/arch/x86/mm/srat.c
> @@ -142,50 +142,8 @@ static inline int save_add_info(void) {r
> #endif
>
> #ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
> -extern struct movablemem_map movablemem_map;
> -#endif /* CONFIG_HAVE_MEMBLOCK_NODE_MAP */
> -
> -/* Callback for parsing of the Proximity Domain<-> Memory Area mappings */
> -int __init
> -acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma)
> +static void __init handle_movablemem(int node, u64 start, u64 end)
> {
> - u64 start, end;
> - u32 hotpluggable;
> - int node, pxm;
> -
> - if (srat_disabled())
> - goto out_err;
> - if (ma->header.length != sizeof(struct acpi_srat_mem_affinity))
> - goto out_err_bad_srat;
> - if ((ma->flags& ACPI_SRAT_MEM_ENABLED) == 0)
> - goto out_err;
> - hotpluggable = ma->flags& ACPI_SRAT_MEM_HOT_PLUGGABLE;
> - if (hotpluggable&& !save_add_info())
> - goto out_err;
> -
> - start = ma->base_address;
> - end = start + ma->length;
> - pxm = ma->proximity_domain;
> - if (acpi_srat_revision<= 1)
> - pxm&= 0xff;
> -
> - node = setup_node(pxm);
> - if (node< 0) {
> - printk(KERN_ERR "SRAT: Too many proximity domains.\n");
> - goto out_err_bad_srat;
> - }
> -
> - if (numa_add_memblk(node, start, end)< 0)
> - goto out_err_bad_srat;
> -
> - node_set(node, numa_nodes_parsed);
> -
> - printk(KERN_INFO "SRAT: Node %u PXM %u [mem %#010Lx-%#010Lx] %s\n",
> - node, pxm,
> - (unsigned long long) start, (unsigned long long) end - 1,
> - hotpluggable ? "Hot Pluggable": "");
> -
> -#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
> int overlap;
> unsigned long start_pfn, end_pfn;
>
> @@ -229,7 +187,54 @@ acpi_numa_memory_affinity_init(struct ac
> */
> insert_movablemem_map(start_pfn, end_pfn);
> }
> -#endif /* CONFIG_HAVE_MEMBLOCK_NODE_MAP */
> +}
> +#else /* CONFIG_HAVE_MEMBLOCK_NODE_MAP */
> +static inline void handle_movablemem(int node, u64 start, u64 end)
> +{
> +}
> +#endif /* CONFIG_HAVE_MEMBLOCK_NODE_MAP */
> +
> +/* Callback for parsing of the Proximity Domain<-> Memory Area mappings */
> +int __init
> +acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma)
> +{
> + u64 start, end;
> + u32 hotpluggable;
> + int node, pxm;
> +
> + if (srat_disabled())
> + goto out_err;
> + if (ma->header.length != sizeof(struct acpi_srat_mem_affinity))
> + goto out_err_bad_srat;
> + if ((ma->flags& ACPI_SRAT_MEM_ENABLED) == 0)
> + goto out_err;
> + hotpluggable = ma->flags& ACPI_SRAT_MEM_HOT_PLUGGABLE;
> + if (hotpluggable&& !save_add_info())
> + goto out_err;
> +
> + start = ma->base_address;
> + end = start + ma->length;
> + pxm = ma->proximity_domain;
> + if (acpi_srat_revision<= 1)
> + pxm&= 0xff;
> +
> + node = setup_node(pxm);
> + if (node< 0) {
> + printk(KERN_ERR "SRAT: Too many proximity domains.\n");
> + goto out_err_bad_srat;
> + }
> +
> + if (numa_add_memblk(node, start, end)< 0)
> + goto out_err_bad_srat;
> +
> + node_set(node, numa_nodes_parsed);
> +
> + printk(KERN_INFO "SRAT: Node %u PXM %u [mem %#010Lx-%#010Lx] %s\n",
> + node, pxm,
> + (unsigned long long) start, (unsigned long long) end - 1,
> + hotpluggable ? "Hot Pluggable": "");
> +
> + handle_movablemem(node, start, end);
>
> return 0;
> out_err_bad_srat:
> diff -puN include/linux/mm.h~acpi-memory-hotplug-extend-movablemem_map-ranges-to-the-end-of-node-fix include/linux/mm.h
> diff -puN mm/page_alloc.c~acpi-memory-hotplug-extend-movablemem_map-ranges-to-the-end-of-node-fix mm/page_alloc.c
> _
>
>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2013-01-28 1:54 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-25 9:42 [PATCH 0/3] Support SRAT for movablemem_map boot option Tang Chen
2013-01-25 9:42 ` [PATCH 1/3] acpi, memory-hotplug: Parse SRAT before memblock is ready Tang Chen
2013-01-25 9:42 ` [PATCH 2/3] acpi, memory-hotplug: Extend movablemem_map ranges to the end of node Tang Chen
2013-01-26 0:36 ` Andrew Morton
2013-01-28 1:53 ` Tang Chen [this message]
2013-01-25 9:42 ` [PATCH 3/3] acpi, memory-hotplug: Support getting hotplug info from SRAT Tang Chen
2013-01-26 0:40 ` Andrew Morton
2013-01-26 1:12 ` Andrew Morton
2013-01-26 1:29 ` H. Peter Anvin
2013-01-28 2:07 ` Tang Chen
2013-01-28 17:45 ` Luck, Tony
2013-01-29 6:43 ` Tang Chen
2013-01-29 18:38 ` Luck, Tony
2013-01-29 18:40 ` H. Peter Anvin
2013-01-28 9:15 ` Tang Chen
2013-02-04 23:26 ` Andrew Morton
2013-02-06 2:20 ` Tang Chen
2013-02-06 21:54 ` Andrew Morton
2013-02-07 6:22 ` Tang Chen
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=5105DA2A.9030105@cn.fujitsu.com \
--to=tangchen@cn.fujitsu.com \
--cc=akpm@linux-foundation.org \
--cc=glommer@parallels.com \
--cc=guz.fnst@cn.fujitsu.com \
--cc=hpa@zytor.com \
--cc=isimatu.yasuaki@jp.fujitsu.com \
--cc=jaegeuk.hanse@gmail.com \
--cc=jiang.liu@huawei.com \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=laijs@cn.fujitsu.com \
--cc=linfeng@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lliubbo@gmail.com \
--cc=mgorman@suse.de \
--cc=minchan.kim@gmail.com \
--cc=rientjes@google.com \
--cc=rob@landley.net \
--cc=rusty@rustcorp.com.au \
--cc=tony.luck@intel.com \
--cc=wency@cn.fujitsu.com \
--cc=wujianguo@huawei.com \
--cc=yinghai@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox