From: Jiang Liu <liuj97@gmail.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: xen-devel@lists.xensource.com,
Jeremy Fitzhardinge <jeremy@goop.org>,
x86@kernel.org, Aurelien Jacquiot <a-jacquiot@ti.com>,
Catalin Marinas <catalin.marinas@arm.com>,
Heiko Carstens <heiko.carstens@de.ibm.com>,
linux-snps-arc@vger.kernel.org,
Tang Chen <tangchen@cn.fujitsu.com>,
David Howells <dhowells@redhat.com>,
Chen Liqin <liqin.chen@sunplusct.com>,
Paul Mackerras <paulus@samba.org>,
"H. Peter Anvin" <hpa@zytor.com>,
Guan Xuetao <gxt@mprc.pku.edu.cn>,
Sam Ravnborg <sam@ravnborg.org>, Lennox Wu <lennox.wu@gmail.com>,
Maciej Rutecki <maciej.rutecki@gmail.com>,
Jonas Bonn <jonas@southpole.se>, Mark Salter <msalter@redhat.com>,
Michel Lespinasse <walken@google.com>,
Mikael Starvik <starvik@axis.com>,
Yoshinori Sato <ysato@users.sourceforge.jp>,
Helge Deller <deller@gmx.de>,
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
"James E.J. Bottomley" <jejb@parisc-linux.org>
Subject: Re: [PATCH v2, part1 01/29] mm: introduce common help functions to deal with reserved/managed pages
Date: Tue, 12 Mar 2013 06:17:43 +0800 [thread overview]
Message-ID: <513E5807.2060303@gmail.com> (raw)
In-Reply-To: <CAMuHMdXLEkKVfhPu-MfBE37SuHDoVtrEG92PZq2-nD3xw6GNQw@mail.gmail.com>
Hi Geert,
Thanks for review!
On 03/10/2013 05:20 PM, Geert Uytterhoeven wrote:
> On Sun, Mar 10, 2013 at 7:26 AM, Jiang Liu <liuj97@gmail.com> wrote:
>> Code to deal with reserved/managed pages are duplicated by many
>> architectures, so introduce common help functions to reduce duplicated
>> code. These common help functions will also be used to concentrate code
>> to modify totalram_pages and zone->managed_pages, which makes the code
>> much more clear.
>>
>> Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
>
> I have a few minor comments (see below), but apart from that:
> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
>
>> ---
>> include/linux/mm.h | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
>> mm/page_alloc.c | 20 ++++++++++++++++++++
>> 2 files changed, 68 insertions(+)
>>
>> diff --git a/include/linux/mm.h b/include/linux/mm.h
>> index 7acc9dc..d75c14b 100644
>> --- a/include/linux/mm.h
>> +++ b/include/linux/mm.h
>> @@ -1295,6 +1295,54 @@ extern void free_area_init_node(int nid, unsigned long * zones_size,
>> unsigned long zone_start_pfn, unsigned long *zholes_size);
>> extern void free_initmem(void);
>>
>> +/*
>> + * Free reserved pages within range [PAGE_ALIGN(start), end & PAGE_MASK)
>> + * into the buddy system. The freed pages will be poisoned with pattern
>> + * "poison" if it's non-zero.
>
> What if you want to poison with zero?
> As poison is a full int, but memset only uses the least-significant
> byte, you can
> change it to poison if it's positive (i.e. >= 0)?
Good point, ARM64 does poison memory with 0. Will implement that way in next version.
>
>> +/*
>> + * Default method to free all the __init memory into the buddy system.
>> + * The freed pages will be poisoned with pattern "poison" if it is
>> + * non-zero. Return pages freed into the buddy system.
>> + */
>> +static inline unsigned long free_initmem_default(int poison)
>> +{
>> + extern char __init_begin[], __init_end[];
>> +
>> + return free_reserved_area(PAGE_ALIGN((unsigned long)&__init_begin) ,
>> + ((unsigned long)&__init_end) & PAGE_MASK,
>
> The "PAGE_ALIGN(...)" and "& PAGE_MASK" are superfluous, as
> free_reserved_area() already does that.
Will remove the redundant ops next version.
>
>> + poison, "unused kernel");
>> +}
>> +
>
>> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
>> index 8fcced7..0fadb09 100644
>> --- a/mm/page_alloc.c
>> +++ b/mm/page_alloc.c
>> @@ -5113,6 +5113,26 @@ early_param("movablecore", cmdline_parse_movablecore);
>>
>> #endif /* CONFIG_HAVE_MEMBLOCK_NODE_MAP */
>>
>> +unsigned long free_reserved_area(unsigned long start, unsigned long end,
>> + int poison, char *s)
>> +{
>
>> + if (pages && s)
>> + pr_info("Freeing %s memory: %ldK (%lx - %lx)\n",
>
> "%luKiB (0x%lx - 0x%lx)"?
Sure.
Regards!
Gerry
>
>> + s, pages << (PAGE_SHIFT - 10), start, end);
>> +
>> + return pages;
>> +}
>
> Gr{oetje,eeting}s,
>
> Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
>
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
> -- Linus Torvalds
>
WARNING: multiple messages have this Message-ID (diff)
From: Jiang Liu <liuj97@gmail.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
David Rientjes <rientjes@google.com>,
Jiang Liu <jiang.liu@huawei.com>,
Wen Congyang <wency@cn.fujitsu.com>,
Maciej Rutecki <maciej.rutecki@gmail.com>,
Chris Clayton <chris2553@googlemail.com>,
"Rafael J . Wysocki" <rjw@sisk.pl>, Mel Gorman <mgorman@suse.de>,
Minchan Kim <minchan@kernel.org>,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
Michal Hocko <mhocko@suse.cz>, Jianguo Wu <wujianguo@huawei.com>,
Anatolij Gustschin <agust@denx.de>,
Aurelien Jacquiot <a-jacquiot@ti.com>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Catalin Marinas <catalin.marinas@arm.com>,
Chen Liqin <liqin.chen@sunplusct.com>,
Chris Metcalf <cmetcalf@tilera.com>,
Chris Zankel <chris@zankel.net>,
David Howells <dhowells@redhat.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Biederman <ebiederm@xmission.com>,
Fenghua Yu <fenghua.yu@intel.com>,
Guan Xuetao <gxt@mprc.pku.edu.cn>,
Haavard Skinnemoen <hskinnemoen@gmail.com>,
Hans-Christian Egtvedt <egtvedt@samfundet.no>,
Heiko Carstens <heiko.carstens@de.ibm.com>,
Helge Deller <deller@gmx.de>,
James Hogan <james.hogan@imgtec.com>,
Hirokazu Takata <takata@linux-m32r.org>,
"H. Peter Anvin" <hpa@zytor.com>, Ingo Molnar <mingo@redhat.com>,
Ivan Kokshaysky <ink@jurassic.park.msu.ru>,
"James E.J. Bottomley" <jejb@parisc-linux.org>,
Jeff Dike <jdike@addtoit.com>,
Jeremy Fitzhardinge <jeremy@goop.org>,
Jonas Bonn <jonas@southpole.se>,
Koichi Yasutake <yasutake.koichi@jp.panasonic.com>,
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
Lennox Wu <lennox.wu@gmail.com>, Mark Salter <msalter@redhat.com>,
Martin Schwidefsky <schwidefsky@de.ibm.com>,
Matt Turner <mattst88@gmail.com>,
Max Filippov <jcmvbkbc@gmail.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
Michal Simek <monstr@monstr.eu>,
Michel Lespinasse <walken@google.com>,
Mikael Starvik <starvik@axis.com>,
Mike Frysinger <vapier@gentoo.org>,
Paul Mackerras <paulus@samba.org>,
Paul Mundt <lethal@linux-sh.org>,
Ralf Baechle <ralf@linux-mips.org>,
Richard Henderson <rth@twiddle.net>,
Rik van Riel <riel@redhat.com>,
Russell King <linux@arm.linux.org.uk>,
Rusty Russell <rusty@rustcorp.com.au>,
Sam Ravnborg <sam@ravnborg.org>,
Tang Chen <tangchen@cn.fujitsu.com>,
Thomas Gleixner <tglx@linutronix.de>,
Tony Luck <tony.luck@intel.com>,
Will Deacon <will.deacon@arm.com>,
Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>,
Yinghai Lu <yinghai@kernel.org>,
Yoshinori Sato <ysato@users.sourceforge.jp>,
x86@kernel.org, xen-devel@lists.xensource.com,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
linux-arm-kernel@lists.infradead.org,
Vineet Gupta <vgupta@synopsys.com>,
linux-snps-arc@vger.kernel.org,
virtualization@lists.linux-foundation.org
Subject: Re: [PATCH v2, part1 01/29] mm: introduce common help functions to deal with reserved/managed pages
Date: Tue, 12 Mar 2013 06:17:43 +0800 [thread overview]
Message-ID: <513E5807.2060303@gmail.com> (raw)
In-Reply-To: <CAMuHMdXLEkKVfhPu-MfBE37SuHDoVtrEG92PZq2-nD3xw6GNQw@mail.gmail.com>
Hi Geert,
Thanks for review!
On 03/10/2013 05:20 PM, Geert Uytterhoeven wrote:
> On Sun, Mar 10, 2013 at 7:26 AM, Jiang Liu <liuj97@gmail.com> wrote:
>> Code to deal with reserved/managed pages are duplicated by many
>> architectures, so introduce common help functions to reduce duplicated
>> code. These common help functions will also be used to concentrate code
>> to modify totalram_pages and zone->managed_pages, which makes the code
>> much more clear.
>>
>> Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
>
> I have a few minor comments (see below), but apart from that:
> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
>
>> ---
>> include/linux/mm.h | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
>> mm/page_alloc.c | 20 ++++++++++++++++++++
>> 2 files changed, 68 insertions(+)
>>
>> diff --git a/include/linux/mm.h b/include/linux/mm.h
>> index 7acc9dc..d75c14b 100644
>> --- a/include/linux/mm.h
>> +++ b/include/linux/mm.h
>> @@ -1295,6 +1295,54 @@ extern void free_area_init_node(int nid, unsigned long * zones_size,
>> unsigned long zone_start_pfn, unsigned long *zholes_size);
>> extern void free_initmem(void);
>>
>> +/*
>> + * Free reserved pages within range [PAGE_ALIGN(start), end & PAGE_MASK)
>> + * into the buddy system. The freed pages will be poisoned with pattern
>> + * "poison" if it's non-zero.
>
> What if you want to poison with zero?
> As poison is a full int, but memset only uses the least-significant
> byte, you can
> change it to poison if it's positive (i.e. >= 0)?
Good point, ARM64 does poison memory with 0. Will implement that way in next version.
>
>> +/*
>> + * Default method to free all the __init memory into the buddy system.
>> + * The freed pages will be poisoned with pattern "poison" if it is
>> + * non-zero. Return pages freed into the buddy system.
>> + */
>> +static inline unsigned long free_initmem_default(int poison)
>> +{
>> + extern char __init_begin[], __init_end[];
>> +
>> + return free_reserved_area(PAGE_ALIGN((unsigned long)&__init_begin) ,
>> + ((unsigned long)&__init_end) & PAGE_MASK,
>
> The "PAGE_ALIGN(...)" and "& PAGE_MASK" are superfluous, as
> free_reserved_area() already does that.
Will remove the redundant ops next version.
>
>> + poison, "unused kernel");
>> +}
>> +
>
>> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
>> index 8fcced7..0fadb09 100644
>> --- a/mm/page_alloc.c
>> +++ b/mm/page_alloc.c
>> @@ -5113,6 +5113,26 @@ early_param("movablecore", cmdline_parse_movablecore);
>>
>> #endif /* CONFIG_HAVE_MEMBLOCK_NODE_MAP */
>>
>> +unsigned long free_reserved_area(unsigned long start, unsigned long end,
>> + int poison, char *s)
>> +{
>
>> + if (pages && s)
>> + pr_info("Freeing %s memory: %ldK (%lx - %lx)\n",
>
> "%luKiB (0x%lx - 0x%lx)"?
Sure.
Regards!
Gerry
>
>> + s, pages << (PAGE_SHIFT - 10), start, end);
>> +
>> + return pages;
>> +}
>
> Gr{oetje,eeting}s,
>
> Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
>
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
> -- Linus Torvalds
>
--
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-03-11 22:17 UTC|newest]
Thread overview: 84+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-10 6:26 [PATCH v2, part1 00/29] Use helper functions to simplify memory intialization code Jiang Liu
2013-03-10 6:26 ` Jiang Liu
2013-03-10 6:26 ` [PATCH v2, part1 01/29] mm: introduce common help functions to deal with reserved/managed pages Jiang Liu
2013-03-10 6:26 ` Jiang Liu
2013-03-10 9:20 ` Geert Uytterhoeven
2013-03-10 9:20 ` Geert Uytterhoeven
2013-03-10 9:20 ` Geert Uytterhoeven
2013-03-11 22:17 ` Jiang Liu [this message]
2013-03-11 22:17 ` Jiang Liu
2013-03-10 6:26 ` [PATCH v2, part1 02/29] mm/alpha: use common help functions to free reserved pages Jiang Liu
2013-03-10 6:26 ` Jiang Liu
2013-03-10 6:26 ` [PATCH v2, part1 03/29] mm/ARM: " Jiang Liu
2013-03-10 6:26 ` Jiang Liu
2013-03-10 6:26 ` Jiang Liu
2013-04-04 15:47 ` Arnd Bergmann
2013-04-04 15:47 ` Arnd Bergmann
2013-04-04 15:47 ` Arnd Bergmann
2013-04-06 14:07 ` Jiang Liu
2013-04-06 14:07 ` Jiang Liu
2013-04-06 14:07 ` Jiang Liu
2013-03-10 6:26 ` [PATCH v2, part1 04/29] mm/avr32: " Jiang Liu
2013-03-10 6:26 ` Jiang Liu
2013-03-10 6:26 ` [PATCH v2, part1 05/29] mm/blackfin: " Jiang Liu
2013-03-10 6:26 ` Jiang Liu
2013-03-10 6:26 ` [PATCH v2, part1 06/29] mm/c6x: " Jiang Liu
2013-03-10 6:26 ` Jiang Liu
2013-03-10 6:26 ` [PATCH v2, part1 07/29] mm/cris: " Jiang Liu
2013-03-10 6:26 ` Jiang Liu
2013-03-10 6:26 ` [PATCH v2, part1 08/29] mm/FRV: " Jiang Liu
2013-03-10 6:26 ` Jiang Liu
2013-03-10 6:26 ` [PATCH v2, part1 09/29] mm/h8300: " Jiang Liu
2013-03-10 6:26 ` Jiang Liu
2013-03-10 6:26 ` [PATCH v2, part1 10/29] mm/IA64: " Jiang Liu
2013-03-10 6:26 ` Jiang Liu
2013-03-10 6:26 ` [PATCH v2, part1 11/29] mm/m32r: " Jiang Liu
2013-03-10 6:26 ` Jiang Liu
2013-03-10 6:26 ` [PATCH v2, part1 12/29] mm/m68k: " Jiang Liu
2013-03-10 6:26 ` Jiang Liu
2013-03-10 9:21 ` Geert Uytterhoeven
2013-03-10 9:21 ` Geert Uytterhoeven
2013-03-10 6:26 ` [PATCH v2, part1 13/29] mm/microblaze: " Jiang Liu
2013-03-10 6:26 ` Jiang Liu
2013-03-10 6:26 ` [PATCH v2, part1 14/29] mm/MIPS: " Jiang Liu
2013-03-10 6:26 ` Jiang Liu
2013-03-10 6:26 ` [PATCH v2, part1 15/29] mm/mn10300: " Jiang Liu
2013-03-10 6:26 ` Jiang Liu
2013-03-10 6:26 ` [PATCH v2, part1 16/29] mm/openrisc: " Jiang Liu
2013-03-10 6:26 ` Jiang Liu
2013-04-02 5:31 ` Jonas Bonn
2013-04-02 5:31 ` Jonas Bonn
2013-03-10 6:27 ` [PATCH v2, part1 17/29] mm/parisc: " Jiang Liu
2013-03-10 6:27 ` Jiang Liu
2013-03-10 6:27 ` [PATCH v2, part1 18/29] mm/ppc: " Jiang Liu
2013-03-10 6:27 ` Jiang Liu
2013-03-10 6:27 ` [PATCH v2, part1 19/29] mm/s390: " Jiang Liu
2013-03-10 6:27 ` Jiang Liu
2013-03-10 6:27 ` [PATCH v2, part1 20/29] mm/score: " Jiang Liu
2013-03-10 6:27 ` Jiang Liu
2013-03-10 6:27 ` [PATCH v2, part1 21/29] mm/SH: " Jiang Liu
2013-03-10 6:27 ` Jiang Liu
2013-03-10 6:27 ` [PATCH v2, part1 22/29] mm/SPARC: " Jiang Liu
2013-03-10 6:27 ` Jiang Liu
2013-03-10 7:28 ` Sam Ravnborg
2013-03-10 7:28 ` Sam Ravnborg
2013-03-10 6:27 ` [PATCH v2, part1 23/29] mm/um: " Jiang Liu
2013-03-10 6:27 ` Jiang Liu
2013-03-10 6:27 ` [PATCH v2, part1 24/29] mm/unicore32: " Jiang Liu
2013-03-10 6:27 ` Jiang Liu
2013-03-10 6:27 ` [PATCH v2, part1 25/29] mm/x86: " Jiang Liu
2013-03-10 6:27 ` Jiang Liu
2013-03-13 5:38 ` Yasuaki Ishimatsu
2013-03-13 5:38 ` Yasuaki Ishimatsu
2013-03-13 16:45 ` Jiang Liu
2013-03-13 16:45 ` Jiang Liu
2013-03-10 6:27 ` [PATCH v2, part1 26/29] mm/xtensa: " Jiang Liu
2013-03-10 6:27 ` Jiang Liu
2013-03-10 6:27 ` [PATCH v2, part1 27/29] mm/arc: " Jiang Liu
2013-03-10 6:27 ` Jiang Liu
2013-03-10 6:27 ` [PATCH v2, part1 28/29] mm/metag: " Jiang Liu
2013-03-10 6:27 ` Jiang Liu
2013-03-10 6:27 ` [PATCH v2, part1 29/29] mm,kexec: " Jiang Liu
2013-03-10 6:27 ` Jiang Liu
2013-03-11 5:16 ` Zhang Yanfei
2013-03-11 5:16 ` Zhang Yanfei
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=513E5807.2060303@gmail.com \
--to=liuj97@gmail.com \
--cc=a-jacquiot@ti.com \
--cc=catalin.marinas@arm.com \
--cc=deller@gmx.de \
--cc=dhowells@redhat.com \
--cc=geert@linux-m68k.org \
--cc=gxt@mprc.pku.edu.cn \
--cc=heiko.carstens@de.ibm.com \
--cc=hpa@zytor.com \
--cc=jejb@parisc-linux.org \
--cc=jeremy@goop.org \
--cc=jonas@southpole.se \
--cc=konrad.wilk@oracle.com \
--cc=lennox.wu@gmail.com \
--cc=linux-snps-arc@vger.kernel.org \
--cc=liqin.chen@sunplusct.com \
--cc=maciej.rutecki@gmail.com \
--cc=msalter@redhat.com \
--cc=paulus@samba.org \
--cc=sam@ravnborg.org \
--cc=starvik@axis.com \
--cc=tangchen@cn.fujitsu.com \
--cc=walken@google.com \
--cc=x86@kernel.org \
--cc=xen-devel@lists.xensource.com \
--cc=ysato@users.sourceforge.jp \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.