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


Groups > linux.kernel > #1445575 > unrolled thread

[PATCH 2/3] mm, vmscan: Release/reacquire lru_lock on pgdat change

Started byMel Gorman <mgorman@techsingularity.net>
First post2016-07-18 17:00 +0200
Last post2016-07-19 02:00 +0200
Articles 3 — 3 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 2/3] mm, vmscan: Release/reacquire lru_lock on pgdat change Mel Gorman <mgorman@techsingularity.net> - 2016-07-18 17:00 +0200
    Re: [PATCH 2/3] mm, vmscan: Release/reacquire lru_lock on pgdat  change Johannes Weiner <hannes@cmpxchg.org> - 2016-07-18 18:20 +0200
    Re: [PATCH 2/3] mm, vmscan: Release/reacquire lru_lock on pgdat  change Minchan Kim <minchan@kernel.org> - 2016-07-19 02:00 +0200

#1445575 — [PATCH 2/3] mm, vmscan: Release/reacquire lru_lock on pgdat change

FromMel Gorman <mgorman@techsingularity.net>
Date2016-07-18 17:00 +0200
Subject[PATCH 2/3] mm, vmscan: Release/reacquire lru_lock on pgdat change
Message-ID<rWibv-7xJ-21@gated-at.bofh.it>
With node-lru, the locking is based on the pgdat. As Minchan pointed
out, there is an opportunity to reduce LRU lock release/acquire in
check_move_unevictable_pages by only changing lock on a pgdat change.

Signed-off-by: Mel Gorman <mgorman@techsingularity.net>
---
 mm/vmscan.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index 45344acf52ba..a6f31617a08c 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -3775,24 +3775,24 @@ int page_evictable(struct page *page)
 void check_move_unevictable_pages(struct page **pages, int nr_pages)
 {
 	struct lruvec *lruvec;
-	struct zone *zone = NULL;
+	struct pglist_data *pgdat = NULL;
 	int pgscanned = 0;
 	int pgrescued = 0;
 	int i;
 
 	for (i = 0; i < nr_pages; i++) {
 		struct page *page = pages[i];
-		struct zone *pagezone;
+		struct pglist_data *pagepgdat = page_pgdat(page);
 
 		pgscanned++;
-		pagezone = page_zone(page);
-		if (pagezone != zone) {
-			if (zone)
-				spin_unlock_irq(zone_lru_lock(zone));
-			zone = pagezone;
-			spin_lock_irq(zone_lru_lock(zone));
+		pagepgdat = page_pgdat(page);
+		if (pagepgdat != pgdat) {
+			if (pgdat)
+				spin_unlock_irq(&pgdat->lru_lock);
+			pgdat = pagepgdat;
+			spin_lock_irq(&pgdat->lru_lock);
 		}
-		lruvec = mem_cgroup_page_lruvec(page, zone->zone_pgdat);
+		lruvec = mem_cgroup_page_lruvec(page, pgdat);
 
 		if (!PageLRU(page) || !PageUnevictable(page))
 			continue;
@@ -3808,10 +3808,10 @@ void check_move_unevictable_pages(struct page **pages, int nr_pages)
 		}
 	}
 
-	if (zone) {
+	if (pgdat) {
 		__count_vm_events(UNEVICTABLE_PGRESCUED, pgrescued);
 		__count_vm_events(UNEVICTABLE_PGSCANNED, pgscanned);
-		spin_unlock_irq(zone_lru_lock(zone));
+		spin_unlock_irq(&pgdat->lru_lock);
 	}
 }
 #endif /* CONFIG_SHMEM */
-- 
2.6.4

[toc] | [next] | [standalone]


#1445606 — Re: [PATCH 2/3] mm, vmscan: Release/reacquire lru_lock on pgdat change

FromJohannes Weiner <hannes@cmpxchg.org>
Date2016-07-18 18:20 +0200
SubjectRe: [PATCH 2/3] mm, vmscan: Release/reacquire lru_lock on pgdat change
Message-ID<rWjqV-8vS-1@gated-at.bofh.it>
In reply to#1445575
On Mon, Jul 18, 2016 at 03:50:25PM +0100, Mel Gorman wrote:
> With node-lru, the locking is based on the pgdat. As Minchan pointed
> out, there is an opportunity to reduce LRU lock release/acquire in
> check_move_unevictable_pages by only changing lock on a pgdat change.
> 
> Signed-off-by: Mel Gorman <mgorman@techsingularity.net>

Acked-by: Johannes Weiner <hannes@cmpxchg.org>

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


#1445945 — Re: [PATCH 2/3] mm, vmscan: Release/reacquire lru_lock on pgdat change

FromMinchan Kim <minchan@kernel.org>
Date2016-07-19 02:00 +0200
SubjectRe: [PATCH 2/3] mm, vmscan: Release/reacquire lru_lock on pgdat change
Message-ID<rWqC6-4yl-23@gated-at.bofh.it>
In reply to#1445575
On Mon, Jul 18, 2016 at 03:50:25PM +0100, Mel Gorman wrote:
> With node-lru, the locking is based on the pgdat. As Minchan pointed
> out, there is an opportunity to reduce LRU lock release/acquire in
> check_move_unevictable_pages by only changing lock on a pgdat change.
> 
> Signed-off-by: Mel Gorman <mgorman@techsingularity.net>
> ---
>  mm/vmscan.c | 22 +++++++++++-----------
>  1 file changed, 11 insertions(+), 11 deletions(-)
> 
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index 45344acf52ba..a6f31617a08c 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -3775,24 +3775,24 @@ int page_evictable(struct page *page)
>  void check_move_unevictable_pages(struct page **pages, int nr_pages)
>  {
>  	struct lruvec *lruvec;
> -	struct zone *zone = NULL;
> +	struct pglist_data *pgdat = NULL;
>  	int pgscanned = 0;
>  	int pgrescued = 0;
>  	int i;
>  
>  	for (i = 0; i < nr_pages; i++) {
>  		struct page *page = pages[i];
> -		struct zone *pagezone;
> +		struct pglist_data *pagepgdat = page_pgdat(page);

No need to initialize in here.

>  
>  		pgscanned++;
> -		pagezone = page_zone(page);
> -		if (pagezone != zone) {
> -			if (zone)
> -				spin_unlock_irq(zone_lru_lock(zone));
> -			zone = pagezone;
> -			spin_lock_irq(zone_lru_lock(zone));
> +		pagepgdat = page_pgdat(page);

Double initialize. Please remove either one.

> +		if (pagepgdat != pgdat) {
> +			if (pgdat)
> +				spin_unlock_irq(&pgdat->lru_lock);
> +			pgdat = pagepgdat;
> +			spin_lock_irq(&pgdat->lru_lock);
>  		}
> -		lruvec = mem_cgroup_page_lruvec(page, zone->zone_pgdat);
> +		lruvec = mem_cgroup_page_lruvec(page, pgdat);
>  
>  		if (!PageLRU(page) || !PageUnevictable(page))
>  			continue;
> @@ -3808,10 +3808,10 @@ void check_move_unevictable_pages(struct page **pages, int nr_pages)
>  		}
>  	}
>  
> -	if (zone) {
> +	if (pgdat) {
>  		__count_vm_events(UNEVICTABLE_PGRESCUED, pgrescued);
>  		__count_vm_events(UNEVICTABLE_PGSCANNED, pgscanned);
> -		spin_unlock_irq(zone_lru_lock(zone));
> +		spin_unlock_irq(&pgdat->lru_lock);
>  	}
>  }
>  #endif /* CONFIG_SHMEM */
> -- 
> 2.6.4
> 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web