linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Bob Liu <lliubbo@gmail.com>
To: Jiang Liu <jiang.liu@huawei.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Mel Gorman <mgorman@suse.de>, Michal Hocko <mhocko@suse.cz>,
	Minchan Kim <minchan@kernel.org>,
	Rusty Russell <rusty@rustcorp.com.au>,
	Yinghai Lu <yinghai@kernel.org>, Tony Luck <tony.luck@intel.com>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
	David Rientjes <rientjes@google.com>,
	Bjorn Helgaas <bhelgaas@google.com>,
	Keping Chen <chenkeping@huawei.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Jiang Liu <liuj97@gmail.com>, Wei Wang <Bessel.Wang@huawei.com>
Subject: Re: [PATCH 3/4] mm/hotplug: free zone->pageset when a zone becomes empty
Date: Thu, 19 Jul 2012 15:58:29 +0800	[thread overview]
Message-ID: <CAA_GA1eePmUsYWrSg2k6TTER+ejciWg2bvGc+1zaAKS8kLNRKw@mail.gmail.com> (raw)
In-Reply-To: <1341481532-1700-3-git-send-email-jiang.liu@huawei.com>

On Thu, Jul 5, 2012 at 5:45 PM, Jiang Liu <jiang.liu@huawei.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@gmail.com>
> Signed-off-by: Wei Wang <Bessel.Wang@huawei.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@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>



-- 
Regards,
--Bob

--
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>

  reply	other threads:[~2012-07-19  7:58 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-05  9:45 [PATCH 1/4] mm/hotplug: correctly setup fallback zonelists when creating new pgdat Jiang Liu
2012-07-05  9:45 ` [PATCH 2/4] mm/hotplug: correctly add new zone to all other nodes' zone lists Jiang Liu
2012-07-05  9:45 ` [PATCH 3/4] mm/hotplug: free zone->pageset when a zone becomes empty Jiang Liu
2012-07-19  7:58   ` Bob Liu [this message]
2012-07-24  9:47     ` Jiang Liu
2012-07-31  7:43   ` Wen Congyang
2012-07-05  9:45 ` [PATCH 4/4] mm/hotplug: mark memory hotplug code in page_alloc.c as __meminit Jiang Liu
2012-07-05 13:26   ` Cong Wang
2012-07-05 12:46 ` [PATCH 1/4] mm/hotplug: correctly setup fallback zonelists when creating new pgdat Cong Wang

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=CAA_GA1eePmUsYWrSg2k6TTER+ejciWg2bvGc+1zaAKS8kLNRKw@mail.gmail.com \
    --to=lliubbo@gmail.com \
    --cc=Bessel.Wang@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=bhelgaas@google.com \
    --cc=chenkeping@huawei.com \
    --cc=jiang.liu@huawei.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=liuj97@gmail.com \
    --cc=mgorman@suse.de \
    --cc=mhocko@suse.cz \
    --cc=minchan@kernel.org \
    --cc=rientjes@google.com \
    --cc=rusty@rustcorp.com.au \
    --cc=tony.luck@intel.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;
as well as URLs for NNTP newsgroup(s).