Skip to contentSkip to conversation

mm: reverse lru scanning order

RFC PATCH Superseded Konstantin Khlebnikov 5 participants 7 messages Jul 27, 2011 – Aug 8, 2011

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 mm: reverse lru scanning order

LRU scanning order was accidentially changed in commit v2.6.27-5584-gb69408e:
"vmscan: Use an indexed array for LRU variables".
Before that commit reclaimer always scan active lists first.

This patch just reverse it back.
This is just notice and question: "Does it affect something?"

---
 include/linux/mmzone.h |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
include/linux/mmzone.h +2 -1
index be1ac8d..88fb49c 100644
@@ -141,7 +141,8 @@ enum lru_list {
 
 #define for_each_lru(l) for (l = 0; l < NR_LRU_LISTS; l++)
 
-#define for_each_evictable_lru(l) for (l = 0; l <= LRU_ACTIVE_FILE; l++)
+#define for_each_evictable_lru(l) \
+	for (l = LRU_ACTIVE_FILE; l >= LRU_INACTIVE_ANON; l--)
 
 static inline int is_file_lru(enum lru_list l)
 {
#1 lore raw

sorry, this patch is broken.

Quoted 17 lines · Konstantin Khlebnikov

LRU scanning order was accidentially changed in commit v2.6.27-5584-gb69408e:
"vmscan: Use an indexed array for LRU variables".
Before that commit reclaimer always scan active lists first.

This patch just reverse it back.
This is just notice and question: "Does it affect something?"

---
  include/linux/mmzone.h |    3 ++-
  1 files changed, 2 insertions(+), 1 deletions(-)
include/linux/mmzone.h +0 -0
index be1ac8d..88fb49c 100644

include/linux/mmzone.h enum lru_list { · line 145

Quoted 6 lines
include/linux/mmzone.h +2 -1
@@ -141,7 +141,8 @@ enum lru_list {
 
  #define for_each_lru(l) for (l = 0; l<  NR_LRU_LISTS; l++)
 
-#define for_each_evictable_lru(l) for (l = 0; l<= LRU_ACTIVE_FILE; l++)
+#define for_each_evictable_lru(l) \
+	for (l = LRU_ACTIVE_FILE; l>= LRU_INACTIVE_ANON; l--)

there must be some thing like this:

+#define for_each_evictable_lru(l) \
+ for (l = LRU_ACTIVE_FILE; (int)l>= LRU_INACTIVE_ANON; l--)

otherwise gcc silently generates there infinite loop =)

Quoted 4 lines
include/linux/mmzone.h +0 -0
  static inline int is_file_lru(enum lru_list l)
  {
 
#2 lore raw
Quoted 1 line · Konstantin Khlebnikov

sorry, this patch is broken.

If you resend a _tested_ patch, I'll ack this one.

Thanks.

Quoted 8 lines
Quoted 6 lines · Konstantin Khlebnikov

LRU scanning order was accidentially changed in commit v2.6.27-5584-gb69408e:
"vmscan: Use an indexed array for LRU variables".
Before that commit reclaimer always scan active lists first.

This patch just reverse it back.
This is just notice and question: "Does it affect something?"

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#3 lore raw

PATCH v2 1/1 vmscan: reverse lru scanning order

In reply to Konstantin Khlebnikov

LRU scanning order was accidentially changed in commit v2.6.27-5584-gb69408e:
"vmscan: Use an indexed array for LRU variables".
Before that commit reclaimer always scan active lists first.

This patch just reverse it back.

---
 include/linux/mmzone.h |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
include/linux/mmzone.h +2 -1
index be1ac8d..0094389 100644
@@ -141,7 +141,8 @@ enum lru_list {
 
 #define for_each_lru(l) for (l = 0; l < NR_LRU_LISTS; l++)
 
-#define for_each_evictable_lru(l) for (l = 0; l <= LRU_ACTIVE_FILE; l++)
+#define for_each_evictable_lru(l) \
+	for (l = LRU_ACTIVE_FILE; (int)l >= LRU_INACTIVE_ANON; l--)
 
 static inline int is_file_lru(enum lru_list l)
 {

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#4 lore raw

Re: [PATCH v2] vmscan: reverse lru scanning order

Quoted 5 lines · Konstantin Khlebnikov

LRU scanning order was accidentially changed in commit v2.6.27-5584-gb69408e:
"vmscan: Use an indexed array for LRU variables".
Before that commit reclaimer always scan active lists first.

This patch just reverse it back.

I am still not sure I see why the ordering matters that much. One thing that might matter is that shrink_list moves some pages from active to inactive list if inactive is low so it makes sense to try to shrink active before inactive. It would be a problem if inactive was almost empty. Then we would just waste time by shrinking inactive first. I am not sure how real problem is that, though.

Whatever is the reason, I think it should be documented in the changelog.
The change makes sense to me.

Quoted 27 lines
---
 include/linux/mmzone.h |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
include/linux/mmzone.h +2 -2
index be1ac8d..0094389 100644
@@ -141,7 +141,8 @@ enum lru_list {
 
 #define for_each_lru(l) for (l = 0; l < NR_LRU_LISTS; l++)
 
-#define for_each_evictable_lru(l) for (l = 0; l <= LRU_ACTIVE_FILE; l++)
+#define for_each_evictable_lru(l) \
+	for (l = LRU_ACTIVE_FILE; (int)l >= LRU_INACTIVE_ANON; l--)
 
 static inline int is_file_lru(enum lru_list l)
 {
 
--

To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

Signature · 6 lines
Michal Hocko
SUSE Labs
SUSE LINUX s.r.o.
Lihovarska 1060/12
190 00 Praha 9    
Czech Republic
#5 lore raw

Re: [PATCH v2] vmscan: reverse lru scanning order

Quoted 14 lines · Michal Hocko
Quoted 5 lines · Konstantin Khlebnikov

LRU scanning order was accidentially changed in commit v2.6.27-5584-gb69408e:
"vmscan: Use an indexed array for LRU variables".
Before that commit reclaimer always scan active lists first.

This patch just reverse it back.

I am still not sure I see why the ordering matters that much. One thing that might matter is that shrink_list moves some pages from active to inactive list if inactive is low so it makes sense to try to shrink active before inactive. It would be a problem if inactive was almost empty. Then we would just waste time by shrinking inactive first. I am not sure how real problem is that, though.

Quoted 4 lines

Whatever is the reason, I think it should be documented in the changelog.
The change makes sense to me.

Absolutely agree with Michal.
I think the patch itself doesn't have a problem and even it is does make sense. But we need changelog why we need it.
I don't want to overwrite recent git log without any issue.
It annoys us when we find a bug by git-blame. ;-)

Signature · 2 lines
Kind regards,
Minchan Kim
#6 lore raw

Re: [PATCH v2] vmscan: reverse lru scanning order

In reply to Konstantin Khlebnikov
Quoted 7 lines · On Mon, 8 Aug 2011 15:02:07 +0400 Konstantin Khlebnikov…

LRU scanning order was accidentially changed in commit v2.6.27-5584-gb69408e:
"vmscan: Use an indexed array for LRU variables".
Before that commit reclaimer always scan active lists first.

This patch just reverse it back.

makes sense...but what real problem do you see ?

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>