Skip to contentSkip to conversation

vmscan,tmpfs: treat used once pages on tmpfs as used once

PATCH In review KOSAKI Motohiro 4 participants 5 messages Sep 1, 2010 – Sep 2, 2010

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

PATCH 1/1 vmscan,tmpfs: treat used once pages on tmpfs as used once

When a page has PG_referenced, shrink_page_list() discard it only if it is no dirty. This rule works completely fine if the backend filesystem is regular one. PG_dirty is good signal that it was used recently because flusher thread clean pages periodically. In addition, page writeback is costly rather than simple page discard.

However, When a page is on tmpfs, this heuristic don't works because flusher thread don't writeback tmpfs pages. then, tmpfs pages always rotate lru twice at least and it makes unnecessary lru churn. Merely tmpfs streaming io shouldn't cause large anonymous page swap-out.

This patch remove this unncessary reclaim bonus of tmpfs pages.

Cc Hugh Dickins <[email protected]>
Cc Johannes Weiner <[email protected]>
Cc Rik van Riel <[email protected]>
---
 mm/vmscan.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
mm/vmscan.c +1 -1
index 1919d8a..aba3402 100644
@@ -617,7 +617,7 @@ static enum page_references page_check_references(struct page *page,
 	}
 
 	/* Reclaim if clean, defer dirty pages to writeback */
-	if (referenced_page)
+	if (referenced_page && !PageSwapBacked(page))
 		return PAGEREF_RECLAIM_CLEAN;
 
 	return PAGEREF_RECLAIM;
Signature · 9 lines
1.6.5.2



--
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 Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · KOSAKI Motohiro

When a page has PG_referenced, shrink_page_list() discard it only if it is no dirty. This rule works completely fine if the backend filesystem is regular one. PG_dirty is good signal that it was used recently because flusher thread clean pages periodically. In addition, page writeback is costly rather than simple page discard.

However, When a page is on tmpfs, this heuristic don't works because flusher thread don't writeback tmpfs pages. then, tmpfs pages always rotate lru twice at least and it makes unnecessary lru churn. Merely tmpfs streaming io shouldn't cause large anonymous page swap-out.

Quoted 6 lines

This patch remove this unncessary reclaim bonus of tmpfs pages.

Cc Hugh Dickins <[email protected]>
Cc Johannes Weiner <[email protected]>
Cc Rik van Riel <[email protected]>
Quoted 23 lines
---
 mm/vmscan.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
mm/vmscan.c +1 -1
index 1919d8a..aba3402 100644
@@ -617,7 +617,7 @@ static enum page_references page_check_references(struct page *page,
 	}
 
 	/* Reclaim if clean, defer dirty pages to writeback */
-	if (referenced_page)
+	if (referenced_page && !PageSwapBacked(page))
 		return PAGEREF_RECLAIM_CLEAN;
 
 	return PAGEREF_RECLAIM;
Signature · 1 line
1.6.5.2
Reviewed-by on v1 1/1
#2 lore raw
In reply to KOSAKI Motohiro
Quoted 11 lines · KOSAKI Motohiro

When a page has PG_referenced, shrink_page_list() discard it only if it is no dirty. This rule works completely fine if the backend filesystem is regular one. PG_dirty is good signal that it was used recently because flusher thread clean pages periodically. In addition, page writeback is costly rather than simple page discard.

However, When a page is on tmpfs, this heuristic don't works because flusher thread don't writeback tmpfs pages. then, tmpfs pages always rotate lru twice at least and it makes unnecessary lru churn. Merely tmpfs streaming io shouldn't cause large anonymous page swap-out.

Quoted 6 lines

This patch remove this unncessary reclaim bonus of tmpfs pages.

Cc Hugh Dickins<[email protected]>
Cc Johannes Weiner<[email protected]>
Cc Rik van Riel<[email protected]>
Signature · 7 lines
All rights reversed

--
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>
#3 lore raw
In reply to KOSAKI Motohiro

Hi KOSAKI,

Quoted 10 lines · KOSAKI Motohiro

When a page has PG_referenced, shrink_page_list() discard it only if it is no dirty. This rule works completely fine if the backend filesystem is regular one. PG_dirty is good signal that it was used recently because flusher thread clean pages periodically. In addition, page writeback is costly rather than simple page discard.

However, When a page is on tmpfs, this heuristic don't works because flusher thread don't writeback tmpfs pages. then, tmpfs pages always rotate lru twice at least and it makes unnecessary lru churn. Merely tmpfs streaming io shouldn't cause large anonymous page swap-out.

It seem to make sense.
But the why admin use tmps is to keep the contents in memory as far as possible than other's file system.
But this patch has a possibility for tmpfs pages to reclaim early than old behavior.

I admit this routine's goal is not to protect tmpfs page from too early reclaim. But at least, it would have affected until now.
If it is, we might need other demotion prevent mechanism to protect tmpfs pages. Is split LRU enough? (I mean we consider tmpfs pages as anonymous which is hard to reclaim than file backed pages).

I don't mean to oppose this patch and I don't have a any number to insist on my opinion.
Just what I want is that let's think about it more carefully and listen other's opinions. :)

Thanks for good suggestion.

Signature · 8 lines
Kind regards,
Minchan Kim

--
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
Quoted 21 lines

Hi KOSAKI,

Quoted 10 lines · KOSAKI Motohiro

When a page has PG_referenced, shrink_page_list() discard it only if it is no dirty. This rule works completely fine if the backend filesystem is regular one. PG_dirty is good signal that it was used recently because flusher thread clean pages periodically. In addition, page writeback is costly rather than simple page discard.

However, When a page is on tmpfs, this heuristic don't works because flusher thread don't writeback tmpfs pages. then, tmpfs pages always rotate lru twice at least and it makes unnecessary lru churn. Merely tmpfs streaming io shouldn't cause large anonymous page swap-out.

It seem to make sense.
But the why admin use tmps is to keep the contents in memory as far as possible than other's file system.
But this patch has a possibility for tmpfs pages to reclaim early than old behavior.

Quoted 5 lines

I admit this routine's goal is not to protect tmpfs page from too early reclaim. But at least, it would have affected until now.
If it is, we might need other demotion prevent mechanism to protect tmpfs pages. Is split LRU enough? (I mean we consider tmpfs pages as anonymous which is hard to reclaim than file backed pages).

I think so. Split-LRU provide priotize anon rather than regular file. and old behavior is obvious strange. streaming io tolerance is one of fundamental VM requirement. So, I think current one is only historical reason.

Quoted 11 lines

I don't mean to oppose this patch and I don't have a any number to insist on my opinion.
Just what I want is that let's think about it more carefully and listen other's opinions. :)

Thanks for good suggestion.

Signature · 2 lines
Kind regards,
Minchan Kim

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