Skip to contentSkip to conversation

mm/vmscan: rename zone_nr_pages() to zone_lru_nr_pages()

PATCH In review Vincent Li 3 participants 8 messages Aug 20, 2009 – Aug 21, 2009

Subsystems (3)
lore
Share & tools
lore

Vincent Li

author
#0 lore raw

PATCH 1/1 mm/vmscan: rename zone_nr_pages() to zone_lru_nr_pages()

Name zone_nr_pages can be mis-read as zone's (total) number pages, but it actually returns zone's LRU list number pages.

I know reading the code would clear the name confusion, want to know if patch making sense.

---
 mm/vmscan.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
mm/vmscan.c +6 -6
index 00596b9..9a55cb3 100644
@@ -148,7 +148,7 @@ static struct zone_reclaim_stat *get_reclaim_stat(struct zone *zone,
 	return &zone->reclaim_stat;
 }
 
-static unsigned long zone_nr_pages(struct zone *zone, struct scan_control *sc,
+static unsigned long zone_lru_nr_pages(struct zone *zone, struct scan_control *sc,
 				   enum lru_list lru)
 {
 	if (!scanning_global_lru(sc))
@@ -1479,10 +1479,10 @@ static void get_scan_ratio(struct zone *zone, struct scan_control *sc,
 	unsigned long ap, fp;
 	struct zone_reclaim_stat *reclaim_stat = get_reclaim_stat(zone, sc);
 
-	anon  = zone_nr_pages(zone, sc, LRU_ACTIVE_ANON) +
-		zone_nr_pages(zone, sc, LRU_INACTIVE_ANON);
-	file  = zone_nr_pages(zone, sc, LRU_ACTIVE_FILE) +
-		zone_nr_pages(zone, sc, LRU_INACTIVE_FILE);
+	anon  = zone_lru_nr_pages(zone, sc, LRU_ACTIVE_ANON) +
+		zone_lru_nr_pages(zone, sc, LRU_INACTIVE_ANON);
+	file  = zone_lru_nr_pages(zone, sc, LRU_ACTIVE_FILE) +
+		zone_lru_nr_pages(zone, sc, LRU_INACTIVE_FILE);
 
 	if (scanning_global_lru(sc)) {
 		free  = zone_page_state(zone, NR_FREE_PAGES);
@@ -1590,7 +1590,7 @@ static void shrink_zone(int priority, struct zone *zone,
 		int file = is_file_lru(l);
 		unsigned long scan;
 
-		scan = zone_nr_pages(zone, sc, l);
+		scan = zone_lru_nr_pages(zone, sc, l);
 		if (priority || noswap) {
 			scan >>= priority;
 			scan = (scan * percent[file]) / 100;
Signature · 7 lines
1.6.0.4

--
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/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
maintainer
#1 lore raw
Quoted 2 lines · On Thu, 20 Aug 2009 11:42:54 -0700 Vincent Li <[email protected]> wrote:

Name zone_nr_pages can be mis-read as zone's (total) number pages, but it actually returns zone's LRU list number pages.

Fair enough.

mm/vmscan.c static struct zone_reclaim_stat *get_reclaim_stat(struct zone *zone, · line 151

Quoted 2 lines
mm/vmscan.c +1 -1
-static unsigned long zone_nr_pages(struct zone *zone, struct scan_control *sc,
+static unsigned long zone_lru_nr_pages(struct zone *zone, struct scan_control *sc,

Wouldn't zone_nr_lru_pages() be better?

--
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/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

author
#2 lore raw
Quoted 6 lines · Andrew Morton
Quoted 2 lines · On Thu, 20 Aug 2009 11:42:54 -0700 Vincent Li <[email protected]> wrote:

Name zone_nr_pages can be mis-read as zone's (total) number pages, but it actually returns zone's LRU list number pages.

Quoted 6 lines

Fair enough.

mm/vmscan.c static struct zone_reclaim_stat *get_reclaim_stat(struct zone *zone, · line 151

Quoted 2 lines
mm/vmscan.c +1 -1
-static unsigned long zone_nr_pages(struct zone *zone, struct scan_control *sc,
+static unsigned long zone_lru_nr_pages(struct zone *zone, struct scan_control *sc,

Wouldn't zone_nr_lru_pages() be better?

I see name isolate_lru_page and the meaning of number of lru pages. your suggestion is better. should I resend the patch with your suggestion? I ask because I saw you already put the patch in the mmotm tree before you send this email out.

Vincent Li
Biomedical Research Center
University of British Columbia

--
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/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

maintainer
#3 lore raw
Quoted 10 lines · On Thu, 20 Aug 2009 17:19:28 -0700 (PDT) Vincent Li <[email protected]> wrote:
Quoted 8 lines · Andrew Morton
Quoted 2 lines · On Thu, 20 Aug 2009 11:42:54 -0700 Vincent Li <[email protected]> wrote:

Name zone_nr_pages can be mis-read as zone's (total) number pages, but it actually returns zone's LRU list number pages.

Fair enough.

Quoted 9 lines
Quoted 4 lines

mm/vmscan.c static struct zone_reclaim_stat *get_reclaim_stat(struct zone *zone, · line 151

Quoted 2 lines
mm/vmscan.c +1 -1
-static unsigned long zone_nr_pages(struct zone *zone, struct scan_control *sc,
+static unsigned long zone_lru_nr_pages(struct zone *zone, struct scan_control *sc,

Wouldn't zone_nr_lru_pages() be better?

I see name isolate_lru_page and the meaning of number of lru pages. your suggestion is better. should I resend the patch with your suggestion? I ask because I saw you already put the patch in the mmotm tree before you send this email out.

I edited the diff ;)

--
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/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#4 lore raw

I sent this very message yesterday and somehow it got lost. Today I'm resending it with the hope breaks through whatever spam filter it may find in its way...

Quoted 18 lines · Andrew Morton
Quoted 15 lines · On Thu, 20 Aug 2009 17:19:28 -0700 (PDT) Vincent Li <[email protected]> wrote:
Quoted 12 lines · Andrew Morton
Quoted 2 lines · On Thu, 20 Aug 2009 11:42:54 -0700 Vincent Li <[email protected]> wrote:

Name zone_nr_pages can be mis-read as zone's (total) number pages, but it actually returns zone's LRU list number pages.

Fair enough.

mm/vmscan.c static struct zone_reclaim_stat *get_reclaim_stat(struct zone *zone, · line 151

Quoted 2 lines
mm/vmscan.c +1 -1
-static unsigned long zone_nr_pages(struct zone *zone, struct scan_control *sc,
+static unsigned long zone_lru_nr_pages(struct zone *zone, struct scan_control *sc,

Wouldn't zone_nr_lru_pages() be better?

Quoted 6 lines
Quoted 4 lines

I see name isolate_lru_page and the meaning of number of lru pages. your suggestion is better. should I resend the patch with your suggestion? I ask because I saw you already put the patch in the mmotm tree before you send this email out.

I edited the diff ;)

Wouldn't it make sense to try to keep some consistency by renaming the function mem_cgroup_zone_nr_pages to mem_cgroup_zone_nr_lru_pages, for it also deals with a specific LRU?

Fernando Carrijo

--
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/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#5 lore raw
Quoted 3 lines · Fernando Carrijo

I sent this very message yesterday and somehow it got lost. Today I'm resending it with the hope breaks through whatever spam filter it may find in its way...

Oops!

I just received the answers to the suggestions I made yesterday.

Sorry for the noise!

Quoted 31 lines · Andrew Morton
Quoted 18 lines
Quoted 15 lines · On Thu, 20 Aug 2009 17:19:28 -0700 (PDT) Vincent Li <[email protected]> wrote:
Quoted 12 lines · Andrew Morton
Quoted 2 lines · On Thu, 20 Aug 2009 11:42:54 -0700 Vincent Li <[email protected]> wrote:

Name zone_nr_pages can be mis-read as zone's (total) number pages, but it actually returns zone's LRU list number pages.

Fair enough.

mm/vmscan.c static struct zone_reclaim_stat *get_reclaim_stat(struct zone *zone, · line 151

Quoted 2 lines
mm/vmscan.c +1 -1
-static unsigned long zone_nr_pages(struct zone *zone, struct scan_control *sc,
+static unsigned long zone_lru_nr_pages(struct zone *zone, struct scan_control *sc,

Wouldn't zone_nr_lru_pages() be better?

Quoted 6 lines
Quoted 4 lines

I see name isolate_lru_page and the meaning of number of lru pages. your suggestion is better. should I resend the patch with your suggestion? I ask because I saw you already put the patch in the mmotm tree before you send this email out.

I edited the diff ;)

Wouldn't it make sense to try to keep some consistency by renaming the function mem_cgroup_zone_nr_pages to mem_cgroup_zone_nr_lru_pages, for it also deals with a specific LRU?

Quoted 7 lines

Fernando Carrijo

--
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/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

--
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/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#6 lore raw
In reply to Vincent Li
Quoted 4 lines · Vincent Li

Name zone_nr_pages can be mis-read as zone's (total) number pages, but it actually returns zone's LRU list number pages.

I know reading the code would clear the name confusion, want to know if patch making sense.

In case this patch gets an ack, wouldn't it make sense to try to keep some consistency by renaming the function mem_cgroup_zone_nr_pages to mem_cgroup_zone_lru_nr_pages, since it also deals with an specific LRU?

Fernando Carrijo

Quoted 35 lines
---
 mm/vmscan.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
mm/vmscan.c +5 -5
index 00596b9..9a55cb3 100644
@@ -148,7 +148,7 @@ static struct zone_reclaim_stat *get_reclaim_stat(struct zone *zone,
 	return &zone->reclaim_stat;
 }
 
-static unsigned long zone_nr_pages(struct zone *zone, struct scan_control *sc,
+static unsigned long zone_lru_nr_pages(struct zone *zone, struct scan_control *sc,
 				   enum lru_list lru)
 {
 	if (!scanning_global_lru(sc))
@@ -1479,10 +1479,10 @@ static void get_scan_ratio(struct zone *zone, struct scan_control *sc,
 	unsigned long ap, fp;
 	struct zone_reclaim_stat *reclaim_stat = get_reclaim_stat(zone, sc);
 
-	anon  = zone_nr_pages(zone, sc, LRU_ACTIVE_ANON) +
-		zone_nr_pages(zone, sc, LRU_INACTIVE_ANON);
-	file  = zone_nr_pages(zone, sc, LRU_ACTIVE_FILE) +
-		zone_nr_pages(zone, sc, LRU_INACTIVE_FILE);
+	anon  = zone_lru_nr_pages(zone, sc, LRU_ACTIVE_ANON) +
+		zone_lru_nr_pages(zone, sc, LRU_INACTIVE_ANON);
+	file  = zone_lru_nr_pages(zone, sc, LRU_ACTIVE_FILE) +
+		zone_lru_nr_pages(zone, sc, LRU_INACTIVE_FILE);
 
 	if (scanning_global_lru(sc)) {
 		free  = zone_page_state(zone, NR_FREE_PAGES);

mm/vmscan.c static void shrink_zone(int priority, struct zone *zone, · line 1596

Quoted 8 lines
mm/vmscan.c +1 -1
@@ -1590,7 +1590,7 @@ static void shrink_zone(int priority, struct zone *zone,
 		int file = is_file_lru(l);
 		unsigned long scan;
 
-		scan = zone_nr_pages(zone, sc, l);
+		scan = zone_lru_nr_pages(zone, sc, l);
 		if (priority || noswap) {
 			scan >>= priority;
 			scan = (scan * percent[file]) / 100;

--
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/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

author
#7 lore raw
Quoted 4 lines · Fernando Carrijo
Quoted 3 lines · Vincent Li

Name zone_nr_pages can be mis-read as zone's (total) number pages, but it actually returns zone's LRU list number pages.

Quoted 8 lines
Quoted 1 line

I know reading the code would clear the name confusion, want to know if patch making sense.

In case this patch gets an ack, wouldn't it make sense to try to keep some consistency by renaming the function mem_cgroup_zone_nr_pages to mem_cgroup_zone_lru_nr_pages, since it also deals with an specific LRU?

Fernando Carrijo

I thought about renaming mem_cgroup_zone_nr_pages too, but not sure if the patch make sense when I submit, so I kept the changes as small as possible.

--
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/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>