All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robert Jennings <rcj@linux.vnet.ibm.com>
To: Nathan Fontenot <nfont@austin.ibm.com>
Cc: linux-mm@kvack.org, Mel Gorman <mel@csn.ul.ie>,
	linux-kernel@vger.kernel.org, linuxppc-dev@ozlabs.org,
	Martin Schwidefsky <schwidefsky@de.ibm.com>,
	Badari Pulavarty <pbadari@us.ibm.com>,
	Brian King <brking@linux.vnet.ibm.com>,
	Paul Mackerras <paulus@samba.org>, Ingo Molnar <mingo@elte.hu>
Subject: Re: [PATCH 1/2] mm: add notifier in pageblock isolation for balloon drivers
Date: Fri, 2 Oct 2009 13:31:45 -0500	[thread overview]
Message-ID: <20091002183145.GA4908@austin.ibm.com> (raw)
In-Reply-To: <4AC520B5.9080600@austin.ibm.com>

* Nathan Fontenot (nfont@austin.ibm.com) wrote:
> Robert Jennings wrote:
>> Memory balloon drivers can allocate a large amount of memory which
>> is not movable but could be freed to accommodate memory hotplug remove.
>>
>> Prior to calling the memory hotplug notifier chain the memory in the
>> pageblock is isolated.  If the migrate type is not MIGRATE_MOVABLE the
>> isolation will not proceed, causing the memory removal for that page
>> range to fail.
>>
>> Rather than immediately failing pageblock isolation if the the
>> migrateteype is not MIGRATE_MOVABLE, this patch checks if all of the
>> pages in the pageblock are owned by a registered balloon driver using a
>> notifier chain.  If all of the non-movable pages are owned by a balloon,
>> they can be freed later through the memory notifier chain and the range
>> can still be isolated in set_migratetype_isolate().
>>
>> Signed-off-by: Robert Jennings <rcj@linux.vnet.ibm.com>
>>
>> ---
>>  drivers/base/memory.c  |   19 +++++++++++++++++++
>>  include/linux/memory.h |   22 ++++++++++++++++++++++
>>  mm/page_alloc.c        |   49 +++++++++++++++++++++++++++++++++++++++++--------
>>  3 files changed, 82 insertions(+), 8 deletions(-)
>>
<snip>
>> Index: b/mm/page_alloc.c
>> ===================================================================
>> --- a/mm/page_alloc.c
>> +++ b/mm/page_alloc.c
>> @@ -48,6 +48,7 @@
>>  #include <linux/page_cgroup.h>
>>  #include <linux/debugobjects.h>
>>  #include <linux/kmemleak.h>
>> +#include <linux/memory.h>
>>  #include <trace/events/kmem.h>
>>   #include <asm/tlbflush.h>
>> @@ -4985,23 +4986,55 @@ void set_pageblock_flags_group(struct pa
>>  int set_migratetype_isolate(struct page *page)
>>  {
>>  	struct zone *zone;
>> -	unsigned long flags;
>> +	unsigned long flags, pfn, iter;
>> +	long immobile = 0;
>> +	struct memory_isolate_notify arg;
>> +	int notifier_ret;
>>  	int ret = -EBUSY;
>>  	int zone_idx;
>>   	zone = page_zone(page);
>>  	zone_idx = zone_idx(zone);
>> +
>> +	pfn = page_to_pfn(page);
>> +	arg.start_addr = (unsigned long)page_address(page);
>> +	arg.nr_pages = pageblock_nr_pages;
>> +	arg.pages_found = 0;
>> +
>>  	spin_lock_irqsave(&zone->lock, flags);
>>  	/*
>>  	 * In future, more migrate types will be able to be isolation target.
>>  	 */
>> -	if (get_pageblock_migratetype(page) != MIGRATE_MOVABLE &&
>> -	    zone_idx != ZONE_MOVABLE)
>> -		goto out;
>> -	set_pageblock_migratetype(page, MIGRATE_ISOLATE);
>> -	move_freepages_block(zone, page, MIGRATE_ISOLATE);
>> -	ret = 0;
>> -out:
>> +	do {
>> +		if (get_pageblock_migratetype(page) == MIGRATE_MOVABLE &&
>> +		    zone_idx == ZONE_MOVABLE) {
>> +			ret = 0;
>> +			break;
>> +		}
>> +
>> +		/*
>> +		 * If all of the pages in a zone are used by a balloon,
>> +		 * the range can be still be isolated.  The balloon will
>> +		 * free these pages from the memory notifier chain.
>> +		 */
>> +		notifier_ret = memory_isolate_notify(MEM_ISOLATE_COUNT, &arg);
>> +		notifier_ret = notifier_to_errno(ret);
>
> Should this be
>
> 		notifier_ret = notifier_to_errno(notifier_ret);
>
> -Nathan

I'll correct this.  Thanks

WARNING: multiple messages have this Message-ID (diff)
From: Robert Jennings <rcj@linux.vnet.ibm.com>
To: Nathan Fontenot <nfont@austin.ibm.com>
Cc: Mel Gorman <mel@csn.ul.ie>, Ingo Molnar <mingo@elte.hu>,
	Badari Pulavarty <pbadari@us.ibm.com>,
	Brian King <brking@linux.vnet.ibm.com>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Paul Mackerras <paulus@samba.org>,
	Martin Schwidefsky <schwidefsky@de.ibm.com>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	linuxppc-dev@ozlabs.org
Subject: Re: [PATCH 1/2] mm: add notifier in pageblock isolation for balloon drivers
Date: Fri, 2 Oct 2009 13:31:45 -0500	[thread overview]
Message-ID: <20091002183145.GA4908@austin.ibm.com> (raw)
In-Reply-To: <4AC520B5.9080600@austin.ibm.com>

* Nathan Fontenot (nfont@austin.ibm.com) wrote:
> Robert Jennings wrote:
>> Memory balloon drivers can allocate a large amount of memory which
>> is not movable but could be freed to accommodate memory hotplug remove.
>>
>> Prior to calling the memory hotplug notifier chain the memory in the
>> pageblock is isolated.  If the migrate type is not MIGRATE_MOVABLE the
>> isolation will not proceed, causing the memory removal for that page
>> range to fail.
>>
>> Rather than immediately failing pageblock isolation if the the
>> migrateteype is not MIGRATE_MOVABLE, this patch checks if all of the
>> pages in the pageblock are owned by a registered balloon driver using a
>> notifier chain.  If all of the non-movable pages are owned by a balloon,
>> they can be freed later through the memory notifier chain and the range
>> can still be isolated in set_migratetype_isolate().
>>
>> Signed-off-by: Robert Jennings <rcj@linux.vnet.ibm.com>
>>
>> ---
>>  drivers/base/memory.c  |   19 +++++++++++++++++++
>>  include/linux/memory.h |   22 ++++++++++++++++++++++
>>  mm/page_alloc.c        |   49 +++++++++++++++++++++++++++++++++++++++++--------
>>  3 files changed, 82 insertions(+), 8 deletions(-)
>>
<snip>
>> Index: b/mm/page_alloc.c
>> ===================================================================
>> --- a/mm/page_alloc.c
>> +++ b/mm/page_alloc.c
>> @@ -48,6 +48,7 @@
>>  #include <linux/page_cgroup.h>
>>  #include <linux/debugobjects.h>
>>  #include <linux/kmemleak.h>
>> +#include <linux/memory.h>
>>  #include <trace/events/kmem.h>
>>   #include <asm/tlbflush.h>
>> @@ -4985,23 +4986,55 @@ void set_pageblock_flags_group(struct pa
>>  int set_migratetype_isolate(struct page *page)
>>  {
>>  	struct zone *zone;
>> -	unsigned long flags;
>> +	unsigned long flags, pfn, iter;
>> +	long immobile = 0;
>> +	struct memory_isolate_notify arg;
>> +	int notifier_ret;
>>  	int ret = -EBUSY;
>>  	int zone_idx;
>>   	zone = page_zone(page);
>>  	zone_idx = zone_idx(zone);
>> +
>> +	pfn = page_to_pfn(page);
>> +	arg.start_addr = (unsigned long)page_address(page);
>> +	arg.nr_pages = pageblock_nr_pages;
>> +	arg.pages_found = 0;
>> +
>>  	spin_lock_irqsave(&zone->lock, flags);
>>  	/*
>>  	 * In future, more migrate types will be able to be isolation target.
>>  	 */
>> -	if (get_pageblock_migratetype(page) != MIGRATE_MOVABLE &&
>> -	    zone_idx != ZONE_MOVABLE)
>> -		goto out;
>> -	set_pageblock_migratetype(page, MIGRATE_ISOLATE);
>> -	move_freepages_block(zone, page, MIGRATE_ISOLATE);
>> -	ret = 0;
>> -out:
>> +	do {
>> +		if (get_pageblock_migratetype(page) == MIGRATE_MOVABLE &&
>> +		    zone_idx == ZONE_MOVABLE) {
>> +			ret = 0;
>> +			break;
>> +		}
>> +
>> +		/*
>> +		 * If all of the pages in a zone are used by a balloon,
>> +		 * the range can be still be isolated.  The balloon will
>> +		 * free these pages from the memory notifier chain.
>> +		 */
>> +		notifier_ret = memory_isolate_notify(MEM_ISOLATE_COUNT, &arg);
>> +		notifier_ret = notifier_to_errno(ret);
>
> Should this be
>
> 		notifier_ret = notifier_to_errno(notifier_ret);
>
> -Nathan

I'll correct this.  Thanks


WARNING: multiple messages have this Message-ID (diff)
From: Robert Jennings <rcj@linux.vnet.ibm.com>
To: Nathan Fontenot <nfont@austin.ibm.com>
Cc: Mel Gorman <mel@csn.ul.ie>, Ingo Molnar <mingo@elte.hu>,
	Badari Pulavarty <pbadari@us.ibm.com>,
	Brian King <brking@linux.vnet.ibm.com>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Paul Mackerras <paulus@samba.org>,
	Martin Schwidefsky <schwidefsky@de.ibm.com>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	linuxppc-dev@ozlabs.org
Subject: Re: [PATCH 1/2] mm: add notifier in pageblock isolation for balloon drivers
Date: Fri, 2 Oct 2009 13:31:45 -0500	[thread overview]
Message-ID: <20091002183145.GA4908@austin.ibm.com> (raw)
In-Reply-To: <4AC520B5.9080600@austin.ibm.com>

* Nathan Fontenot (nfont@austin.ibm.com) wrote:
> Robert Jennings wrote:
>> Memory balloon drivers can allocate a large amount of memory which
>> is not movable but could be freed to accommodate memory hotplug remove.
>>
>> Prior to calling the memory hotplug notifier chain the memory in the
>> pageblock is isolated.  If the migrate type is not MIGRATE_MOVABLE the
>> isolation will not proceed, causing the memory removal for that page
>> range to fail.
>>
>> Rather than immediately failing pageblock isolation if the the
>> migrateteype is not MIGRATE_MOVABLE, this patch checks if all of the
>> pages in the pageblock are owned by a registered balloon driver using a
>> notifier chain.  If all of the non-movable pages are owned by a balloon,
>> they can be freed later through the memory notifier chain and the range
>> can still be isolated in set_migratetype_isolate().
>>
>> Signed-off-by: Robert Jennings <rcj@linux.vnet.ibm.com>
>>
>> ---
>>  drivers/base/memory.c  |   19 +++++++++++++++++++
>>  include/linux/memory.h |   22 ++++++++++++++++++++++
>>  mm/page_alloc.c        |   49 +++++++++++++++++++++++++++++++++++++++++--------
>>  3 files changed, 82 insertions(+), 8 deletions(-)
>>
<snip>
>> Index: b/mm/page_alloc.c
>> ===================================================================
>> --- a/mm/page_alloc.c
>> +++ b/mm/page_alloc.c
>> @@ -48,6 +48,7 @@
>>  #include <linux/page_cgroup.h>
>>  #include <linux/debugobjects.h>
>>  #include <linux/kmemleak.h>
>> +#include <linux/memory.h>
>>  #include <trace/events/kmem.h>
>>   #include <asm/tlbflush.h>
>> @@ -4985,23 +4986,55 @@ void set_pageblock_flags_group(struct pa
>>  int set_migratetype_isolate(struct page *page)
>>  {
>>  	struct zone *zone;
>> -	unsigned long flags;
>> +	unsigned long flags, pfn, iter;
>> +	long immobile = 0;
>> +	struct memory_isolate_notify arg;
>> +	int notifier_ret;
>>  	int ret = -EBUSY;
>>  	int zone_idx;
>>   	zone = page_zone(page);
>>  	zone_idx = zone_idx(zone);
>> +
>> +	pfn = page_to_pfn(page);
>> +	arg.start_addr = (unsigned long)page_address(page);
>> +	arg.nr_pages = pageblock_nr_pages;
>> +	arg.pages_found = 0;
>> +
>>  	spin_lock_irqsave(&zone->lock, flags);
>>  	/*
>>  	 * In future, more migrate types will be able to be isolation target.
>>  	 */
>> -	if (get_pageblock_migratetype(page) != MIGRATE_MOVABLE &&
>> -	    zone_idx != ZONE_MOVABLE)
>> -		goto out;
>> -	set_pageblock_migratetype(page, MIGRATE_ISOLATE);
>> -	move_freepages_block(zone, page, MIGRATE_ISOLATE);
>> -	ret = 0;
>> -out:
>> +	do {
>> +		if (get_pageblock_migratetype(page) == MIGRATE_MOVABLE &&
>> +		    zone_idx == ZONE_MOVABLE) {
>> +			ret = 0;
>> +			break;
>> +		}
>> +
>> +		/*
>> +		 * If all of the pages in a zone are used by a balloon,
>> +		 * the range can be still be isolated.  The balloon will
>> +		 * free these pages from the memory notifier chain.
>> +		 */
>> +		notifier_ret = memory_isolate_notify(MEM_ISOLATE_COUNT, &arg);
>> +		notifier_ret = notifier_to_errno(ret);
>
> Should this be
>
> 		notifier_ret = notifier_to_errno(notifier_ret);
>
> -Nathan

I'll correct this.  Thanks

--
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:[~2009-10-02 18:31 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-01 19:53 [PATCH 1/2] mm: add notifier in pageblock isolation for balloon drivers Robert Jennings
2009-10-01 19:53 ` Robert Jennings
2009-10-01 19:53 ` Robert Jennings
2009-10-01 19:56 ` [PATCH 2/2] powerpc: Make the CMM memory hotplug aware Robert Jennings
2009-10-01 19:56   ` Robert Jennings
2009-10-01 21:35 ` [PATCH 1/2] mm: add notifier in pageblock isolation for balloon drivers Nathan Fontenot
2009-10-01 21:35   ` Nathan Fontenot
2009-10-02 18:31   ` Robert Jennings [this message]
2009-10-02 18:31     ` Robert Jennings
2009-10-02 18:31     ` Robert Jennings
2009-10-02 10:44 ` Mel Gorman
2009-10-02 10:44   ` Mel Gorman
2009-10-02 18:37   ` Robert Jennings
2009-10-02 18:37     ` Robert Jennings
2009-10-02 18:37     ` Robert Jennings

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=20091002183145.GA4908@austin.ibm.com \
    --to=rcj@linux.vnet.ibm.com \
    --cc=brking@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=mel@csn.ul.ie \
    --cc=mingo@elte.hu \
    --cc=nfont@austin.ibm.com \
    --cc=paulus@samba.org \
    --cc=pbadari@us.ibm.com \
    --cc=schwidefsky@de.ibm.com \
    /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.