Skip to contentSkip to conversation

page_isolation: codeclean fix comment and rm unneeded val init

PATCH In review Bob Liu 4 participants 19 messages Oct 21, 2010 – Oct 25, 2010

Subsystems (3)
lore
Share & tools
lore

Bob Liu

author
#0 lore raw

PATCH 1/3 page_isolation: codeclean fix comment and rm unneeded val init

function __test_page_isolated_in_pageblock() return 1 if all pages in the range is isolated, so fix the comment.
value pfn will be init in the following loop so rm it.

---
 mm/page_isolation.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
mm/page_isolation.c +1 -2
index 5e0ffd9..4ae42bb 100644
@@ -86,7 +86,7 @@ undo_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn)
  * all pages in [start_pfn...end_pfn) must be in the same zone.
  * zone->lock must be held before call this.
  *
- * Returns 0 if all pages in the range is isolated.
+ * Returns 1 if all pages in the range is isolated.
  */
 static int
 __test_page_isolated_in_pageblock(unsigned long pfn, unsigned long end_pfn)
@@ -119,7 +119,6 @@ int test_pages_isolated(unsigned long start_pfn, unsigned long end_pfn)
 	struct zone *zone;
 	int ret;
 
-	pfn = start_pfn;
 	/*
 	 * Note: pageblock_nr_page != MAX_ORDER. Then, chunks of free page
 	 * is not aligned to pageblock_nr_pages.
Signature · 7 lines
1.5.6.3

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
author
#1 lore raw

PATCH 2/3 do_migrate_range: exit loop if not_managed is true.

If not_managed is true all pages will be putback to lru, so break the loop earlier to skip other pages isolate.

---
 mm/memory_hotplug.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
mm/memory_hotplug.c +6 -4
index d4e940a..4f72184 100644
@@ -709,15 +709,17 @@ do_migrate_range(unsigned long start_pfn, unsigned long end_pfn)
 					    page_is_file_cache(page));
 
 		} else {
-			/* Becasue we don't have big zone->lock. we should
-			   check this again here. */
-			if (page_count(page))
-				not_managed++;
 #ifdef CONFIG_DEBUG_VM
 			printk(KERN_ALERT "removing pfn %lx from LRU failed\n",
 			       pfn);
 			dump_page(page);
 #endif
+			/* Becasue we don't have big zone->lock. we should
+			   check this again here. */
+			if (page_count(page)) {
+				not_managed++;
+				break;
+			}
 		}
 	}
 	ret = -EBUSY;
Signature · 7 lines
1.5.6.3

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
author
#2 lore raw

PATCH 3/3 do_migrate_range: reduce list_empty() check.

simple code for reducing list_empty(&source) check.

---
 mm/memory_hotplug.c |   17 +++++++----------
 1 files changed, 7 insertions(+), 10 deletions(-)
mm/memory_hotplug.c +7 -10
index 4f72184..b6ffcfe 100644
@@ -718,22 +718,19 @@ do_migrate_range(unsigned long start_pfn, unsigned long end_pfn)
 			   check this again here. */
 			if (page_count(page)) {
 				not_managed++;
+				ret = -EBUSY;
 				break;
 			}
 		}
 	}
-	ret = -EBUSY;
-	if (not_managed) {
-		if (!list_empty(&source))
+	if (!list_empty(&source)) {
+		if (not_managed) {
 			putback_lru_pages(&source);
-		goto out;
+			goto out;
+		}
+		/* this function returns # of failed pages */
+		ret = migrate_pages(&source, hotremove_migrate_alloc, 0, 1);
 	}
-	ret = 0;
-	if (list_empty(&source))
-		goto out;
-	/* this function returns # of failed pages */
-	ret = migrate_pages(&source, hotremove_migrate_alloc, 0, 1);
-
 out:
 	return ret;
 }
Signature · 7 lines
1.5.6.3

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Acked-by on v1 3/3
#3 lore raw

Re: [PATCH 3/3] do_migrate_range: reduce list_empty() check.

Quoted 3 lines · On Thu, 21 Oct 2010 21:28:21 +0800 Bob Liu <[email protected]> wrote:

simple code for reducing list_empty(&source) check.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

Acked-by on v1 3/3
#4 lore raw

Re: [PATCH 3/3] do_migrate_range: reduce list_empty() check.

In reply to Bob Liu
Quoted 3 lines · Bob Liu

simple code for reducing list_empty(&source) check.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

maintainer
#5 lore raw

Re: [PATCH 3/3] do_migrate_range: reduce list_empty() check.

In reply to Bob Liu

It's not completely clear to me that these three patches are finalised. If updates are needed, lease send them ASAP.

Quoted 30 lines · On Thu, 21 Oct 2010 21:28:21 +0800 Bob Liu <[email protected]> wrote:

simple code for reducing list_empty(&source) check.

---
 mm/memory_hotplug.c |   17 +++++++----------
 1 files changed, 7 insertions(+), 10 deletions(-)
mm/memory_hotplug.c +6 -4
index 4f72184..b6ffcfe 100644
@@ -718,22 +718,19 @@ do_migrate_range(unsigned long start_pfn, unsigned long end_pfn)
 			   check this again here. */
 			if (page_count(page)) {
 				not_managed++;
+				ret = -EBUSY;
 				break;
 			}
 		}
 	}
-	ret = -EBUSY;
-	if (not_managed) {
-		if (!list_empty(&source))
+	if (!list_empty(&source)) {
+		if (not_managed) {
 			putback_lru_pages(&source);
-		goto out;
+			goto out;
+		}
+		/* this function returns # of failed pages */

mm/memory_hotplug.c do_migrate_range(unsigned long start_pfn, unsigned long end_pfn) · line 735

Quoted 10 lines
mm/memory_hotplug.c +1 -6
+		ret = migrate_pages(&source, hotremove_migrate_alloc, 0, 1);
 	}
-	ret = 0;
-	if (list_empty(&source))
-		goto out;
-	/* this function returns # of failed pages */
-	ret = migrate_pages(&source, hotremove_migrate_alloc, 0, 1);
-
 out:
 	return ret;

The code you're patching has changed a bit in -mm. Here's what I ended up with:

	static int
	do_migrate_range(unsigned long start_pfn, unsigned long end_pfn)
	{
		unsigned long pfn;
		struct page *page;
		int move_pages = NR_OFFLINE_AT_ONCE_PAGES;
		int not_managed = 0;
		int ret = 0;
		LIST_HEAD(source);
	
		for (pfn = start_pfn; pfn < end_pfn && move_pages > 0; pfn++) {
			if (!pfn_valid(pfn))
				continue;
			page = pfn_to_page(pfn);
			if (!page_count(page))
				continue;
			/*
			 * We can skip free pages. And we can only deal with pages on
			 * LRU.
			 */
			ret = isolate_lru_page(page);
			if (!ret) { /* Success */
				list_add_tail(&page->lru, &source);
				move_pages--;
				inc_zone_page_state(page, NR_ISOLATED_ANON +
						    page_is_file_cache(page));
	
			} else {
	#ifdef CONFIG_DEBUG_VM
				printk(KERN_ALERT "removing pfn %lx from LRU failed\n",
				       pfn);
				dump_page(page);
	#endif
				/* Becasue we don't have big zone->lock. we should
				   check this again here. */
				if (page_count(page)) {
					not_managed++;
					ret = -EBUSY;
					break;
				}
			}
		}
		if (!list_empty(&source)) {
			if (not_managed) {
				putback_lru_pages(&source);
				goto out;
			}
			/* this function returns # of failed pages */
			ret = migrate_pages(&source, hotremove_migrate_alloc, 0, 1);
-->>			if (ret)
-->>				putback_lru_pages(&source);
		}
	out:
		return ret;
	}

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#6 lore raw

Re: [PATCH 2/3] do_migrate_range: exit loop if not_managed is true.

In reply to Bob Liu
Quoted 2 lines · Bob Liu

If not_managed is true all pages will be putback to lru, so break the loop earlier to skip other pages isolate.

It's good fix in itself. However it's normal for isolate_lru_page() to fail at times (when there are active reclaimers). The failures are typically temporal and may well go away when offline_pages() retries the call. So it seems more reasonable to migrate as much as possible to increase the chance of complete success in next retry.

Quoted 33 lines
---
 mm/memory_hotplug.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
mm/memory_hotplug.c +6 -4
index d4e940a..4f72184 100644
@@ -709,15 +709,17 @@ do_migrate_range(unsigned long start_pfn, unsigned long end_pfn)
 					    page_is_file_cache(page));
 
 		} else {
-			/* Becasue we don't have big zone->lock. we should
-			   check this again here. */
-			if (page_count(page))
-				not_managed++;
 #ifdef CONFIG_DEBUG_VM
 			printk(KERN_ALERT "removing pfn %lx from LRU failed\n",
 			       pfn);
 			dump_page(page);
 #endif
+			/* Becasue we don't have big zone->lock. we should
+			   check this again here. */
+			if (page_count(page)) {
+				not_managed++;
+				break;
+			}
 		}
 	}
 	ret = -EBUSY;
Signature · 1 line
1.5.6.3

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

author
#7 lore raw

Re: [PATCH 2/3] do_migrate_range: exit loop if not_managed is true.

Quoted 10 lines · Wu Fengguang
Quoted 2 lines · Bob Liu

If not_managed is true all pages will be putback to lru, so break the loop earlier to skip other pages isolate.

It's good fix in itself. However it's normal for isolate_lru_page() to fail at times (when there are active reclaimers). The failures are typically temporal and may well go away when offline_pages() retries the call. So it seems more reasonable to migrate as much as possible to increase the chance of complete success in next retry.

Hi, Wu

The original code will try to migrate pages as much as possible except page_count(page) is true.
If page_count(page) is true, isolate more pages is mean-less, because all of them will
be put back after the loop.

Or maybe we can skip the page_count() check? It seems unreasonable, if isolate one page failed and
that page was in use why it needs to put back the whole isolated list?

Thanks

Quoted 34 lines
Quoted 33 lines

---
 mm/memory_hotplug.c |   10 ++++++----

 1 files changed, 6 insertions(+), 4 deletions(-)
mm/memory_hotplug.c +6 -5
index d4e940a..4f72184 100644
@@ -709,15 +709,17 @@ do_migrate_range(unsigned long start_pfn, unsigned long end_pfn)
                                           page_is_file_cache(page));
 
               } else {
-                     /* Becasue we don't have big zone->lock. we should
-                        check this again here. */
-                     if (page_count(page))
-                             not_managed++;
  #ifdef CONFIG_DEBUG_VM
                       printk(KERN_ALERT "removing pfn %lx from LRU failed\n",
                              pfn);
                       dump_page(page);
  #endif
+                     /* Becasue we don't have big zone->lock. we should
+                        check this again here. */
+                     if (page_count(page)) {
+                             not_managed++;
+                             break;
+                     }
               }
       }
       ret = -EBUSY;
--

1.5.6.3

Signature · 8 lines
Regards,
--Bob

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#8 lore raw

Re: [PATCH 2/3] do_migrate_range: exit loop if not_managed is true.

Quoted 20 lines · Bob Liu
Quoted 10 lines · Wu Fengguang
Quoted 2 lines · Bob Liu

If not_managed is true all pages will be putback to lru, so break the loop earlier to skip other pages isolate.

It's good fix in itself. However it's normal for isolate_lru_page() to fail at times (when there are active reclaimers). The failures are typically temporal and may well go away when offline_pages() retries the call. So it seems more reasonable to migrate as much as possible to increase the chance of complete success in next retry.

Hi, Wu

The original code will try to migrate pages as much as possible except page_count(page) is true.
If page_count(page) is true, isolate more pages is mean-less, because all of them will
be put back after the loop.

Quoted 3 lines

Or maybe we can skip the page_count() check? It seems unreasonable, if isolate one page failed and
that page was in use why it needs to put back the whole isolated list?

My suggestion was to keep the page_count() check and remove putback_lru_pages() and call migrate_pages() regardless of not_managed.

Does that make sense for typical memory hot remove scenarios? That will increase the possibility of success at the cost of some more migrated pages in case memory offline fails.

Thanks,
Fengguang

Quoted 26 lines
Quoted 26 lines
Quoted 26 lines

---
A mm/memory_hotplug.c | A 10 ++++++----
A 1 files changed, 6 insertions(+), 4 deletions(-)

mm/memory_hotplug.c +0 -4
index d4e940a..4f72184 100644
@@ -709,15 +709,17 @@ do_migrate_range(unsigned long start_pfn, unsigned long end_pfn)
 A  A  A  A  A  A  A  A  A  A  A  A  A  A  A  A  A  A  A  A  A  page_is_file_cache(page));
 
 A  A  A  A  A  A  A  } else {
- A  A  A  A  A  A  A  A  A  A  /* Becasue we don't have big zone->lock. we should
- A  A  A  A  A  A  A  A  A  A  A  A check this again here. */
- A  A  A  A  A  A  A  A  A  A  if (page_count(page))
- A  A  A  A  A  A  A  A  A  A  A  A  A  A  not_managed++;

A #ifdef CONFIG_DEBUG_VM

A  A  A  A  A  A  A  A  A  A  A  printk(KERN_ALERT "removing pfn %lx from LRU failed\n",
A  A  A  A  A  A  A  A  A  A  A  A  A  A  A pfn);
A  A  A  A  A  A  A  A  A  A  A  dump_page(page);
A #endif
+ A  A  A  A  A  A  A  A  A  A  /* Becasue we don't have big zone->lock. we should
+ A  A  A  A  A  A  A  A  A  A  A  A check this again here. */
+ A  A  A  A  A  A  A  A  A  A  if (page_count(page)) {
+ A  A  A  A  A  A  A  A  A  A  A  A  A  A  not_managed++;
Quoted 11 lines
Quoted 8 lines
Quoted 7 lines
+ A  A  A  A  A  A  A  A  A  A  A  A  A  A  break;
+ A  A  A  A  A  A  A  A  A  A  }
A  A  A  A  A  A  A  }
A  A  A  }
A  A  A  ret = -EBUSY;

--
1.5.6.3

Signature · 2 lines
Regards,
--Bob

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

author
#9 lore raw

Re: [PATCH 2/3] do_migrate_range: exit loop if not_managed is true.

Quoted 21 lines · Wu Fengguang
Quoted 20 lines · Bob Liu
Quoted 10 lines · Wu Fengguang
Quoted 2 lines · Bob Liu

If not_managed is true all pages will be putback to lru, so break the loop earlier to skip other pages isolate.

It's good fix in itself. However it's normal for isolate_lru_page() to fail at times (when there are active reclaimers). The failures are typically temporal and may well go away when offline_pages() retries the call. So it seems more reasonable to migrate as much as possible to increase the chance of complete success in next retry.

Hi, Wu

The original code will try to migrate pages as much as possible except page_count(page) is true.
If page_count(page) is true, isolate more pages is mean-less, because all of them will
be put back after the loop.

Quoted 8 lines
Quoted 3 lines

Or maybe we can skip the page_count() check?  It seems unreasonable, if isolate one page failed and
that page was in use why it needs to put back the whole isolated list?

My suggestion was to keep the page_count() check and remove putback_lru_pages() and call migrate_pages() regardless of not_managed.

If not_managed is no more used, page_count() will also meanless. You mean patch like this:
==
@@ -687,7 +687,6 @@
unsigned long pfn;
struct page *page;
int move_pages = NR_OFFLINE_AT_ONCE_PAGES;
- int not_managed = 0;
int ret = 0;
LIST_HEAD(source);

@@ -709,10 +708,6 @@
page_is_file_cache(page));

} else {
- /* Becasue we don't have big zone->lock. we should
- check this again here. */
- if (page_count(page))
- not_managed++;
#ifdef CONFIG_DEBUG_VM
printk(KERN_ALERT "removing pfn %lx from LRU failed\n",
pfn);
@@ -720,12 +715,6 @@
#endif
}
}
- ret = -EBUSY;
- if (not_managed) {
- if (!list_empty(&source))
- putback_lru_pages(&source);
- goto out;
- }
ret = 0;
if (list_empty(&source))
goto out;
==
Thanks,

Quoted 39 lines

Does that make sense for typical memory hot remove scenarios? That will increase the possibility of success at the cost of some more migrated pages in case memory offline fails.

Thanks,
Fengguang

Quoted 32 lines
Quoted 32 lines
Quoted 32 lines

---
 mm/memory_hotplug.c |   10 ++++++----

 1 files changed, 6 insertions(+), 4 deletions(-)
mm/memory_hotplug.c +6 -5
index d4e940a..4f72184 100644
@@ -709,15 +709,17 @@ do_migrate_range(unsigned long start_pfn, unsigned long end_pfn)
                                           page_is_file_cache(page));
 
               } else {
-                     /* Becasue we don't have big zone->lock. we should
-                        check this again here. */
-                     if (page_count(page))
-                             not_managed++;
  #ifdef CONFIG_DEBUG_VM
                       printk(KERN_ALERT "removing pfn %lx from LRU failed\n",
                              pfn);
                       dump_page(page);
  #endif
+                     /* Becasue we don't have big zone->lock. we should
+                        check this again here. */
+                     if (page_count(page)) {
+                             not_managed++;
+                             break;
+                     }
               }
       }
       ret = -EBUSY;
--
Signature · 8 lines
Regards,
--Bob

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#10 lore raw

Re: [PATCH 2/3] do_migrate_range: exit loop if not_managed is true.

Quoted 26 lines · Bob Liu
Quoted 25 lines · Wu Fengguang
Quoted 23 lines · Bob Liu
Quoted 10 lines · Wu Fengguang
Quoted 2 lines · Bob Liu

If not_managed is true all pages will be putback to lru, so break the loop earlier to skip other pages isolate.

It's good fix in itself. However it's normal for isolate_lru_page() to fail at times (when there are active reclaimers). The failures are typically temporal and may well go away when offline_pages() retries the call. So it seems more reasonable to migrate as much as possible to increase the chance of complete success in next retry.

Hi, Wu

The original code will try to migrate pages as much as possible except page_count(page) is true.
If page_count(page) is true, isolate more pages is mean-less, because all of them will
be put back after the loop.

Or maybe we can skip the page_count() check? A It seems unreasonable, if isolate one page failed and
that page was in use why it needs to put back the whole isolated list?

Quoted 6 lines
Quoted 4 lines

My suggestion was to keep the page_count() check and remove putback_lru_pages() and call migrate_pages() regardless of not_managed.

If not_managed is no more used, page_count() will also meanless.

Ah yes!

Quoted 1 line

You mean patch like this:

That's it.

I guess the typical usage would be

for each 128M block
try to offline it
if failed
break

So it makes sense to avoid failure as much as possible, since the above process is virtually not revertible -- if we failed at the 10th 128M block, the pages in the first 9 blocks have already been migrated. It helps little to avoid page migration inside the 10th block. The best we can do is to ensure success as much as possible once the memory offline process starts.

And it's nice to reduce some code :)

Thanks,
Fengguang

Quoted 67 lines

==

mm/memory_hotplug.c +0 -11
@@ -687,7 +687,6 @@
 	unsigned long pfn;
 	struct page *page;
 	int move_pages = NR_OFFLINE_AT_ONCE_PAGES;
-	int not_managed = 0;
 	int ret = 0;
 	LIST_HEAD(source);
 
@@ -709,10 +708,6 @@
 					    page_is_file_cache(page));
 
 		} else {
-			/* Becasue we don't have big zone->lock. we should
-			   check this again here. */
-			if (page_count(page))
-				not_managed++;
 #ifdef CONFIG_DEBUG_VM
 			printk(KERN_ALERT "removing pfn %lx from LRU failed\n",
 			       pfn);
@@ -720,12 +715,6 @@
 #endif
 		}
 	}
-	ret = -EBUSY;
-	if (not_managed) {
-		if (!list_empty(&source))
-			putback_lru_pages(&source);
-		goto out;
-	}
 	ret = 0;
 	if (list_empty(&source))
 		goto out;

==
Thanks,

Quoted 31 lines

Does that make sense for typical memory hot remove scenarios? That will increase the possibility of success at the cost of some more migrated pages in case memory offline fails.

Thanks,
Fengguang

Quoted 24 lines
Quoted 24 lines
Quoted 24 lines

---
A mm/memory_hotplug.c | A 10 ++++++----
A 1 files changed, 6 insertions(+), 4 deletions(-)

mm/memory_hotplug.c +0 -4
index d4e940a..4f72184 100644
@@ -709,15 +709,17 @@ do_migrate_range(unsigned long start_pfn, unsigned long end_pfn)
 A  A  A  A  A  A  A  A  A  A  A  A  A  A  A  A  A  A  A  A  A  page_is_file_cache(page));
 
 A  A  A  A  A  A  A  } else {
- A  A  A  A  A  A  A  A  A  A  /* Becasue we don't have big zone->lock. we should
- A  A  A  A  A  A  A  A  A  A  A  A check this again here. */
- A  A  A  A  A  A  A  A  A  A  if (page_count(page))
- A  A  A  A  A  A  A  A  A  A  A  A  A  A  not_managed++;

A #ifdef CONFIG_DEBUG_VM

A  A  A  A  A  A  A  A  A  A  A  printk(KERN_ALERT "removing pfn %lx from LRU failed\n",
A  A  A  A  A  A  A  A  A  A  A  A  A  A  A pfn);
A  A  A  A  A  A  A  A  A  A  A  dump_page(page);
A #endif
+ A  A  A  A  A  A  A  A  A  A  /* Becasue we don't have big zone->lock. we should
+ A  A  A  A  A  A  A  A  A  A  A  A check this again here. */
Quoted 11 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
+ A  A  A  A  A  A  A  A  A  A  if (page_count(page)) {
+ A  A  A  A  A  A  A  A  A  A  A  A  A  A  not_managed++;
+ A  A  A  A  A  A  A  A  A  A  A  A  A  A  break;
+ A  A  A  A  A  A  A  A  A  A  }
A  A  A  A  A  A  A  }
A  A  A  }
A  A  A  ret = -EBUSY;

--

Signature · 2 lines
Regards,
--Bob

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#11 lore raw

Re: [PATCH 2/3] do_migrate_range: exit loop if not_managed is true.

In reply to Bob Liu
Quoted 4 lines · On Thu, 21 Oct 2010 21:28:20 +0800 Bob Liu <[email protected]> wrote:

If not_managed is true all pages will be putback to lru, so break the loop earlier to skip other pages isolate.

please don't skip dump_page().

-Kame

Quoted 34 lines
---
 mm/memory_hotplug.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
mm/memory_hotplug.c +6 -4
index d4e940a..4f72184 100644
@@ -709,15 +709,17 @@ do_migrate_range(unsigned long start_pfn, unsigned long end_pfn)
 					    page_is_file_cache(page));
 
 		} else {
-			/* Becasue we don't have big zone->lock. we should
-			   check this again here. */
-			if (page_count(page))
-				not_managed++;
 #ifdef CONFIG_DEBUG_VM
 			printk(KERN_ALERT "removing pfn %lx from LRU failed\n",
 			       pfn);
 			dump_page(page);
 #endif
+			/* Becasue we don't have big zone->lock. we should
+			   check this again here. */
+			if (page_count(page)) {
+				not_managed++;
+				break;
+			}
 		}
 	}
 	ret = -EBUSY;
Signature · 1 line
1.5.6.3

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

author
#12 lore raw

Re: [PATCH 2/3] do_migrate_range: exit loop if not_managed is true.

T24gRnJpLCBPY3QgMjIsIDIwMTAgYXQgMTE6MTYgQU0sIEtBTUVaQVdBIEhpcm95dWtpCjxrYW1l emF3YS5oaXJveXVAanAuZnVqaXRzdS5jb20+IHdyb3RlOgo+IE9uIFRodSwgMjEgT2N0IDIwMTAg MjE6Mjg6MjAgKzA4MDAKPiBCb2IgTGl1IDxsbGl1YmJvQGdtYWlsLmNvbT4gd3JvdGU6Cj4KPj4g SWYgbm90X21hbmFnZWQgaXMgdHJ1ZSBhbGwgcGFnZXMgd2lsbCBiZSBwdXRiYWNrIHRvIGxydSwg c28KPj4gYnJlYWsgdGhlIGx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gwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgYnJlYWs7 Cj4+ICsgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgfQo+PiDCoCDCoCDCoCDCoCDCoCDC oCDCoCB9Cj4+IMKgIMKgIMKgIH0KPj4gwqAgwqAgwqAgcmV0ID0gLUVCVVNZOwotLSAKUmVnYXJk cywKLS1Cb2IK

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#13 lore raw

Re: [PATCH 2/3] do_migrate_range: exit loop if not_managed is true.

Quoted 13 lines · On Fri, 22 Oct 2010 16:41:13 +0800 Bob Liu <[email protected]> wrote:
Quoted 10 lines · KAMEZAWA Hiroyuki
Quoted 4 lines · On Thu, 21 Oct 2010 21:28:20 +0800 Bob Liu <[email protected]> wrote:

If not_managed is true all pages will be putback to lru, so break the loop earlier to skip other pages isolate.

please don't skip dump_page().

Quoted 7 lines

Hi, Kame

I put the check after dump_page() in order to we can still see the dump message if the loop is broken earlier.

Thanks

Ah, sorry. I misunderstood.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

Acked-by on v1 2/3
#14 lore raw

Re: [PATCH 2/3] do_migrate_range: exit loop if not_managed is true.

In reply to Bob Liu
Quoted 4 lines · Bob Liu

If not_managed is true all pages will be putback to lru, so break the loop earlier to skip other pages isolate.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#15 lore raw
In reply to Bob Liu
Quoted 3 lines · Bob Liu

function __test_page_isolated_in_pageblock() return 1 if all pages in the range is isolated, so fix the comment.
value pfn will be init in the following loop so rm it.

This is a bit confusing, but the original comment should be intended for test_pages_isolated()..

Quoted 28 lines
---
 mm/page_isolation.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
mm/page_isolation.c +1 -2
index 5e0ffd9..4ae42bb 100644
@@ -86,7 +86,7 @@ undo_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn)
  * all pages in [start_pfn...end_pfn) must be in the same zone.
  * zone->lock must be held before call this.
  *
- * Returns 0 if all pages in the range is isolated.
+ * Returns 1 if all pages in the range is isolated.
  */
 static int
 __test_page_isolated_in_pageblock(unsigned long pfn, unsigned long end_pfn)
@@ -119,7 +119,6 @@ int test_pages_isolated(unsigned long start_pfn, unsigned long end_pfn)
 	struct zone *zone;
 	int ret;
 
-	pfn = start_pfn;
 	/*
 	 * Note: pageblock_nr_page != MAX_ORDER. Then, chunks of free page
 	 * is not aligned to pageblock_nr_pages.
Signature · 1 line
1.5.6.3

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

author
#16 lore raw
Quoted 7 lines · Wu Fengguang
Quoted 3 lines · Bob Liu

function __test_page_isolated_in_pageblock() return 1 if all pages in the range is isolated, so fix the comment.
value pfn will be init in the following loop so rm it.

This is a bit confusing, but the original comment should be intended for test_pages_isolated()..

Maybe it used to but now it said "zone->lock must be held before call this", so it is the comment for __test_page_isolated_in_pageblock() nomore test_pages_isolated(),
so fix the comment as this patch did.

Thanks.

Quoted 30 lines
Quoted 29 lines

---
 mm/page_isolation.c |    3 +--

 1 files changed, 1 insertions(+), 2 deletions(-)
mm/page_isolation.c +1 -1
index 5e0ffd9..4ae42bb 100644
@@ -86,7 +86,7 @@ undo_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn)
   * all pages in [start_pfn...end_pfn) must be in the same zone.
   * zone->lock must be held before call this.
   *
- * Returns 0 if all pages in the range is isolated.
+ * Returns 1 if all pages in the range is isolated.
   */

 static int
 __test_page_isolated_in_pageblock(unsigned long pfn, unsigned long end_pfn)

mm/page_isolation.c +0 -2
@@ -119,7 +119,6 @@ int test_pages_isolated(unsigned long start_pfn, unsigned long end_pfn)
       struct zone *zone;
       int ret;
 
-     pfn = start_pfn;
       /*
        * Note: pageblock_nr_page != MAX_ORDER. Then, chunks of free page
        * is not aligned to pageblock_nr_pages.
--

1.5.6.3

Signature · 8 lines
Regards,
--Bob

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#17 lore raw
Quoted 6 lines · Bob Liu
Quoted 5 lines · Wu Fengguang
Quoted 3 lines · Bob Liu

function __test_page_isolated_in_pageblock() return 1 if all pages in the range is isolated, so fix the comment.
value pfn will be init in the following loop so rm it.

Quoted 7 lines
Quoted 2 lines

This is a bit confusing, but the original comment should be intended for test_pages_isolated()..

Maybe it used to but now it said "zone->lock must be held before call this", so it is the comment for __test_page_isolated_in_pageblock() nomore test_pages_isolated(),
so fix the comment as this patch did.

OK.

The comment still looks a bit awkward though. There are redundant/inconsistent "... range is free(means isolated) or not", "... range is isolated." and "all pages are free or Marked as ISOLATED". And the "start_pfn" is only found in test_pages_isolated().

Thanks,
Fengguang

Quoted 22 lines
Quoted 22 lines
Quoted 22 lines

---
A mm/page_isolation.c | A A 3 +--
A 1 files changed, 1 insertions(+), 2 deletions(-)

mm/page_isolation.c +0 -0
index 5e0ffd9..4ae42bb 100644
@@ -86,7 +86,7 @@ undo_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn)
A  * all pages in [start_pfn...end_pfn) must be in the same zone.
A  * zone->lock must be held before call this.
A  *

- * Returns 0 if all pages in the range is isolated.
+ * Returns 1 if all pages in the range is isolated.
A */
A static int
A __test_page_isolated_in_pageblock(unsigned long pfn, unsigned long end_pfn)

mm/page_isolation.c +0 -0
@@ -119,7 +119,6 @@ int test_pages_isolated(unsigned long start_pfn, unsigned long end_pfn)
 A  A  A  struct zone *zone;
 A  A  A  int ret;
 
Quoted 10 lines
Quoted 7 lines
Quoted 6 lines
mm/page_isolation.c +0 -1
- A  A  pfn = start_pfn;
A  A  A  /*
A  A  A  A * Note: pageblock_nr_page != MAX_ORDER. Then, chunks of free page
A  A  A  A * is not aligned to pageblock_nr_pages.

--
1.5.6.3

Signature · 2 lines
Regards,
--Bob

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

Acked-by on v1 1/3
#18 lore raw
In reply to Bob Liu
Quoted 5 lines · On Thu, 21 Oct 2010 21:28:19 +0800 Bob Liu <[email protected]> wrote:

function __test_page_isolated_in_pageblock() return 1 if all pages in the range is isolated, so fix the comment.
value pfn will be init in the following loop so rm it.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>