linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 1/1] mm: mark folio accessed in minor fault
@ 2023-12-20 10:29 zhaoyang.huang
  2023-12-20 14:14 ` Matthew Wilcox
  0 siblings, 1 reply; 15+ messages in thread
From: zhaoyang.huang @ 2023-12-20 10:29 UTC (permalink / raw)
  To: Andrew Morton, Matthew Wilcox, linux-mm, linux-kernel,
	Zhaoyang Huang, steve.kang

From: Zhaoyang Huang <zhaoyang.huang@unisoc.com>

Inactive mapped folio will be promoted to active only when it is
scanned in shrink_inactive_list, while the vfs folio will do this
immidiatly when it is accessed. These will introduce two affections:

1. NR_ACTIVE_FILE is not accurate as expected.
2. Low reclaiming efficiency caused by dummy nactive folio which should
   be kept as earlier as shrink_active_list.

I would like to suggest mark the folio be accessed in minor fault to
solve this situation.

Signed-off-by: Zhaoyang Huang <zhaoyang.huang@unisoc.com>
---
 mm/filemap.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/mm/filemap.c b/mm/filemap.c
index f0a15ce1bd1b..b1ee6ce716c2 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -3273,6 +3273,11 @@ vm_fault_t filemap_fault(struct vm_fault *vmf)
 	 */
 	folio = filemap_get_folio(mapping, index);
 	if (likely(!IS_ERR(folio))) {
+		/*
+		 * try to promote inactive folio here when it is accessed
+		 * as minor fault
+		 */
+		folio_mark_accessed(folio);
 		/*
 		 * We found the page, so try async readahead before waiting for
 		 * the lock.
-- 
2.25.1



^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2024-01-02  5:37 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-20 10:29 [RFC PATCH 1/1] mm: mark folio accessed in minor fault zhaoyang.huang
2023-12-20 14:14 ` Matthew Wilcox
2023-12-21  1:58   ` Zhaoyang Huang
2023-12-21  4:09     ` Matthew Wilcox
2023-12-21  4:53       ` Yu Zhao
2023-12-21  6:28         ` Zhaoyang Huang
2023-12-21  6:32           ` Yu Zhao
2023-12-22  5:53             ` Zhaoyang Huang
2023-12-22  6:14               ` Yu Zhao
2023-12-22  6:28                 ` reply: " 黄朝阳 (Zhaoyang Huang)
2023-12-22  6:45                   ` Yu Zhao
2023-12-22  8:41                     ` Zhaoyang Huang
2023-12-22  9:41                       ` reply: " 黄朝阳 (Zhaoyang Huang)
2023-12-23  2:41                         ` Yu Zhao
2024-01-02  5:36                           ` Zhaoyang Huang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox