[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <51FF44B7.8050704@cn.fujitsu.com>
Date: Mon, 05 Aug 2013 14:22:47 +0800
From: Tang Chen <tangchen@...fujitsu.com>
To: robert.moore@...el.com, lv.zheng@...el.com, rjw@...k.pl,
lenb@...nel.org, tglx@...utronix.de, mingo@...e.hu, hpa@...or.com,
akpm@...ux-foundation.org, tj@...nel.org, 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,
zhangyanfei@...fujitsu.com, yanghy@...fujitsu.com
CC: 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 v2 RESEND 13/18] x86, numa, mem_hotplug: Skip all the
regions the kernel resides in.
Hi tj,
I have resent the v2 patch-set. Would you please give some more
comments about the memblock and x86 booting code modification ?
And I'm also discussing with the ACPICA guys about the implementation
on ACPI side. I hope we can catch up with 3.12 this time.
Thanks.
On 08/02/2013 05:14 PM, Tang Chen wrote:
> At early time, memblock will reserve some memory for the kernel,
> such as the kernel code and data segments, initrd file, and so on,
> which means the kernel resides in these memory regions.
>
> Even if these memory regions are hotpluggable, we should not
> mark them as hotpluggable. Otherwise the kernel won't have enough
> memory to boot.
>
> This patch finds out which memory regions the kernel resides in,
> and skip them when finding all hotpluggable memory regions.
>
> Signed-off-by: Tang Chen<tangchen@...fujitsu.com>
> Reviewed-by: Zhang Yanfei<zhangyanfei@...fujitsu.com>
> ---
> mm/memory_hotplug.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
> 1 files changed, 45 insertions(+), 0 deletions(-)
>
> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> index ef9ccf8..10a30ef 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -31,6 +31,7 @@
> #include<linux/firmware-map.h>
> #include<linux/stop_machine.h>
> #include<linux/acpi.h>
> +#include<linux/memblock.h>
>
> #include<asm/tlbflush.h>
>
> @@ -93,6 +94,40 @@ static void release_memory_resource(struct resource *res)
>
> #ifdef CONFIG_ACPI_NUMA
> /**
> + * kernel_resides_in_range - Check if kernel resides in a memory region.
> + * @base: The base address of the memory region.
> + * @length: The length of the memory region.
> + *
> + * This function is used at early time. It iterates memblock.reserved and check
> + * if the kernel has used any memory in [@base, @base + @length).
> + *
> + * Return true if the kernel resides in the memory region, false otherwise.
> + */
> +static bool __init kernel_resides_in_region(phys_addr_t base, u64 length)
> +{
> + int i;
> + phys_addr_t start, end;
> + struct memblock_region *region;
> + struct memblock_type *reserved =&memblock.reserved;
> +
> + for (i = 0; i< reserved->cnt; i++) {
> + region =&reserved->regions[i];
> +
> + if (region->flags != MEMBLOCK_HOTPLUG)
> + continue;
> +
> + start = region->base;
> + end = region->base + region->size;
> + if (end<= base || start>= base + length)
> + continue;
> +
> + return true;
> + }
> +
> + return false;
> +}
> +
> +/**
> * find_hotpluggable_memory - Find out hotpluggable memory from ACPI SRAT.
> *
> * This function did the following:
> @@ -129,6 +164,16 @@ void __init find_hotpluggable_memory(void)
>
> while (ACPI_SUCCESS(acpi_hotplug_mem_affinity(srat_vaddr,&base,
> &size,&offset))) {
> + /*
> + * At early time, memblock will reserve some memory for the
> + * kernel, such as the kernel code and data segments, initrd
> + * file, and so on,which means the kernel resides in these
> + * memory regions. These regions should not be hotpluggable.
> + * So do not mark them as hotpluggable.
> + */
> + if (kernel_resides_in_region(base, size))
> + continue;
> +
> /* Will mark hotpluggable memory regions here */
> }
>
--
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