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


Groups > linux.kernel > #1415395 > unrolled thread

[PATCH 04/10] mm: fix LRU balancing effect of new transparent huge pages

Started byJohannes Weiner <hannes@cmpxchg.org>
First post2016-06-06 22:00 +0200
Last post2016-06-08 09:30 +0200
Articles 4 — 4 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 04/10] mm: fix LRU balancing effect of new transparent huge pages Johannes Weiner <hannes@cmpxchg.org> - 2016-06-06 22:00 +0200
    Re: [PATCH 04/10] mm: fix LRU balancing effect of new transparent  huge pages Rik van Riel <riel@redhat.com> - 2016-06-06 23:40 +0200
    Re: [PATCH 04/10] mm: fix LRU balancing effect of new transparent  huge pages Michal Hocko <mhocko@kernel.org> - 2016-06-07 11:20 +0200
    Re: [PATCH 04/10] mm: fix LRU balancing effect of new transparent  huge pages Minchan Kim <minchan@kernel.org> - 2016-06-08 09:30 +0200

#1415395 — [PATCH 04/10] mm: fix LRU balancing effect of new transparent huge pages

FromJohannes Weiner <hannes@cmpxchg.org>
Date2016-06-06 22:00 +0200
Subject[PATCH 04/10] mm: fix LRU balancing effect of new transparent huge pages
Message-ID<rH8QO-Oc-13@gated-at.bofh.it>
Currently, THP are counted as single pages until they are split right
before being swapped out. However, at that point the VM is already in
the middle of reclaim, and adjusting the LRU balance then is useless.

Always account THP by the number of basepages, and remove the fixup
from the splitting path.

Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
---
 mm/swap.c | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/mm/swap.c b/mm/swap.c
index d2786a6308dd..c6936507abb5 100644
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -249,13 +249,14 @@ void rotate_reclaimable_page(struct page *page)
 }
 
 static void update_page_reclaim_stat(struct lruvec *lruvec,
-				     int file, int rotated)
+				     int file, int rotated,
+				     unsigned int nr_pages)
 {
 	struct zone_reclaim_stat *reclaim_stat = &lruvec->reclaim_stat;
 
-	reclaim_stat->recent_scanned[file]++;
+	reclaim_stat->recent_scanned[file] += nr_pages;
 	if (rotated)
-		reclaim_stat->recent_rotated[file]++;
+		reclaim_stat->recent_rotated[file] += nr_pages;
 }
 
 static void __activate_page(struct page *page, struct lruvec *lruvec,
@@ -272,7 +273,7 @@ static void __activate_page(struct page *page, struct lruvec *lruvec,
 		trace_mm_lru_activate(page);
 
 		__count_vm_event(PGACTIVATE);
-		update_page_reclaim_stat(lruvec, file, 1);
+		update_page_reclaim_stat(lruvec, file, 1, hpage_nr_pages(page));
 	}
 }
 
@@ -532,7 +533,7 @@ static void lru_deactivate_file_fn(struct page *page, struct lruvec *lruvec,
 
 	if (active)
 		__count_vm_event(PGDEACTIVATE);
-	update_page_reclaim_stat(lruvec, file, 0);
+	update_page_reclaim_stat(lruvec, file, 0, hpage_nr_pages(page));
 }
 
 
@@ -549,7 +550,7 @@ static void lru_deactivate_fn(struct page *page, struct lruvec *lruvec,
 		add_page_to_lru_list(page, lruvec, lru);
 
 		__count_vm_event(PGDEACTIVATE);
-		update_page_reclaim_stat(lruvec, file, 0);
+		update_page_reclaim_stat(lruvec, file, 0, hpage_nr_pages(page));
 	}
 }
 
@@ -809,9 +810,6 @@ void lru_add_page_tail(struct page *page, struct page *page_tail,
 		list_head = page_tail->lru.prev;
 		list_move_tail(&page_tail->lru, list_head);
 	}
-
-	if (!PageUnevictable(page))
-		update_page_reclaim_stat(lruvec, file, PageActive(page_tail));
 }
 #endif /* CONFIG_TRANSPARENT_HUGEPAGE */
 
@@ -826,7 +824,7 @@ static void __pagevec_lru_add_fn(struct page *page, struct lruvec *lruvec,
 
 	SetPageLRU(page);
 	add_page_to_lru_list(page, lruvec, lru);
-	update_page_reclaim_stat(lruvec, file, active);
+	update_page_reclaim_stat(lruvec, file, active, hpage_nr_pages(page));
 	trace_mm_lru_insertion(page, lru);
 }
 
-- 
2.8.3

[toc] | [next] | [standalone]


#1415491 — Re: [PATCH 04/10] mm: fix LRU balancing effect of new transparent huge pages

FromRik van Riel <riel@redhat.com>
Date2016-06-06 23:40 +0200
SubjectRe: [PATCH 04/10] mm: fix LRU balancing effect of new transparent huge pages
Message-ID<rHapA-1UM-3@gated-at.bofh.it>
In reply to#1415395

[Multipart message — attachments visible in raw view] — view raw

On Mon, 2016-06-06 at 15:48 -0400, Johannes Weiner wrote:
> Currently, THP are counted as single pages until they are split right
> before being swapped out. However, at that point the VM is already in
> the middle of reclaim, and adjusting the LRU balance then is useless.
> 
> Always account THP by the number of basepages, and remove the fixup
> from the splitting path.
> 
> Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
> 

Reviewed-by: Rik van Riel <riel@redhat.com>

-- 
All Rights Reversed.

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


#1415911 — Re: [PATCH 04/10] mm: fix LRU balancing effect of new transparent huge pages

FromMichal Hocko <mhocko@kernel.org>
Date2016-06-07 11:20 +0200
SubjectRe: [PATCH 04/10] mm: fix LRU balancing effect of new transparent huge pages
Message-ID<rHll0-PT-33@gated-at.bofh.it>
In reply to#1415395
On Mon 06-06-16 15:48:30, Johannes Weiner wrote:
> Currently, THP are counted as single pages until they are split right
> before being swapped out. However, at that point the VM is already in
> the middle of reclaim, and adjusting the LRU balance then is useless.
> 
> Always account THP by the number of basepages, and remove the fixup
> from the splitting path.
> 
> Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>

Acked-by: Michal Hocko <mhocko@suse.com>

> ---
>  mm/swap.c | 18 ++++++++----------
>  1 file changed, 8 insertions(+), 10 deletions(-)
> 
> diff --git a/mm/swap.c b/mm/swap.c
> index d2786a6308dd..c6936507abb5 100644
> --- a/mm/swap.c
> +++ b/mm/swap.c
> @@ -249,13 +249,14 @@ void rotate_reclaimable_page(struct page *page)
>  }
>  
>  static void update_page_reclaim_stat(struct lruvec *lruvec,
> -				     int file, int rotated)
> +				     int file, int rotated,
> +				     unsigned int nr_pages)
>  {
>  	struct zone_reclaim_stat *reclaim_stat = &lruvec->reclaim_stat;
>  
> -	reclaim_stat->recent_scanned[file]++;
> +	reclaim_stat->recent_scanned[file] += nr_pages;
>  	if (rotated)
> -		reclaim_stat->recent_rotated[file]++;
> +		reclaim_stat->recent_rotated[file] += nr_pages;
>  }
>  
>  static void __activate_page(struct page *page, struct lruvec *lruvec,
> @@ -272,7 +273,7 @@ static void __activate_page(struct page *page, struct lruvec *lruvec,
>  		trace_mm_lru_activate(page);
>  
>  		__count_vm_event(PGACTIVATE);
> -		update_page_reclaim_stat(lruvec, file, 1);
> +		update_page_reclaim_stat(lruvec, file, 1, hpage_nr_pages(page));
>  	}
>  }
>  
> @@ -532,7 +533,7 @@ static void lru_deactivate_file_fn(struct page *page, struct lruvec *lruvec,
>  
>  	if (active)
>  		__count_vm_event(PGDEACTIVATE);
> -	update_page_reclaim_stat(lruvec, file, 0);
> +	update_page_reclaim_stat(lruvec, file, 0, hpage_nr_pages(page));
>  }
>  
>  
> @@ -549,7 +550,7 @@ static void lru_deactivate_fn(struct page *page, struct lruvec *lruvec,
>  		add_page_to_lru_list(page, lruvec, lru);
>  
>  		__count_vm_event(PGDEACTIVATE);
> -		update_page_reclaim_stat(lruvec, file, 0);
> +		update_page_reclaim_stat(lruvec, file, 0, hpage_nr_pages(page));
>  	}
>  }
>  
> @@ -809,9 +810,6 @@ void lru_add_page_tail(struct page *page, struct page *page_tail,
>  		list_head = page_tail->lru.prev;
>  		list_move_tail(&page_tail->lru, list_head);
>  	}
> -
> -	if (!PageUnevictable(page))
> -		update_page_reclaim_stat(lruvec, file, PageActive(page_tail));
>  }
>  #endif /* CONFIG_TRANSPARENT_HUGEPAGE */
>  
> @@ -826,7 +824,7 @@ static void __pagevec_lru_add_fn(struct page *page, struct lruvec *lruvec,
>  
>  	SetPageLRU(page);
>  	add_page_to_lru_list(page, lruvec, lru);
> -	update_page_reclaim_stat(lruvec, file, active);
> +	update_page_reclaim_stat(lruvec, file, active, hpage_nr_pages(page));
>  	trace_mm_lru_insertion(page, lru);
>  }
>  
> -- 
> 2.8.3

-- 
Michal Hocko
SUSE Labs

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


#1416978 — Re: [PATCH 04/10] mm: fix LRU balancing effect of new transparent huge pages

FromMinchan Kim <minchan@kernel.org>
Date2016-06-08 09:30 +0200
SubjectRe: [PATCH 04/10] mm: fix LRU balancing effect of new transparent huge pages
Message-ID<rHG68-5xf-67@gated-at.bofh.it>
In reply to#1415395
On Mon, Jun 06, 2016 at 03:48:30PM -0400, Johannes Weiner wrote:
> Currently, THP are counted as single pages until they are split right
> before being swapped out. However, at that point the VM is already in
> the middle of reclaim, and adjusting the LRU balance then is useless.
> 
> Always account THP by the number of basepages, and remove the fixup
> from the splitting path.
> 
> Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
Acked-by: Minchan Kim <minchan@kernel.org>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web