Skip to contentSkip to conversation

mm: account reaped page cache on inode cache pruning

PATCH In review Konstantin Khlebnikov 2 participants 5 messages Nov 16, 2011 – Nov 18, 2011

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

PATCH 1/1 mm: account reaped page cache on inode cache pruning

Inode cache pruning indirectly reclaims page-cache by invalidating mapping pages. Let's account them into reclaim-state to notice this progress in memory reclaimer.

---
 fs/inode.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
fs/inode.c +2 -0
index ee4e66b..1f6c48d 100644
@@ -692,6 +692,8 @@ void prune_icache_sb(struct super_block *sb, int nr_to_scan)
 	else
 		__count_vm_events(PGINODESTEAL, reap);
 	spin_unlock(&sb->s_inode_lru_lock);
+	if (current->reclaim_state)
+		current->reclaim_state->reclaimed_slab += reap;
 
 	dispose_list(&freeable);
 }
maintainer
#1 lore raw
Quoted 13 lines · On Wed, 16 Nov 2011 17:47:13 +0300 Konstantin Khlebnikov…

Inode cache pruning indirectly reclaims page-cache by invalidating mapping pages. Let's account them into reclaim-state to notice this progress in memory reclaimer.

---
 fs/inode.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
fs/inode.c +0 -0
index ee4e66b..1f6c48d 100644

fs/inode.c void prune_icache_sb(struct super_block *sb, int nr_to_scan) · line 699

Quoted 8 lines
fs/inode.c +2 -0
@@ -692,6 +692,8 @@ void prune_icache_sb(struct super_block *sb, int nr_to_scan)
 	else
 		__count_vm_events(PGINODESTEAL, reap);
 	spin_unlock(&sb->s_inode_lru_lock);
+	if (current->reclaim_state)
+		current->reclaim_state->reclaimed_slab += reap;
 
 	dispose_list(&freeable);
 }

hm, yes, I suppose we should.

It seems to be cheating to use the "reclaimed_slab" field for this. Perhaps it would be cleaner to add an additional field to reclaim_state for non-slab pages which were also reclaimed. That's a cosmetic thing and I guess we don't need to go that far, not sure...

--
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>

#2 lore raw
Quoted 27 lines · Andrew Morton
Quoted 13 lines · On Wed, 16 Nov 2011 17:47:13 +0300 Konstantin…

Inode cache pruning indirectly reclaims page-cache by invalidating mapping pages. Let's account them into reclaim-state to notice this progress in memory reclaimer.

---
  fs/inode.c |    2 ++
  1 files changed, 2 insertions(+), 0 deletions(-)
fs/inode.c +0 -0
index ee4e66b..1f6c48d 100644

fs/inode.c void prune_icache_sb(struct super_block *sb, int nr_to_scan) · line 699

Quoted 8 lines
fs/inode.c +2 -0
@@ -692,6 +692,8 @@ void prune_icache_sb(struct super_block *sb, int nr_to_scan)
  	else
  		__count_vm_events(PGINODESTEAL, reap);
  	spin_unlock(&sb->s_inode_lru_lock);
+	if (current->reclaim_state)
+		current->reclaim_state->reclaimed_slab += reap;
 
  	dispose_list(&freeable);
  }

hm, yes, I suppose we should.

Quoted 4 lines

It seems to be cheating to use the "reclaimed_slab" field for this. Perhaps it would be cleaner to add an additional field to reclaim_state for non-slab pages which were also reclaimed. That's a cosmetic thing and I guess we don't need to go that far, not sure...

Do we really need separate on-stack reclaim_state structure with single field? Maybe replace it with single long (or even unsigned int) .reclaimed_pages field on task_struct and account reclaimed pages unconditionally.

Quoted 2 lines

--
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>

maintainer
#3 lore raw
Quoted 3 lines · On Fri, 18 Nov 2011 10:42:50 +0400 Konstantin Khlebnikov…

Do we really need separate on-stack reclaim_state structure with single field? Maybe replace it with single long (or even unsigned int) .reclaimed_pages field on task_struct and account reclaimed pages unconditionally.

I don't think it matters a lot - it's either a temporary pointer on the stack or a permanent space consumption in the task_struct.

The way thing are at present we can easily add new fields if needed. I don't think we've ever done that though.

#4 lore raw
Quoted 8 lines · Andrew Morton
Quoted 3 lines · On Fri, 18 Nov 2011 10:42:50 +0400 Konstantin…

Do we really need separate on-stack reclaim_state structure with single field? Maybe replace it with single long (or even unsigned int) .reclaimed_pages field on task_struct and account reclaimed pages unconditionally.

I don't think it matters a lot - it's either a temporary pointer on the stack or a permanent space consumption in the task_struct.

Yes, but currently task_struct has permanent pointer to reclaim_state =)

Quoted 3 lines

The way thing are at present we can easily add new fields if needed. I don't think we've ever done that though.