[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <500E6F1A.5060206@huawei.com>
Date: Tue, 24 Jul 2012 17:47:06 +0800
From: Jiang Liu <jiang.liu@...wei.com>
To: Bob Liu <lliubbo@...il.com>
CC: Andrew Morton <akpm@...ux-foundation.org>,
Mel Gorman <mgorman@...e.de>, Michal Hocko <mhocko@...e.cz>,
Minchan Kim <minchan@...nel.org>,
Rusty Russell <rusty@...tcorp.com.au>,
Yinghai Lu <yinghai@...nel.org>,
Tony Luck <tony.luck@...el.com>,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>,
KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>,
David Rientjes <rientjes@...gle.com>,
Bjorn Helgaas <bhelgaas@...gle.com>,
Keping Chen <chenkeping@...wei.com>, <linux-mm@...ck.org>,
<linux-kernel@...r.kernel.org>, Jiang Liu <liuj97@...il.com>,
Wei Wang <Bessel.Wang@...wei.com>
Subject: Re: [PATCH 3/4] mm/hotplug: free zone->pageset when a zone becomes
empty
Hi Bob,
Yes, we need to handle the wait table too. We has tried to remove the
pgdat and wait table altogether, but found it's really hard to remove pgdat
for empty nodes. I think the candidate solution is to free wait table but
keep pgdat. Any suggestions?
Thanks!
Gerry
On 2012-7-19 15:58, Bob Liu wrote:
> On Thu, Jul 5, 2012 at 5:45 PM, Jiang Liu <jiang.liu@...wei.com> wrote:
>> When a zone becomes empty after memory offlining, free zone->pageset.
>> Otherwise it will cause memory leak when adding memory to the empty
>> zone again because build_all_zonelists() will allocate zone->pageset
>> for an empty zone.
>>
>
> What about other area allocated to the zone? eg. wait_table?
>
>> Signed-off-by: Jiang Liu <liuj97@...il.com>
>> Signed-off-by: Wei Wang <Bessel.Wang@...wei.com>
>> ---
>> include/linux/mm.h | 1 +
>> mm/memory_hotplug.c | 3 +++
>> mm/page_alloc.c | 13 +++++++++++++
>> 3 files changed, 17 insertions(+), 0 deletions(-)
>>
>> diff --git a/include/linux/mm.h b/include/linux/mm.h
>> index b36d08c..f8b62f2 100644
>> --- a/include/linux/mm.h
>> +++ b/include/linux/mm.h
>> @@ -1331,6 +1331,7 @@ void warn_alloc_failed(gfp_t gfp_mask, int order, const char *fmt, ...);
>> extern void setup_per_cpu_pageset(void);
>>
>> extern void zone_pcp_update(struct zone *zone);
>> +extern void zone_pcp_reset(struct zone *zone);
>>
>> /* nommu.c */
>> extern atomic_long_t mmap_pages_allocated;
>> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
>> index bce80c7..998b792 100644
>> --- a/mm/memory_hotplug.c
>> +++ b/mm/memory_hotplug.c
>> @@ -966,6 +966,9 @@ repeat:
>>
>> init_per_zone_wmark_min();
>>
>> + if (!populated_zone(zone))
>> + zone_pcp_reset(zone);
>> +
>> if (!node_present_pages(node)) {
>> node_clear_state(node, N_HIGH_MEMORY);
>> kswapd_stop(node);
>> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
>> index ebf319d..5964b7a 100644
>> --- a/mm/page_alloc.c
>> +++ b/mm/page_alloc.c
>> @@ -5872,6 +5872,19 @@ void free_contig_range(unsigned long pfn, unsigned nr_pages)
>> #endif
>>
>> #ifdef CONFIG_MEMORY_HOTREMOVE
>> +void zone_pcp_reset(struct zone *zone)
>> +{
>> + unsigned long flags;
>> +
>> + /* avoid races with drain_pages() */
>> + local_irq_save(flags);
>> + if (zone->pageset != &boot_pageset) {
>> + free_percpu(zone->pageset);
>> + zone->pageset = &boot_pageset;
>> + }
>> + local_irq_restore(flags);
>> +}
>> +
>> /*
>> * All pages in the range must be isolated before calling this.
>> */
>> --
>> 1.7.1
>>
>>
>> --
>> To unsubscribe, send a message with 'unsubscribe linux-mm' in
>> the body to majordomo@...ck.org. For more info on Linux MM,
>> see: http://www.linux-mm.org/ .
>> Don't email: <a href=mailto:"dont@...ck.org"> email@...ck.org </a>
>
>
>
--
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