Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1393040 > unrolled thread

[PATCH 0/6] mm/page_owner: use tackdepot to store stacktrace

Started byjs1304@gmail.com
First post2016-05-03 07:30 +0200
Last post2016-05-12 05:00 +0200
Articles 7 on this page of 27 — 5 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/6] mm/page_owner: use tackdepot to store stacktrace js1304@gmail.com - 2016-05-03 07:30 +0200
    [PATCH 5/6] tools/vm/page_owner: increase temporary buffer size js1304@gmail.com - 2016-05-03 07:30 +0200
    [PATCH 6/6] mm/page_owner: use stackdepot to store stacktrace js1304@gmail.com - 2016-05-03 07:30 +0200
      Re: [PATCH 6/6] mm/page_owner: use stackdepot to store stacktrace Michal Hocko <mhocko@kernel.org> - 2016-05-03 11:00 +0200
        Re: [PATCH 6/6] mm/page_owner: use stackdepot to store stacktrace Joonsoo Kim <iamjoonsoo.kim@lge.com> - 2016-05-04 04:20 +0200
          Re: [PATCH 6/6] mm/page_owner: use stackdepot to store stacktrace Joonsoo Kim <iamjoonsoo.kim@lge.com> - 2016-05-04 04:40 +0200
            Re: [PATCH 6/6] mm/page_owner: use stackdepot to store stacktrace Michal Hocko <mhocko@kernel.org> - 2016-05-04 11:30 +0200
              Re: [PATCH 6/6] mm/page_owner: use stackdepot to store stacktrace Joonsoo Kim <js1304@gmail.com> - 2016-05-04 17:40 +0200
          Re: [PATCH 6/6] mm/page_owner: use stackdepot to store stacktrace Michal Hocko <mhocko@kernel.org> - 2016-05-04 11:30 +0200
            Re: [PATCH 6/6] mm/page_owner: use stackdepot to store stacktrace Joonsoo Kim <js1304@gmail.com> - 2016-05-04 17:40 +0200
              Re: [PATCH 6/6] mm/page_owner: use stackdepot to store stacktrace Joonsoo Kim <js1304@gmail.com> - 2016-05-04 17:50 +0200
                Re: [PATCH 6/6] mm/page_owner: use stackdepot to store stacktrace Michal Hocko <mhocko@kernel.org> - 2016-05-04 21:50 +0200
              Re: [PATCH 6/6] mm/page_owner: use stackdepot to store stacktrace Michal Hocko <mhocko@kernel.org> - 2016-05-04 21:50 +0200
                Re: [PATCH 6/6] mm/page_owner: use stackdepot to store stacktrace Joonsoo Kim <js1304@gmail.com> - 2016-05-10 09:10 +0200
                  Re: [PATCH 6/6] mm/page_owner: use stackdepot to store stacktrace Michal Hocko <mhocko@kernel.org> - 2016-05-10 11:00 +0200
      Re: [PATCH 6/6] mm/page_owner: use stackdepot to store stacktrace Vlastimil Babka <vbabka@suse.cz> - 2016-05-12 14:00 +0200
    [PATCH 3/6] mm/page_owner: copy last_migrate_reason in copy_page_owner() js1304@gmail.com - 2016-05-03 07:30 +0200
      Re: [PATCH 3/6] mm/page_owner: copy last_migrate_reason in  copy_page_owner() Vlastimil Babka <vbabka@suse.cz> - 2016-05-10 17:20 +0200
        Re: [PATCH 3/6] mm/page_owner: copy last_migrate_reason in  copy_page_owner() Joonsoo Kim <iamjoonsoo.kim@lge.com> - 2016-05-12 05:00 +0200
          Re: [PATCH 3/6] mm/page_owner: copy last_migrate_reason in  copy_page_owner() Vlastimil Babka <vbabka@suse.cz> - 2016-05-12 08:50 +0200
    [PATCH 4/6] mm/page_owner: introduce split_page_owner and replace manual handling js1304@gmail.com - 2016-05-03 07:30 +0200
      Re: [PATCH 4/6] mm/page_owner: introduce split_page_owner and replace  manual handling Vlastimil Babka <vbabka@suse.cz> - 2016-05-10 17:20 +0200
    [PATCH 2/6] mm/page_owner: initialize page owner without holding the zone lock js1304@gmail.com - 2016-05-03 07:30 +0200
      Re: [PATCH 2/6] mm/page_owner: initialize page owner without holding  the zone lock Vlastimil Babka <vbabka@suse.cz> - 2016-05-10 17:10 +0200
    [PATCH 1/6] mm/compaction: split freepages without holding the zone lock js1304@gmail.com - 2016-05-03 07:30 +0200
      Re: [PATCH 1/6] mm/compaction: split freepages without holding the  zone lock Vlastimil Babka <vbabka@suse.cz> - 2016-05-10 17:00 +0200
        Re: [PATCH 1/6] mm/compaction: split freepages without holding the  zone lock Joonsoo Kim <iamjoonsoo.kim@lge.com> - 2016-05-12 05:00 +0200

Page 2 of 2 — ← Prev page 1 [2]


#1393046 — [PATCH 4/6] mm/page_owner: introduce split_page_owner and replace manual handling

Fromjs1304@gmail.com
Date2016-05-03 07:30 +0200
Subject[PATCH 4/6] mm/page_owner: introduce split_page_owner and replace manual handling
Message-ID<ruB4e-1OM-15@gated-at.bofh.it>
In reply to#1393040
From: Joonsoo Kim <iamjoonsoo.kim@lge.com>

split_page() calls set_page_owner() to set up page_owner to each pages.
But, it has a drawback that head page and the others have different
stacktrace because callsite of set_page_owner() is slightly differnt.
To avoid this problem, this patch copies head page's page_owner to
the others. It needs to introduce new function, split_page_owner() but
it also remove the other function, get_page_owner_gfp() so looks good
to do.

Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
---
 include/linux/page_owner.h | 12 +++++-------
 mm/page_alloc.c            |  8 ++------
 mm/page_owner.c            |  7 +++++--
 3 files changed, 12 insertions(+), 15 deletions(-)

diff --git a/include/linux/page_owner.h b/include/linux/page_owner.h
index 46f1b93..30583ab 100644
--- a/include/linux/page_owner.h
+++ b/include/linux/page_owner.h
@@ -10,7 +10,7 @@ extern struct page_ext_operations page_owner_ops;
 extern void __reset_page_owner(struct page *page, unsigned int order);
 extern void __set_page_owner(struct page *page,
 			unsigned int order, gfp_t gfp_mask);
-extern gfp_t __get_page_owner_gfp(struct page *page);
+extern void __split_page_owner(struct page *page, unsigned int order);
 extern void __copy_page_owner(struct page *oldpage, struct page *newpage);
 extern void __set_page_owner_migrate_reason(struct page *page, int reason);
 extern void __dump_page_owner(struct page *page);
@@ -28,12 +28,10 @@ static inline void set_page_owner(struct page *page,
 		__set_page_owner(page, order, gfp_mask);
 }
 
-static inline gfp_t get_page_owner_gfp(struct page *page)
+static inline void split_page_owner(struct page *page, unsigned int order)
 {
 	if (static_branch_unlikely(&page_owner_inited))
-		return __get_page_owner_gfp(page);
-	else
-		return 0;
+		__split_page_owner(page, order);
 }
 static inline void copy_page_owner(struct page *oldpage, struct page *newpage)
 {
@@ -58,9 +56,9 @@ static inline void set_page_owner(struct page *page,
 			unsigned int order, gfp_t gfp_mask)
 {
 }
-static inline gfp_t get_page_owner_gfp(struct page *page)
+static inline void split_page_owner(struct page *page,
+			unsigned int order)
 {
-	return 0;
 }
 static inline void copy_page_owner(struct page *oldpage, struct page *newpage)
 {
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 5b632be..7cefc90 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -2466,7 +2466,6 @@ void free_hot_cold_page_list(struct list_head *list, bool cold)
 void split_page(struct page *page, unsigned int order)
 {
 	int i;
-	gfp_t gfp_mask;
 
 	VM_BUG_ON_PAGE(PageCompound(page), page);
 	VM_BUG_ON_PAGE(!page_count(page), page);
@@ -2480,12 +2479,9 @@ void split_page(struct page *page, unsigned int order)
 		split_page(virt_to_page(page[0].shadow), order);
 #endif
 
-	gfp_mask = get_page_owner_gfp(page);
-	set_page_owner(page, 0, gfp_mask);
-	for (i = 1; i < (1 << order); i++) {
+	for (i = 1; i < (1 << order); i++)
 		set_page_refcounted(page + i);
-		set_page_owner(page + i, 0, gfp_mask);
-	}
+	split_page_owner(page, order);
 }
 EXPORT_SYMBOL_GPL(split_page);
 
diff --git a/mm/page_owner.c b/mm/page_owner.c
index 6693959..7b5a834 100644
--- a/mm/page_owner.c
+++ b/mm/page_owner.c
@@ -86,11 +86,14 @@ void __set_page_owner_migrate_reason(struct page *page, int reason)
 	page_ext->last_migrate_reason = reason;
 }
 
-gfp_t __get_page_owner_gfp(struct page *page)
+void __split_page_owner(struct page *page, unsigned int order)
 {
 	struct page_ext *page_ext = lookup_page_ext(page);
+	int i;
 
-	return page_ext->gfp_mask;
+	page_ext->order = 0;
+	for (i = 1; i < (1 << order); i++)
+		__copy_page_owner(page, page + i);
 }
 
 void __copy_page_owner(struct page *oldpage, struct page *newpage)
-- 
1.9.1

[toc] | [prev] | [next] | [standalone]


#1398189 — Re: [PATCH 4/6] mm/page_owner: introduce split_page_owner and replace manual handling

FromVlastimil Babka <vbabka@suse.cz>
Date2016-05-10 17:20 +0200
SubjectRe: [PATCH 4/6] mm/page_owner: introduce split_page_owner and replace manual handling
Message-ID<rxhC1-4UM-1@gated-at.bofh.it>
In reply to#1393046
On 05/03/2016 07:23 AM, js1304@gmail.com wrote:
> From: Joonsoo Kim <iamjoonsoo.kim@lge.com>
>
> split_page() calls set_page_owner() to set up page_owner to each pages.
> But, it has a drawback that head page and the others have different
> stacktrace because callsite of set_page_owner() is slightly differnt.
> To avoid this problem, this patch copies head page's page_owner to
> the others. It needs to introduce new function, split_page_owner() but
> it also remove the other function, get_page_owner_gfp() so looks good
> to do.

OK.

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

[toc] | [prev] | [next] | [standalone]


#1393047 — [PATCH 2/6] mm/page_owner: initialize page owner without holding the zone lock

Fromjs1304@gmail.com
Date2016-05-03 07:30 +0200
Subject[PATCH 2/6] mm/page_owner: initialize page owner without holding the zone lock
Message-ID<ruB4e-1OM-13@gated-at.bofh.it>
In reply to#1393040
From: Joonsoo Kim <iamjoonsoo.kim@lge.com>

It's not necessary to initialized page_owner with holding the zone lock.
It would cause more contention on the zone lock although it's not
a big problem since it is just debug feature. But, it is better
than before so do it. This is also preparation step to use stackdepot
in page owner feature. Stackdepot allocates new pages when there is no
reserved space and holding the zone lock in this case will cause deadlock.

Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
---
 mm/compaction.c     | 3 +++
 mm/page_alloc.c     | 2 --
 mm/page_isolation.c | 9 ++++++---
 3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/mm/compaction.c b/mm/compaction.c
index ecf0252..dbad95b 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -20,6 +20,7 @@
 #include <linux/kasan.h>
 #include <linux/kthread.h>
 #include <linux/freezer.h>
+#include <linux/page_owner.h>
 #include "internal.h"
 
 #ifdef CONFIG_COMPACTION
@@ -80,6 +81,8 @@ static void map_pages(struct list_head *list)
 		arch_alloc_page(page, order);
 		kernel_map_pages(page, nr_pages, 1);
 		kasan_alloc_pages(page, order);
+
+		set_page_owner(page, order, __GFP_MOVABLE);
 		if (order)
 			split_page(page, order);
 
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 60d7f10..5b632be 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -2514,8 +2514,6 @@ int __isolate_free_page(struct page *page, unsigned int order)
 	zone->free_area[order].nr_free--;
 	rmv_page_order(page);
 
-	set_page_owner(page, order, __GFP_MOVABLE);
-
 	/* Set the pageblock if the isolated page is at least a pageblock */
 	if (order >= pageblock_order - 1) {
 		struct page *endpage = page + (1 << order) - 1;
diff --git a/mm/page_isolation.c b/mm/page_isolation.c
index 612122b..927f5ee 100644
--- a/mm/page_isolation.c
+++ b/mm/page_isolation.c
@@ -7,6 +7,7 @@
 #include <linux/pageblock-flags.h>
 #include <linux/memory.h>
 #include <linux/hugetlb.h>
+#include <linux/page_owner.h>
 #include "internal.h"
 
 #define CREATE_TRACE_POINTS
@@ -108,8 +109,6 @@ static void unset_migratetype_isolate(struct page *page, unsigned migratetype)
 			if (pfn_valid_within(page_to_pfn(buddy)) &&
 			    !is_migrate_isolate_page(buddy)) {
 				__isolate_free_page(page, order);
-				kernel_map_pages(page, (1 << order), 1);
-				set_page_refcounted(page);
 				isolated_page = page;
 			}
 		}
@@ -128,8 +127,12 @@ static void unset_migratetype_isolate(struct page *page, unsigned migratetype)
 	zone->nr_isolate_pageblock--;
 out:
 	spin_unlock_irqrestore(&zone->lock, flags);
-	if (isolated_page)
+	if (isolated_page) {
+		kernel_map_pages(page, (1 << order), 1);
+		set_page_refcounted(page);
+		set_page_owner(page, order, __GFP_MOVABLE);
 		__free_pages(isolated_page, order);
+	}
 }
 
 static inline struct page *
-- 
1.9.1

[toc] | [prev] | [next] | [standalone]


#1398182 — Re: [PATCH 2/6] mm/page_owner: initialize page owner without holding the zone lock

FromVlastimil Babka <vbabka@suse.cz>
Date2016-05-10 17:10 +0200
SubjectRe: [PATCH 2/6] mm/page_owner: initialize page owner without holding the zone lock
Message-ID<rxhsl-4N0-7@gated-at.bofh.it>
In reply to#1393047
On 05/03/2016 07:23 AM, js1304@gmail.com wrote:
> From: Joonsoo Kim <iamjoonsoo.kim@lge.com>
>
> It's not necessary to initialized page_owner with holding the zone lock.
> It would cause more contention on the zone lock although it's not
> a big problem since it is just debug feature. But, it is better
> than before so do it. This is also preparation step to use stackdepot
> in page owner feature. Stackdepot allocates new pages when there is no
> reserved space and holding the zone lock in this case will cause deadlock.

I have same concerns here as for Patch 1/6.

Thanks.

[toc] | [prev] | [next] | [standalone]


#1393048 — [PATCH 1/6] mm/compaction: split freepages without holding the zone lock

Fromjs1304@gmail.com
Date2016-05-03 07:30 +0200
Subject[PATCH 1/6] mm/compaction: split freepages without holding the zone lock
Message-ID<ruB4e-1OM-17@gated-at.bofh.it>
In reply to#1393040
From: Joonsoo Kim <iamjoonsoo.kim@lge.com>

We don't need to split freepages with holding the zone lock. It will cause
more contention on zone lock so not desirable.

Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
---
 include/linux/mm.h |  1 -
 mm/compaction.c    | 42 ++++++++++++++++++++++++++++++------------
 mm/page_alloc.c    | 27 ---------------------------
 3 files changed, 30 insertions(+), 40 deletions(-)

diff --git a/include/linux/mm.h b/include/linux/mm.h
index 7b52750..9608f33 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -523,7 +523,6 @@ void __put_page(struct page *page);
 void put_pages_list(struct list_head *pages);
 
 void split_page(struct page *page, unsigned int order);
-int split_free_page(struct page *page);
 
 /*
  * Compound pages have a destructor function.  Provide a
diff --git a/mm/compaction.c b/mm/compaction.c
index c9a95c1..ecf0252 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -65,13 +65,31 @@ static unsigned long release_freepages(struct list_head *freelist)
 
 static void map_pages(struct list_head *list)
 {
-	struct page *page;
+	unsigned int i, order, nr_pages;
+	struct page *page, *next;
+	LIST_HEAD(tmp_list);
+
+	list_for_each_entry_safe(page, next, list, lru) {
+		list_del(&page->lru);
+
+		order = page_private(page);
+		nr_pages = 1 << order;
+		set_page_private(page, 0);
+		set_page_refcounted(page);
+
+		arch_alloc_page(page, order);
+		kernel_map_pages(page, nr_pages, 1);
+		kasan_alloc_pages(page, order);
+		if (order)
+			split_page(page, order);
 
-	list_for_each_entry(page, list, lru) {
-		arch_alloc_page(page, 0);
-		kernel_map_pages(page, 1, 1);
-		kasan_alloc_pages(page, 0);
+		for (i = 0; i < nr_pages; i++) {
+			list_add(&page->lru, &tmp_list);
+			page++;
+		}
 	}
+
+	list_splice(&tmp_list, list);
 }
 
 static inline bool migrate_async_suitable(int migratetype)
@@ -368,12 +386,13 @@ static unsigned long isolate_freepages_block(struct compact_control *cc,
 	unsigned long flags = 0;
 	bool locked = false;
 	unsigned long blockpfn = *start_pfn;
+	unsigned int order;
 
 	cursor = pfn_to_page(blockpfn);
 
 	/* Isolate free pages. */
 	for (; blockpfn < end_pfn; blockpfn++, cursor++) {
-		int isolated, i;
+		int isolated;
 		struct page *page = cursor;
 
 		/*
@@ -439,13 +458,12 @@ static unsigned long isolate_freepages_block(struct compact_control *cc,
 				goto isolate_fail;
 		}
 
-		/* Found a free page, break it into order-0 pages */
-		isolated = split_free_page(page);
+		/* Found a free page, will break it into order-0 pages */
+		order = page_order(page);
+		isolated = __isolate_free_page(page, page_order(page));
+		set_page_private(page, order);
 		total_isolated += isolated;
-		for (i = 0; i < isolated; i++) {
-			list_add(&page->lru, freelist);
-			page++;
-		}
+		list_add_tail(&page->lru, freelist);
 
 		/* If a page was split, advance to the end of it */
 		if (isolated) {
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 5dd65d9..60d7f10 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -2532,33 +2532,6 @@ int __isolate_free_page(struct page *page, unsigned int order)
 }
 
 /*
- * Similar to split_page except the page is already free. As this is only
- * being used for migration, the migratetype of the block also changes.
- * As this is called with interrupts disabled, the caller is responsible
- * for calling arch_alloc_page() and kernel_map_page() after interrupts
- * are enabled.
- *
- * Note: this is probably too low level an operation for use in drivers.
- * Please consult with lkml before using this in your driver.
- */
-int split_free_page(struct page *page)
-{
-	unsigned int order;
-	int nr_pages;
-
-	order = page_order(page);
-
-	nr_pages = __isolate_free_page(page, order);
-	if (!nr_pages)
-		return 0;
-
-	/* Split into individual pages */
-	set_page_refcounted(page);
-	split_page(page, order);
-	return nr_pages;
-}
-
-/*
  * Update NUMA hit/miss statistics
  *
  * Must be called with interrupts disabled.
-- 
1.9.1

[toc] | [prev] | [next] | [standalone]


#1398173 — Re: [PATCH 1/6] mm/compaction: split freepages without holding the zone lock

FromVlastimil Babka <vbabka@suse.cz>
Date2016-05-10 17:00 +0200
SubjectRe: [PATCH 1/6] mm/compaction: split freepages without holding the zone lock
Message-ID<rxhiG-4hZ-3@gated-at.bofh.it>
In reply to#1393048
On 05/03/2016 07:22 AM, js1304@gmail.com wrote:
> From: Joonsoo Kim <iamjoonsoo.kim@lge.com>
> 
> We don't need to split freepages with holding the zone lock. It will cause
> more contention on zone lock so not desirable.

Fair enough, I just worry about the same thing as Hugh pointed out
recently [1] in that it increases the amount of tricky stuff in
compaction.c doing similar but not quite the same stuff as page/alloc.c,
and which will be forgotten to be updated once somebody updates
prep_new_page with e.g. a new debugging check. Can you perhaps think of
a more robust solution here?

Thanks

[1] http://marc.info/?i=alpine.LSU.2.11.1604270029350.7066%40eggly.anvils%3E

> Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
> ---
>   include/linux/mm.h |  1 -
>   mm/compaction.c    | 42 ++++++++++++++++++++++++++++++------------
>   mm/page_alloc.c    | 27 ---------------------------
>   3 files changed, 30 insertions(+), 40 deletions(-)
> 
> diff --git a/include/linux/mm.h b/include/linux/mm.h
> index 7b52750..9608f33 100644
> --- a/include/linux/mm.h
> +++ b/include/linux/mm.h
> @@ -523,7 +523,6 @@ void __put_page(struct page *page);
>   void put_pages_list(struct list_head *pages);
>   
>   void split_page(struct page *page, unsigned int order);
> -int split_free_page(struct page *page);
>   
>   /*
>    * Compound pages have a destructor function.  Provide a
> diff --git a/mm/compaction.c b/mm/compaction.c
> index c9a95c1..ecf0252 100644
> --- a/mm/compaction.c
> +++ b/mm/compaction.c
> @@ -65,13 +65,31 @@ static unsigned long release_freepages(struct list_head *freelist)
>   
>   static void map_pages(struct list_head *list)
>   {
> -	struct page *page;
> +	unsigned int i, order, nr_pages;
> +	struct page *page, *next;
> +	LIST_HEAD(tmp_list);
> +
> +	list_for_each_entry_safe(page, next, list, lru) {
> +		list_del(&page->lru);
> +
> +		order = page_private(page);
> +		nr_pages = 1 << order;
> +		set_page_private(page, 0);
> +		set_page_refcounted(page);
> +
> +		arch_alloc_page(page, order);
> +		kernel_map_pages(page, nr_pages, 1);
> +		kasan_alloc_pages(page, order);
> +		if (order)
> +			split_page(page, order);
>   
> -	list_for_each_entry(page, list, lru) {
> -		arch_alloc_page(page, 0);
> -		kernel_map_pages(page, 1, 1);
> -		kasan_alloc_pages(page, 0);
> +		for (i = 0; i < nr_pages; i++) {
> +			list_add(&page->lru, &tmp_list);
> +			page++;
> +		}
>   	}
> +
> +	list_splice(&tmp_list, list);
>   }
>   
>   static inline bool migrate_async_suitable(int migratetype)
> @@ -368,12 +386,13 @@ static unsigned long isolate_freepages_block(struct compact_control *cc,
>   	unsigned long flags = 0;
>   	bool locked = false;
>   	unsigned long blockpfn = *start_pfn;
> +	unsigned int order;
>   
>   	cursor = pfn_to_page(blockpfn);
>   
>   	/* Isolate free pages. */
>   	for (; blockpfn < end_pfn; blockpfn++, cursor++) {
> -		int isolated, i;
> +		int isolated;
>   		struct page *page = cursor;
>   
>   		/*
> @@ -439,13 +458,12 @@ static unsigned long isolate_freepages_block(struct compact_control *cc,
>   				goto isolate_fail;
>   		}
>   
> -		/* Found a free page, break it into order-0 pages */
> -		isolated = split_free_page(page);
> +		/* Found a free page, will break it into order-0 pages */
> +		order = page_order(page);
> +		isolated = __isolate_free_page(page, page_order(page));
> +		set_page_private(page, order);
>   		total_isolated += isolated;
> -		for (i = 0; i < isolated; i++) {
> -			list_add(&page->lru, freelist);
> -			page++;
> -		}
> +		list_add_tail(&page->lru, freelist);
>   
>   		/* If a page was split, advance to the end of it */
>   		if (isolated) {
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 5dd65d9..60d7f10 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -2532,33 +2532,6 @@ int __isolate_free_page(struct page *page, unsigned int order)
>   }
>   
>   /*
> - * Similar to split_page except the page is already free. As this is only
> - * being used for migration, the migratetype of the block also changes.
> - * As this is called with interrupts disabled, the caller is responsible
> - * for calling arch_alloc_page() and kernel_map_page() after interrupts
> - * are enabled.
> - *
> - * Note: this is probably too low level an operation for use in drivers.
> - * Please consult with lkml before using this in your driver.
> - */
> -int split_free_page(struct page *page)
> -{
> -	unsigned int order;
> -	int nr_pages;
> -
> -	order = page_order(page);
> -
> -	nr_pages = __isolate_free_page(page, order);
> -	if (!nr_pages)
> -		return 0;
> -
> -	/* Split into individual pages */
> -	set_page_refcounted(page);
> -	split_page(page, order);
> -	return nr_pages;
> -}
> -
> -/*
>    * Update NUMA hit/miss statistics
>    *
>    * Must be called with interrupts disabled.
> 

[toc] | [prev] | [next] | [standalone]


#1399649 — Re: [PATCH 1/6] mm/compaction: split freepages without holding the zone lock

FromJoonsoo Kim <iamjoonsoo.kim@lge.com>
Date2016-05-12 05:00 +0200
SubjectRe: [PATCH 1/6] mm/compaction: split freepages without holding the zone lock
Message-ID<rxP0Z-4Bd-1@gated-at.bofh.it>
In reply to#1398173
On Tue, May 10, 2016 at 04:56:45PM +0200, Vlastimil Babka wrote:
> On 05/03/2016 07:22 AM, js1304@gmail.com wrote:
> > From: Joonsoo Kim <iamjoonsoo.kim@lge.com>
> > 
> > We don't need to split freepages with holding the zone lock. It will cause
> > more contention on zone lock so not desirable.
> 
> Fair enough, I just worry about the same thing as Hugh pointed out
> recently [1] in that it increases the amount of tricky stuff in
> compaction.c doing similar but not quite the same stuff as page/alloc.c,
> and which will be forgotten to be updated once somebody updates
> prep_new_page with e.g. a new debugging check. Can you perhaps think of
> a more robust solution here?

I will try it. I think that factoring some part of prep_new_page() out
would be enough to make thing robust.

Thanks.

[toc] | [prev] | [standalone]


Page 2 of 2 — ← Prev page 1 [2]

Back to top | Article view | linux.kernel


csiph-web