linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: skip watermarks check for already isolated blocks in split_free_page()
@ 2012-11-08  6:59 Marek Szyprowski
  2012-11-17 18:19 ` [Linaro-mm-sig] " Francesco Lavra
  0 siblings, 1 reply; 3+ messages in thread
From: Marek Szyprowski @ 2012-11-08  6:59 UTC (permalink / raw)
  To: linux-mm, linaro-mm-sig, linux-kernel
  Cc: Marek Szyprowski, Kyungmin Park, Arnd Bergmann, Andrew Morton,
	Mel Gorman, Michal Nazarewicz, Minchan Kim,
	Bartlomiej Zolnierkiewicz

Since commit 2139cbe627b8 ("cma: fix counting of isolated pages") free
pages in isolated pageblocks are not accounted to NR_FREE_PAGES counters,
so watermarks check is not required if one operates on a free page in
isolated pageblock.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
 mm/page_alloc.c |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index fd154fe..43ab09f 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1394,10 +1394,12 @@ int capture_free_page(struct page *page, int alloc_order, int migratetype)
 	zone = page_zone(page);
 	order = page_order(page);
 
-	/* Obey watermarks as if the page was being allocated */
-	watermark = low_wmark_pages(zone) + (1 << order);
-	if (!zone_watermark_ok(zone, 0, watermark, 0, 0))
-		return 0;
+	if (get_pageblock_migratetype(page) != MIGRATE_ISOLATE) {
+		/* Obey watermarks as if the page was being allocated */
+		watermark = low_wmark_pages(zone) + (1 << order);
+		if (!zone_watermark_ok(zone, 0, watermark, 0, 0))
+			return 0;
+	}
 
 	/* Remove page from free list */
 	list_del(&page->lru);
-- 
1.7.9.5

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Linaro-mm-sig] [PATCH] mm: skip watermarks check for already isolated blocks in split_free_page()
  2012-11-08  6:59 [PATCH] mm: skip watermarks check for already isolated blocks in split_free_page() Marek Szyprowski
@ 2012-11-17 18:19 ` Francesco Lavra
  2012-11-19 14:42   ` [PATCH] mm: cma: skip watermarks check for already isolated blocks in split_free_page() fix Marek Szyprowski
  0 siblings, 1 reply; 3+ messages in thread
From: Francesco Lavra @ 2012-11-17 18:19 UTC (permalink / raw)
  To: Marek Szyprowski
  Cc: linux-mm, linaro-mm-sig, linux-kernel, Arnd Bergmann,
	Bartlomiej Zolnierkiewicz, Mel Gorman, Michal Nazarewicz,
	Minchan Kim, Kyungmin Park, Andrew Morton

Hi,

On 11/08/2012 07:59 AM, Marek Szyprowski wrote:
> Since commit 2139cbe627b8 ("cma: fix counting of isolated pages") free
> pages in isolated pageblocks are not accounted to NR_FREE_PAGES counters,
> so watermarks check is not required if one operates on a free page in
> isolated pageblock.
> 
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
>  mm/page_alloc.c |   10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index fd154fe..43ab09f 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -1394,10 +1394,12 @@ int capture_free_page(struct page *page, int alloc_order, int migratetype)
>  	zone = page_zone(page);
>  	order = page_order(page);
>  
> -	/* Obey watermarks as if the page was being allocated */
> -	watermark = low_wmark_pages(zone) + (1 << order);
> -	if (!zone_watermark_ok(zone, 0, watermark, 0, 0))
> -		return 0;
> +	if (get_pageblock_migratetype(page) != MIGRATE_ISOLATE) {

get_pageblock_migratetype(page) is also called later on in this function
and assigned to the mt variable: maybe the assignment should be moved
before (or inside) the above line?

--
Francesco

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] mm: cma: skip watermarks check for already isolated blocks in split_free_page() fix
  2012-11-17 18:19 ` [Linaro-mm-sig] " Francesco Lavra
@ 2012-11-19 14:42   ` Marek Szyprowski
  0 siblings, 0 replies; 3+ messages in thread
From: Marek Szyprowski @ 2012-11-19 14:42 UTC (permalink / raw)
  To: linux-mm, linaro-mm-sig, linux-kernel
  Cc: Marek Szyprowski, Kyungmin Park, Arnd Bergmann, Andrew Morton,
	Mel Gorman, Michal Nazarewicz, Minchan Kim,
	Bartlomiej Zolnierkiewicz, Francesco Lavra

Cleanup and simplify the code which uses page migrate type.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
 mm/page_alloc.c |    9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 6b990cb..f05365f 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1393,12 +1393,15 @@ int capture_free_page(struct page *page, int alloc_order, int migratetype)
 
 	zone = page_zone(page);
 	order = page_order(page);
+	mt = get_pageblock_migratetype(page);
 
-	if (get_pageblock_migratetype(page) != MIGRATE_ISOLATE) {
+	if (mt != MIGRATE_ISOLATE) {
 		/* Obey watermarks as if the page was being allocated */
 		watermark = low_wmark_pages(zone) + (1 << order);
 		if (!zone_watermark_ok(zone, 0, watermark, 0, 0))
 			return 0;
+
+		__mod_zone_freepage_state(zone, -(1UL << order), mt);
 	}
 
 	/* Remove page from free list */
@@ -1406,10 +1409,6 @@ int capture_free_page(struct page *page, int alloc_order, int migratetype)
 	zone->free_area[order].nr_free--;
 	rmv_page_order(page);
 
-	mt = get_pageblock_migratetype(page);
-	if (unlikely(mt != MIGRATE_ISOLATE))
-		__mod_zone_freepage_state(zone, -(1UL << order), mt);
-
 	if (alloc_order != order)
 		expand(zone, page, alloc_order, order,
 			&zone->free_area[order], migratetype);
-- 
1.7.9.5

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-11-19 14:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-08  6:59 [PATCH] mm: skip watermarks check for already isolated blocks in split_free_page() Marek Szyprowski
2012-11-17 18:19 ` [Linaro-mm-sig] " Francesco Lavra
2012-11-19 14:42   ` [PATCH] mm: cma: skip watermarks check for already isolated blocks in split_free_page() fix Marek Szyprowski

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