[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>
This commit is contained in:
Shell 2024-07-16 17:03:54 +08:00 committed by GitHub
parent d8d0af9143
commit 1b581d0755
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 6 deletions

View File

@ -13,10 +13,11 @@
#define DBG_LVL DBG_WARNING
#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 <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);
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);
}
@ -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 (varea->attr == MMU_MAP_U_RWCB)
if (!rt_varea_is_private_locked(varea))
{
dfs_page_dirty(page);
}