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


Groups > linux.kernel > #1415399 > unrolled thread

[PATCH 06/10] mm: remove unnecessary use-once cache bias from LRU balancing

Started byJohannes Weiner <hannes@cmpxchg.org>
First post2016-06-06 22:00 +0200
Last post2016-06-08 14:40 +0200
Articles 5 — 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 06/10] mm: remove unnecessary use-once cache bias from LRU balancing Johannes Weiner <hannes@cmpxchg.org> - 2016-06-06 22:00 +0200
    Re: [PATCH 06/10] mm: remove unnecessary use-once cache bias from  LRU balancing Rik van Riel <riel@redhat.com> - 2016-06-07 04:30 +0200
      Re: [PATCH 06/10] mm: remove unnecessary use-once cache bias from  LRU balancing Johannes Weiner <hannes@cmpxchg.org> - 2016-06-07 16:20 +0200
    Re: [PATCH 06/10] mm: remove unnecessary use-once cache bias from  LRU balancing Minchan Kim <minchan@kernel.org> - 2016-06-08 10:10 +0200
    Re: [PATCH 06/10] mm: remove unnecessary use-once cache bias from  LRU balancing Michal Hocko <mhocko@kernel.org> - 2016-06-08 14:40 +0200

#1415399 — [PATCH 06/10] mm: remove unnecessary use-once cache bias from LRU balancing

FromJohannes Weiner <hannes@cmpxchg.org>
Date2016-06-06 22:00 +0200
Subject[PATCH 06/10] mm: remove unnecessary use-once cache bias from LRU balancing
Message-ID<rH8QO-Oc-21@gated-at.bofh.it>
When the splitlru patches divided page cache and swap-backed pages
into separate LRU lists, the pressure balance between the lists was
biased to account for the fact that streaming IO can cause memory
pressure with a flood of pages that are used only once. New page cache
additions would tip the balance toward the file LRU, and repeat access
would neutralize that bias again. This ensured that page reclaim would
always go for used-once cache first.

Since e9868505987a ("mm,vmscan: only evict file pages when we have
plenty"), page reclaim generally skips over swap-backed memory
entirely as long as there is used-once cache present, and will apply
the LRU balancing when only repeatedly accessed cache pages are left -
at which point the previous use-once bias will have been neutralized.

This makes the use-once cache balancing bias unnecessary. Remove it.

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

diff --git a/mm/swap.c b/mm/swap.c
index 576c721f210b..814e3a2e54b4 100644
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -264,7 +264,6 @@ static void __activate_page(struct page *page, struct lruvec *lruvec,
 			    void *arg)
 {
 	if (PageLRU(page) && !PageActive(page) && !PageUnevictable(page)) {
-		int file = page_is_file_cache(page);
 		int lru = page_lru_base_type(page);
 
 		del_page_from_lru_list(page, lruvec, lru);
@@ -274,7 +273,6 @@ 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, hpage_nr_pages(page));
 	}
 }
 
@@ -797,8 +795,6 @@ EXPORT_SYMBOL(__pagevec_release);
 void lru_add_page_tail(struct page *page, struct page *page_tail,
 		       struct lruvec *lruvec, struct list_head *list)
 {
-	const int file = 0;
-
 	VM_BUG_ON_PAGE(!PageHead(page), page);
 	VM_BUG_ON_PAGE(PageCompound(page_tail), page);
 	VM_BUG_ON_PAGE(PageLRU(page_tail), page);
@@ -833,20 +829,13 @@ void lru_add_page_tail(struct page *page, struct page *page_tail,
 static void __pagevec_lru_add_fn(struct page *page, struct lruvec *lruvec,
 				 void *arg)
 {
-	int file = page_is_file_cache(page);
-	int active = PageActive(page);
 	enum lru_list lru = page_lru(page);
-	bool new = (bool)arg;
 
 	VM_BUG_ON_PAGE(PageLRU(page), page);
 
 	SetPageLRU(page);
 	add_page_to_lru_list(page, lruvec, lru);
 
-	if (new)
-		update_page_reclaim_stat(lruvec, file, active,
-					 hpage_nr_pages(page));
-
 	trace_mm_lru_insertion(page, lru);
 }
 
-- 
2.8.3

[toc] | [next] | [standalone]


#1415628 — Re: [PATCH 06/10] mm: remove unnecessary use-once cache bias from LRU balancing

FromRik van Riel <riel@redhat.com>
Date2016-06-07 04:30 +0200
SubjectRe: [PATCH 06/10] mm: remove unnecessary use-once cache bias from LRU balancing
Message-ID<rHeWd-53P-1@gated-at.bofh.it>
In reply to#1415399

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

On Mon, 2016-06-06 at 15:48 -0400, Johannes Weiner wrote:
> When the splitlru patches divided page cache and swap-backed pages
> into separate LRU lists, the pressure balance between the lists was
> biased to account for the fact that streaming IO can cause memory
> pressure with a flood of pages that are used only once. New page
> cache
> additions would tip the balance toward the file LRU, and repeat
> access
> would neutralize that bias again. This ensured that page reclaim
> would
> always go for used-once cache first.
> 
> Since e9868505987a ("mm,vmscan: only evict file pages when we have
> plenty"), page reclaim generally skips over swap-backed memory
> entirely as long as there is used-once cache present, and will apply
> the LRU balancing when only repeatedly accessed cache pages are left
> -
> at which point the previous use-once bias will have been neutralized.
> 
> This makes the use-once cache balancing bias unnecessary. Remove it.
> 

The code in get_scan_count() still seems to use the statistics
of which you just removed the updating.

What am I overlooking?

-- 
All Rights Reversed.

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


#1416248 — Re: [PATCH 06/10] mm: remove unnecessary use-once cache bias from LRU balancing

FromJohannes Weiner <hannes@cmpxchg.org>
Date2016-06-07 16:20 +0200
SubjectRe: [PATCH 06/10] mm: remove unnecessary use-once cache bias from LRU balancing
Message-ID<rHq1j-3KB-7@gated-at.bofh.it>
In reply to#1415628
On Mon, Jun 06, 2016 at 10:20:31PM -0400, Rik van Riel wrote:
> On Mon, 2016-06-06 at 15:48 -0400, Johannes Weiner wrote:
> > When the splitlru patches divided page cache and swap-backed pages
> > into separate LRU lists, the pressure balance between the lists was
> > biased to account for the fact that streaming IO can cause memory
> > pressure with a flood of pages that are used only once. New page
> > cache
> > additions would tip the balance toward the file LRU, and repeat
> > access
> > would neutralize that bias again. This ensured that page reclaim
> > would
> > always go for used-once cache first.
> > 
> > Since e9868505987a ("mm,vmscan: only evict file pages when we have
> > plenty"), page reclaim generally skips over swap-backed memory
> > entirely as long as there is used-once cache present, and will apply
> > the LRU balancing when only repeatedly accessed cache pages are left
> > -
> > at which point the previous use-once bias will have been neutralized.
> > 
> > This makes the use-once cache balancing bias unnecessary. Remove it.
> > 
> 
> The code in get_scan_count() still seems to use the statistics
> of which you just removed the updating.
> 
> What am I overlooking?

As I mentioned in 5/10, page reclaim still does updates for each
scanned page and rotated page at this point in the series.

This merely removes the pre-reclaim bias for cache.

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


#1417016 — Re: [PATCH 06/10] mm: remove unnecessary use-once cache bias from LRU balancing

FromMinchan Kim <minchan@kernel.org>
Date2016-06-08 10:10 +0200
SubjectRe: [PATCH 06/10] mm: remove unnecessary use-once cache bias from LRU balancing
Message-ID<rHGIN-64G-19@gated-at.bofh.it>
In reply to#1415399
On Mon, Jun 06, 2016 at 03:48:32PM -0400, Johannes Weiner wrote:
> When the splitlru patches divided page cache and swap-backed pages
> into separate LRU lists, the pressure balance between the lists was
> biased to account for the fact that streaming IO can cause memory
> pressure with a flood of pages that are used only once. New page cache
> additions would tip the balance toward the file LRU, and repeat access
> would neutralize that bias again. This ensured that page reclaim would
> always go for used-once cache first.
> 
> Since e9868505987a ("mm,vmscan: only evict file pages when we have
> plenty"), page reclaim generally skips over swap-backed memory
> entirely as long as there is used-once cache present, and will apply
> the LRU balancing when only repeatedly accessed cache pages are left -
> at which point the previous use-once bias will have been neutralized.
> 
> This makes the use-once cache balancing bias unnecessary. Remove it.
> 
> Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
Acked-by: Minchan Kim <minchan@kernel.org>

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


#1417369 — Re: [PATCH 06/10] mm: remove unnecessary use-once cache bias from LRU balancing

FromMichal Hocko <mhocko@kernel.org>
Date2016-06-08 14:40 +0200
SubjectRe: [PATCH 06/10] mm: remove unnecessary use-once cache bias from LRU balancing
Message-ID<rHKW6-7x-35@gated-at.bofh.it>
In reply to#1415399
On Mon 06-06-16 15:48:32, Johannes Weiner wrote:
> When the splitlru patches divided page cache and swap-backed pages
> into separate LRU lists, the pressure balance between the lists was
> biased to account for the fact that streaming IO can cause memory
> pressure with a flood of pages that are used only once. New page cache
> additions would tip the balance toward the file LRU, and repeat access
> would neutralize that bias again. This ensured that page reclaim would
> always go for used-once cache first.
> 
> Since e9868505987a ("mm,vmscan: only evict file pages when we have
> plenty"), page reclaim generally skips over swap-backed memory
> entirely as long as there is used-once cache present, and will apply
> the LRU balancing when only repeatedly accessed cache pages are left -
> at which point the previous use-once bias will have been neutralized.
> 
> This makes the use-once cache balancing bias unnecessary. Remove it.
> 
> Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>

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

> ---
>  mm/swap.c | 11 -----------
>  1 file changed, 11 deletions(-)
> 
> diff --git a/mm/swap.c b/mm/swap.c
> index 576c721f210b..814e3a2e54b4 100644
> --- a/mm/swap.c
> +++ b/mm/swap.c
> @@ -264,7 +264,6 @@ static void __activate_page(struct page *page, struct lruvec *lruvec,
>  			    void *arg)
>  {
>  	if (PageLRU(page) && !PageActive(page) && !PageUnevictable(page)) {
> -		int file = page_is_file_cache(page);
>  		int lru = page_lru_base_type(page);
>  
>  		del_page_from_lru_list(page, lruvec, lru);
> @@ -274,7 +273,6 @@ 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, hpage_nr_pages(page));
>  	}
>  }
>  
> @@ -797,8 +795,6 @@ EXPORT_SYMBOL(__pagevec_release);
>  void lru_add_page_tail(struct page *page, struct page *page_tail,
>  		       struct lruvec *lruvec, struct list_head *list)
>  {
> -	const int file = 0;
> -
>  	VM_BUG_ON_PAGE(!PageHead(page), page);
>  	VM_BUG_ON_PAGE(PageCompound(page_tail), page);
>  	VM_BUG_ON_PAGE(PageLRU(page_tail), page);
> @@ -833,20 +829,13 @@ void lru_add_page_tail(struct page *page, struct page *page_tail,
>  static void __pagevec_lru_add_fn(struct page *page, struct lruvec *lruvec,
>  				 void *arg)
>  {
> -	int file = page_is_file_cache(page);
> -	int active = PageActive(page);
>  	enum lru_list lru = page_lru(page);
> -	bool new = (bool)arg;
>  
>  	VM_BUG_ON_PAGE(PageLRU(page), page);
>  
>  	SetPageLRU(page);
>  	add_page_to_lru_list(page, lruvec, lru);
>  
> -	if (new)
> -		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] | [standalone]


Back to top | Article view | linux.kernel


csiph-web