Re: [PATCH]vmscan: handle underflow for get_scan_ratio

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: KOSAKI Motohiro
Date: Tuesday, March 30, 2010 - 12:31 am

> > > > Very unfortunately, this patch isn't acceptable. In past time, vmscan 

To revert can save percent[0]==0 && priority==0 case. but it shouldn't
happen, I think. It mean to happen big latency issue.

Can you please try following patch? Also, I'll prepare reproduce environment soon.



---
 mm/vmscan.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index 79c8098..abf7f79 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -1571,15 +1571,19 @@ static void get_scan_ratio(struct zone *zone, struct scan_control *sc,
 	 */
 	if (unlikely(reclaim_stat->recent_scanned[0] > anon / 4)) {
 		spin_lock_irq(&zone->lru_lock);
-		reclaim_stat->recent_scanned[0] /= 2;
-		reclaim_stat->recent_rotated[0] /= 2;
+		while (reclaim_stat->recent_scanned[0] > anon / 4) {
+			reclaim_stat->recent_scanned[0] /= 2;
+			reclaim_stat->recent_rotated[0] /= 2;
+		}
 		spin_unlock_irq(&zone->lru_lock);
 	}
 
 	if (unlikely(reclaim_stat->recent_scanned[1] > file / 4)) {
 		spin_lock_irq(&zone->lru_lock);
-		reclaim_stat->recent_scanned[1] /= 2;
-		reclaim_stat->recent_rotated[1] /= 2;
+		while (reclaim_stat->recent_scanned[1] > file / 4) {
+			reclaim_stat->recent_scanned[1] /= 2;
+			reclaim_stat->recent_rotated[1] /= 2;
+		}
 		spin_unlock_irq(&zone->lru_lock);
 	}
 
-- 
1.6.5.2





--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH]vmscan: handle underflow for get_scan_ratio, Shaohua Li, (Mon Mar 29, 10:53 pm)
Re: [PATCH]vmscan: handle underflow for get_scan_ratio, KOSAKI Motohiro, (Mon Mar 29, 11:08 pm)
Re: [PATCH]vmscan: handle underflow for get_scan_ratio, Shaohua Li, (Mon Mar 29, 11:32 pm)
Re: [PATCH]vmscan: handle underflow for get_scan_ratio, KOSAKI Motohiro, (Mon Mar 29, 11:40 pm)
Re: [PATCH]vmscan: handle underflow for get_scan_ratio, Shaohua Li, (Mon Mar 29, 11:53 pm)
Re: [PATCH]vmscan: handle underflow for get_scan_ratio, KOSAKI Motohiro, (Tue Mar 30, 12:31 am)
Re: [PATCH]vmscan: handle underflow for get_scan_ratio, Minchan Kim, (Tue Mar 30, 3:17 am)
Re: [PATCH]vmscan: handle underflow for get_scan_ratio, KOSAKI Motohiro, (Tue Mar 30, 3:25 am)
Re: [PATCH]vmscan: handle underflow for get_scan_ratio, Balbir Singh, (Tue Mar 30, 4:56 am)
Re: [PATCH]vmscan: handle underflow for get_scan_ratio, KOSAKI Motohiro, (Tue Mar 30, 10:38 pm)
Re: [PATCH]vmscan: handle underflow for get_scan_ratio, Wu Fengguang, (Tue Mar 30, 10:41 pm)
Re: [PATCH]vmscan: handle underflow for get_scan_ratio, Wu Fengguang, (Tue Mar 30, 10:51 pm)
Re: [PATCH]vmscan: handle underflow for get_scan_ratio, KOSAKI Motohiro, (Tue Mar 30, 10:53 pm)
Re: [PATCH]vmscan: handle underflow for get_scan_ratio, KOSAKI Motohiro, (Tue Mar 30, 11:00 pm)
Re: [PATCH]vmscan: handle underflow for get_scan_ratio, Wu Fengguang, (Tue Mar 30, 11:03 pm)
Re: [PATCH]vmscan: handle underflow for get_scan_ratio, Andrew Morton, (Thu Apr 1, 3:16 pm)
Re: [PATCH]vmscan: handle underflow for get_scan_ratio, KOSAKI Motohiro, (Fri Apr 2, 2:13 am)
Re: [PATCH]vmscan: handle underflow for get_scan_ratio, KOSAKI Motohiro, (Fri Apr 2, 2:14 am)
Re: [PATCH]vmscan: handle underflow for get_scan_ratio, Wu Fengguang, (Sat Apr 3, 5:48 pm)
Re: [PATCH]vmscan: handle underflow for get_scan_ratio, KOSAKI Motohiro, (Sun Apr 4, 7:19 am)
Re: [PATCH]vmscan: handle underflow for get_scan_ratio, Wu Fengguang, (Mon Apr 5, 6:22 pm)
Re: [PATCH]vmscan: handle underflow for get_scan_ratio, KOSAKI Motohiro, (Mon Apr 5, 6:36 pm)
Re: [PATCH]vmscan: handle underflow for get_scan_ratio, Wu Fengguang, (Mon Apr 5, 6:50 pm)
Re: [PATCH]vmscan: handle underflow for get_scan_ratio, KOSAKI Motohiro, (Mon Apr 5, 7:06 pm)
Re: [PATCH]vmscan: handle underflow for get_scan_ratio, Wu Fengguang, (Mon Apr 5, 7:30 pm)
Re: [PATCH]vmscan: handle underflow for get_scan_ratio, KOSAKI Motohiro, (Mon Apr 5, 7:58 pm)
Re: [PATCH]vmscan: handle underflow for get_scan_ratio, Wu Fengguang, (Mon Apr 5, 8:31 pm)
Re: [PATCH]vmscan: handle underflow for get_scan_ratio, Rik van Riel, (Mon Apr 5, 8:36 pm)
Re: [PATCH]vmscan: handle underflow for get_scan_ratio, Rik van Riel, (Mon Apr 5, 8:40 pm)
Re: [PATCH]vmscan: handle underflow for get_scan_ratio, Wu Fengguang, (Mon Apr 5, 9:49 pm)
Re: [PATCH]vmscan: handle underflow for get_scan_ratio, Wu Fengguang, (Mon Apr 5, 10:03 pm)
Re: [PATCH]vmscan: handle underflow for get_scan_ratio, Andrew Morton, (Fri Apr 9, 2:20 pm)
Re: [PATCH]vmscan: handle underflow for get_scan_ratio, Rik van Riel, (Fri Apr 9, 2:25 pm)
Re: [PATCH]vmscan: handle underflow for get_scan_ratio, KOSAKI Motohiro, (Mon Apr 12, 6:30 pm)
Re: [PATCH]vmscan: handle underflow for get_scan_ratio, Rik van Riel, (Mon Apr 12, 7:42 pm)
Re: [PATCH]vmscan: handle underflow for get_scan_ratio, KOSAKI Motohiro, (Tue Apr 13, 12:55 am)
Re: [PATCH]vmscan: handle underflow for get_scan_ratio, KOSAKI Motohiro, (Tue Apr 13, 1:55 am)
Re: [PATCH]vmscan: handle underflow for get_scan_ratio, KOSAKI Motohiro, (Wed Apr 14, 8:25 pm)