linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] mm: page_isolation: remove redundant moving for isolated buddy pages
@ 2014-12-09  7:50 Weijie Yang
  2014-12-09  9:14 ` Vlastimil Babka
  0 siblings, 1 reply; 2+ messages in thread
From: Weijie Yang @ 2014-12-09  7:50 UTC (permalink / raw)
  To: iamjoonsoo.kim
  Cc: 'Andrew Morton', mgorman, 'Rik van Riel',
	vbabka, 'Johannes Weiner', 'Minchan Kim',
	'Weijie Yang',
	linux-kernel, linux-mm

The commit ad53f92e(fix incorrect isolation behavior by rechecking migratetype)
patch series describe the race between page isolation and alloc/free path, and
fix the race.

Now, after the pageblock has been isolated, free buddy pages are already in
the free_list[MIGRATE_ISOLATE] and will not be allocated for usage. So the
current freepage_migratetype check is unnecessary and it will cause redundant
page move. That is to say, even if the buddy page's migratetype is not
MIGRATE_ISOLATE, the page is in free_list[MIGRATE_ISOLATE], we just move it
from free_list[MIGRATE_ISOLATE] to free_list[MIGRATE_ISOLATE].

This patch removes the unnecessary freepage_migratetype check and the
redundant page moving.

Signed-off-by: Weijie Yang <weijie.yang@samsung.com>
---
 mm/page_isolation.c |   17 +----------------
 1 file changed, 1 insertion(+), 16 deletions(-)

diff --git a/mm/page_isolation.c b/mm/page_isolation.c
index c8778f7..6e5174d 100644
--- a/mm/page_isolation.c
+++ b/mm/page_isolation.c
@@ -221,23 +221,8 @@ __test_page_isolated_in_pageblock(unsigned long pfn, unsigned long end_pfn,
 			continue;
 		}
 		page = pfn_to_page(pfn);
-		if (PageBuddy(page)) {
-			/*
-			 * If race between isolatation and allocation happens,
-			 * some free pages could be in MIGRATE_MOVABLE list
-			 * although pageblock's migratation type of the page
-			 * is MIGRATE_ISOLATE. Catch it and move the page into
-			 * MIGRATE_ISOLATE list.
-			 */
-			if (get_freepage_migratetype(page) != MIGRATE_ISOLATE) {
-				struct page *end_page;
-
-				end_page = page + (1 << page_order(page)) - 1;
-				move_freepages(page_zone(page), page, end_page,
-						MIGRATE_ISOLATE);
-			}
+		if (PageBuddy(page))
 			pfn += 1 << page_order(page);
-		}
 		else if (page_count(page) == 0 &&
 			get_freepage_migratetype(page) == MIGRATE_ISOLATE)
 			pfn += 1;
-- 
1.7.10.4


--
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] 2+ messages in thread

* Re: [PATCH 1/3] mm: page_isolation: remove redundant moving for isolated buddy pages
  2014-12-09  7:50 [PATCH 1/3] mm: page_isolation: remove redundant moving for isolated buddy pages Weijie Yang
@ 2014-12-09  9:14 ` Vlastimil Babka
  0 siblings, 0 replies; 2+ messages in thread
From: Vlastimil Babka @ 2014-12-09  9:14 UTC (permalink / raw)
  To: Weijie Yang, iamjoonsoo.kim
  Cc: 'Andrew Morton', mgorman, 'Rik van Riel',
	'Johannes Weiner', 'Minchan Kim',
	'Weijie Yang',
	linux-kernel, linux-mm

On 12/09/2014 08:50 AM, Weijie Yang wrote:
> The commit ad53f92e(fix incorrect isolation behavior by rechecking migratetype)
> patch series describe the race between page isolation and alloc/free path, and
> fix the race.
>
> Now, after the pageblock has been isolated, free buddy pages are already in
> the free_list[MIGRATE_ISOLATE] and will not be allocated for usage. So the
> current freepage_migratetype check is unnecessary and it will cause redundant
> page move. That is to say, even if the buddy page's migratetype is not
> MIGRATE_ISOLATE, the page is in free_list[MIGRATE_ISOLATE], we just move it
> from free_list[MIGRATE_ISOLATE] to free_list[MIGRATE_ISOLATE].
>
> This patch removes the unnecessary freepage_migratetype check and the
> redundant page moving.
>
> Signed-off-by: Weijie Yang <weijie.yang@samsung.com>

With great hope that Joonsoo won't find another corner case J

Acked-by: Vlastimil Babka <vbabka@suse.cz>

> ---
>   mm/page_isolation.c |   17 +----------------
>   1 file changed, 1 insertion(+), 16 deletions(-)
>
> diff --git a/mm/page_isolation.c b/mm/page_isolation.c
> index c8778f7..6e5174d 100644
> --- a/mm/page_isolation.c
> +++ b/mm/page_isolation.c
> @@ -221,23 +221,8 @@ __test_page_isolated_in_pageblock(unsigned long pfn, unsigned long end_pfn,
>   			continue;
>   		}
>   		page = pfn_to_page(pfn);
> -		if (PageBuddy(page)) {
> -			/*
> -			 * If race between isolatation and allocation happens,
> -			 * some free pages could be in MIGRATE_MOVABLE list
> -			 * although pageblock's migratation type of the page
> -			 * is MIGRATE_ISOLATE. Catch it and move the page into
> -			 * MIGRATE_ISOLATE list.
> -			 */
> -			if (get_freepage_migratetype(page) != MIGRATE_ISOLATE) {
> -				struct page *end_page;
> -
> -				end_page = page + (1 << page_order(page)) - 1;
> -				move_freepages(page_zone(page), page, end_page,
> -						MIGRATE_ISOLATE);
> -			}
> +		if (PageBuddy(page))
>   			pfn += 1 << page_order(page);
> -		}
>   		else if (page_count(page) == 0 &&
>   			get_freepage_migratetype(page) == MIGRATE_ISOLATE)
>   			pfn += 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>

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

end of thread, other threads:[~2014-12-09  9:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-09  7:50 [PATCH 1/3] mm: page_isolation: remove redundant moving for isolated buddy pages Weijie Yang
2014-12-09  9:14 ` Vlastimil Babka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox