struct address_space *mapping 就是用于内存映射,如果是匿名页,最低位为 1;如果是映射文件,最低位为 0; pgoff_t index 是在映射区的偏移量; atomic_t _mapcount,每个进程都有自己的页表,这里指有多少个页表项指向了这个页; struct list_head lru 表示这一页应该在一个链表上,例如这个页面被换出,就在换...
(2)pgd_t、pmd_t、pud_t和pte_t 参照/arch/x86/include/asm/pgtable_types.h typedef struct { pgdval_t pgd; } pgd_t; static inline pgd_t native_make_pgd(pgdval_t val) { return (pgd_t) { val }; } static inline pgdval_t native_pgd_val(pgd_t pgd) { return pgd.pgd; } stat...
static ssize_t generic_file_buffered_read(struct kiocb *iocb, struct iov_iter *iter, ssize_t written) { struct file *filp = iocb->ki_filp; struct address_space *mapping = filp->f_mapping; struct inode *inode = mapping->host; for (;;) { struct page *page; pgoff_t end_index; lof...
pgoff_t pgoff=page_to_pgoff(page);returnvma->vm_start + ((pgoff - vma->vm_pgoff) <<PAGE_SHIFT);---根据page->index计算当前vma的偏移地址。}staticinline pgoff_t page_to_pgoff(structpage *page) {if(unlikely(PageHeadHuge(page)))returnpage->index <<compound_order(page);elsereturnpage->...
pgoff_t end = -1; /* Inclusive */ int scanned = 0; int is_range = 0; //块设备I/O是壅塞的 if (wbc->nonblocking && bdi_write_congested(bdi)) { wbc->encountered_congestion = 1; return 0; } writepage = NULL; if (get_block == NULL) ...
voidpage_add_anon_rmap(struct page*page,struct vm_area_struct*vma,unsigned long address){struct anon_vma*anon_vma=vma->anon_vma;//这个anon_vma是一定要有的,如果在fork的时候有两个vma公用了一个page,那么page显然影响了两个pte,这两个pte可以通过这两个vma得到pgoff_t index;anon_vma=(void*)anon...
spinlock_t ptl; #endif struct kmem_cache *slab; /* SLUB: Pointer to slab */ struct page *first_page; /* Compound tail pages */ }; union { pgoff_t index; /* Our offset within mapping. */ void *freelist; /* SLUB: freelist req. slab lock */ ...
pgoff_t end_index; [点击并拖拽以移动] 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39.
*/structlist_headlru;/* See page-flags.h for PAGE_MAPPING_FLAGS */structaddress_space*mapping;pgoff_t index;/* Our offset within mapping. *//** * @private: Mapping-private opaque data. * Usually used for buffer_heads if PagePrivate. ...
以及要映射的文件区域在文件中的 offset,与 VMA 结构中的 vm_file,vm_pgoff 关联映射起来,它们由 ...