- 
                Notifications
    
You must be signed in to change notification settings  - Fork 16
 
Satisfy page cache #48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
      
          
      
      
            OrangeQi-CQ
  
      
      
      commented
        May 27, 2025 
      
    
  
- 给文件打开新增 direct 标志
 - 在 aspace 提供更多类型映射形式(map_file)
 - 给 MemoryArea 的 Backend 提供 File 类型
 
        
          
                modules/axmm/src/backend/mod.rs
              
                Outdated
          
        
      | /// Whether to populate the physical frames when creating the mapping. | ||
| populate: bool, | ||
| }, | ||
| /// File mapping backend. | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't suggest to add a File Backend here, because Linear(linear mapping) and Alloc(dynamic mapping) are self-consistent enough to complete memory allocation related tasks, we do not want the module axmm in charge of memory to introduce file-related content.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A possible solution is to check whether there is a file mapping interval covering the missing address in the handle_page_fault part of starry(see here) after completing the physical page allocation for the missing page. If so, check whether the content of the file needs to be written to the newly allocated physical page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A possible solution is to check whether there is a file mapping interval covering the missing address in the
handle_page_faultpart of starry(see here) after completing the physical page allocation for the missing page. If so, check whether the content of the file needs to be written to the newly allocated physical page.
If we don't create a mapping from MemoryArea to file in axmm, we need to maintain this mapping in starry. Will this cost be too much? My idea is to create a vm_area_struct like Linux and maintain the mapping to the file and offset in MemoryArea. When we get vma during handle_page_fault, we can directly get this mapping. But this will introduce the file of starry in axmm. Do you have any good suggestions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A possible solution is to check whether there is a file mapping interval covering the missing address in the
handle_page_faultpart of starry(see here) after completing the physical page allocation for the missing page. If so, check whether the content of the file needs to be written to the newly allocated physical page.If we don't create a mapping from MemoryArea to file in axmm, we need to maintain this mapping in starry. Will this cost be too much? My idea is to create a vm_area_struct like Linux and maintain the mapping to the file and offset in MemoryArea. When we get vma during handle_page_fault, we can directly get this mapping. But this will introduce the file of starry in axmm. Do you have any good suggestions?
One method we recommend is to maintain the mapping relationship between mmap area and file in ProcessData. For each process, it will consist of a batch of linear intervals, and there is no overlap between the intervals. Therefore, each time you query the file mapping relationship of the mmap area corresponding to a certain virtual address, you only need to traverse it linearly once. Its complexity is similar to find area
        
          
                modules/axmm/src/aspace.rs
              
                Outdated
          
        
      | /// | ||
| /// `access_flags` indicates the access type that caused the page fault. | ||
| /// | ||
| /// | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this line.
        
          
                modules/axmm/src/aspace.rs
              
                Outdated
          
        
      | Ok(()) | ||
| } | ||
| 
               | 
          ||
| pub fn map_shm( | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we don't need to add this function?