linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 2/3] mm, page_alloc: get page
       [not found] <1466250322-4764-1-git-send-email-linuxtao_hit@163.com>
@ 2016-06-18 11:45 ` Wenwei Tao
  2016-06-18 11:54   ` Wenwei Tao
  0 siblings, 1 reply; 2+ messages in thread
From: Wenwei Tao @ 2016-06-18 11:45 UTC (permalink / raw)
  To: akpm, mgorman, mhocko, vbabka, rientjes, kirill.shutemov,
	iamjoonsoo.kim, izumi.taku, hannes
  Cc: linux-kernel, linux-mm, ww.tao0320

From: Wenwei Tao <ww.tao0320@gmail.com>

The migratetype might get staled, pages might have become highatomic when
we try to free them to the allocator, we might not want to put highatomic
pages into other buddy lists, since they are reserved only for atomic high
order use. And also highatomic pages could have been unreserved,
put them into the hightatomic buddy list might exceed the limit of
highatomic pages. So get the pages migreate type again to put them into
the right lists.

Signed-off-by: Wenwei Tao <ww.tao0320@gmail.com>
---
 mm/page_alloc.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 19f9e76..b72b771 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1079,9 +1079,11 @@ static void free_pcppages_bulk(struct zone *zone, int count,
 	int batch_free = 0;
 	unsigned long nr_scanned;
 	bool isolated_pageblocks;
+	bool reserved_highatomic;
 
 	spin_lock(&zone->lock);
 	isolated_pageblocks = has_isolate_pageblock(zone);
+	reserved_highatomic = !!zone->nr_reserved_highatomic;
 	nr_scanned = zone_page_state(zone, NR_PAGES_SCANNED);
 	if (nr_scanned)
 		__mod_zone_page_state(zone, NR_PAGES_SCANNED, -nr_scanned);
@@ -1118,8 +1120,10 @@ static void free_pcppages_bulk(struct zone *zone, int count,
 			mt = get_pcppage_migratetype(page);
 			/* MIGRATE_ISOLATE page should not go to pcplists */
 			VM_BUG_ON_PAGE(is_migrate_isolate(mt), page);
+			VM_BUG_ON_PAGE(mt == MIGRATE_HIGHATOMIC, page);
 			/* Pageblock could have been isolated meanwhile */
-			if (unlikely(isolated_pageblocks))
+			if (unlikely(isolated_pageblocks ||
+					reserved_highatomic))
 				mt = get_pageblock_migratetype(page);
 
 			if (bulkfree_pcp_prepare(page))
@@ -1144,7 +1148,9 @@ static void free_one_page(struct zone *zone,
 		__mod_zone_page_state(zone, NR_PAGES_SCANNED, -nr_scanned);
 
 	if (unlikely(has_isolate_pageblock(zone) ||
-		is_migrate_isolate(migratetype))) {
+		zone->nr_reserved_highatomic ||
+		is_migrate_isolate(migratetype) ||
+		migratetype == MIGRATE_HIGHATOMIC)) {
 		migratetype = get_pfnblock_migratetype(page, pfn);
 	}
 	__free_one_page(page, pfn, zone, order, migratetype);
-- 
1.8.3.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

* Re: [RFC PATCH 2/3] mm, page_alloc: get page
  2016-06-18 11:45 ` [RFC PATCH 2/3] mm, page_alloc: get page Wenwei Tao
@ 2016-06-18 11:54   ` Wenwei Tao
  0 siblings, 0 replies; 2+ messages in thread
From: Wenwei Tao @ 2016-06-18 11:54 UTC (permalink / raw)
  To: Wenwei Tao
  Cc: akpm, mgorman, mhocko, vbabka, rientjes, kirill.shutemov,
	iamjoonsoo.kim, izumi.taku, Johannes Weiner, linux-kernel,
	linux-mm

Hi
Something is wrong with my email, I cannot send the patch out, and
this patch commit title is not complete.
Apologize for the noise.

2016-06-18 19:45 GMT+08:00 Wenwei Tao <linuxtao_hit@163.com>:
> From: Wenwei Tao <ww.tao0320@gmail.com>
>
> The migratetype might get staled, pages might have become highatomic when
> we try to free them to the allocator, we might not want to put highatomic
> pages into other buddy lists, since they are reserved only for atomic high
> order use. And also highatomic pages could have been unreserved,
> put them into the hightatomic buddy list might exceed the limit of
> highatomic pages. So get the pages migreate type again to put them into
> the right lists.
>
> Signed-off-by: Wenwei Tao <ww.tao0320@gmail.com>
> ---
>  mm/page_alloc.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 19f9e76..b72b771 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -1079,9 +1079,11 @@ static void free_pcppages_bulk(struct zone *zone, int count,
>         int batch_free = 0;
>         unsigned long nr_scanned;
>         bool isolated_pageblocks;
> +       bool reserved_highatomic;
>
>         spin_lock(&zone->lock);
>         isolated_pageblocks = has_isolate_pageblock(zone);
> +       reserved_highatomic = !!zone->nr_reserved_highatomic;
>         nr_scanned = zone_page_state(zone, NR_PAGES_SCANNED);
>         if (nr_scanned)
>                 __mod_zone_page_state(zone, NR_PAGES_SCANNED, -nr_scanned);
> @@ -1118,8 +1120,10 @@ static void free_pcppages_bulk(struct zone *zone, int count,
>                         mt = get_pcppage_migratetype(page);
>                         /* MIGRATE_ISOLATE page should not go to pcplists */
>                         VM_BUG_ON_PAGE(is_migrate_isolate(mt), page);
> +                       VM_BUG_ON_PAGE(mt == MIGRATE_HIGHATOMIC, page);
>                         /* Pageblock could have been isolated meanwhile */
> -                       if (unlikely(isolated_pageblocks))
> +                       if (unlikely(isolated_pageblocks ||
> +                                       reserved_highatomic))
>                                 mt = get_pageblock_migratetype(page);
>
>                         if (bulkfree_pcp_prepare(page))
> @@ -1144,7 +1148,9 @@ static void free_one_page(struct zone *zone,
>                 __mod_zone_page_state(zone, NR_PAGES_SCANNED, -nr_scanned);
>
>         if (unlikely(has_isolate_pageblock(zone) ||
> -               is_migrate_isolate(migratetype))) {
> +               zone->nr_reserved_highatomic ||
> +               is_migrate_isolate(migratetype) ||
> +               migratetype == MIGRATE_HIGHATOMIC)) {
>                 migratetype = get_pfnblock_migratetype(page, pfn);
>         }
>         __free_one_page(page, pfn, zone, order, migratetype);
> --
> 1.8.3.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:[~2016-06-18 11:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1466250322-4764-1-git-send-email-linuxtao_hit@163.com>
2016-06-18 11:45 ` [RFC PATCH 2/3] mm, page_alloc: get page Wenwei Tao
2016-06-18 11:54   ` Wenwei Tao

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