소스 검색

[dfs] Mark dirty on unmap on shared mapping only (#9195)

[dfs] feat: Mark dirty on unmap for shared mapping

This patch optimizes the pcache varea management by refining the
conditions under which pages are marked dirty, specifically targeting
the unmap operations in the dfs_pcache component. These changes were
necessary to enhance the efficiency of page cache management.

Changes:
- Adjusted include statements in `dfs_pcache.c` for better organization.
- Modified `dfs_aspace_unmap` function:
  - Added a check to ensure `varea` is not privately locked before marking a page as dirty.
- Updated `dfs_aspace_page_unmap` function:
  - Added a similar check for `varea` lock status before marking a page as dirty.

Signed-off-by: Shell <smokewood@qq.com>
Shell 1 년 전
부모
커밋
1b581d0755
1개의 변경된 파일8개의 추가작업 그리고 6개의 파일을 삭제
  1. 8 6
      components/dfs/dfs_v2/src/dfs_pcache.c

+ 8 - 6
components/dfs/dfs_v2/src/dfs_pcache.c

@@ -13,10 +13,11 @@
 #define DBG_LVL DBG_WARNING
 #define DBG_LVL DBG_WARNING
 #include <rtdbg.h>
 #include <rtdbg.h>
 
 
-#include "dfs_pcache.h"
-#include "dfs_dentry.h"
-#include "dfs_mnt.h"
-#include "mm_page.h"
+#include <dfs_pcache.h>
+#include <dfs_dentry.h>
+#include <dfs_mnt.h>
+#include <mm_page.h>
+#include <mm_private.h>
 #include <mmu.h>
 #include <mmu.h>
 #include <tlb.h>
 #include <tlb.h>
 
 
@@ -1380,7 +1381,8 @@ int dfs_aspace_unmap(struct dfs_file *file, struct rt_varea *varea)
 
 
                                 rt_varea_unmap_page(map_varea, vaddr);
                                 rt_varea_unmap_page(map_varea, vaddr);
 
 
-                                if (varea->attr == MMU_MAP_U_RWCB && page->fpos < page->aspace->vnode->size)
+                                if (!rt_varea_is_private_locked(varea) &&
+                                    page->fpos < page->aspace->vnode->size)
                                 {
                                 {
                                     dfs_page_dirty(page);
                                     dfs_page_dirty(page);
                                 }
                                 }
@@ -1425,7 +1427,7 @@ int dfs_aspace_page_unmap(struct dfs_file *file, struct rt_varea *varea, void *v
 
 
                 if (map && varea->aspace == map->aspace && vaddr == map->vaddr)
                 if (map && varea->aspace == map->aspace && vaddr == map->vaddr)
                 {
                 {
-                    if (varea->attr == MMU_MAP_U_RWCB)
+                    if (!rt_varea_is_private_locked(varea))
                     {
                     {
                         dfs_page_dirty(page);
                         dfs_page_dirty(page);
                     }
                     }