It is not clear from the code and the documentation which synchronization discipline prevents concurrent accesses to PTE.
For example, OsUnmapL2PTE clears a page table. However, it seems the page table is not protected from parallel accesses. Let us consider the following cases:
Concurrent Access 1
LOS_MemAlloc->OsMemAllocWithCheck->OsMemPoolExpand->OsTryShrinkMemory->OsShrinkInactiveList->OsDeletePageCacheLru->OsPageCacheDel->OsUnmapAllLocked->OsUnmapPageLocked->LOS_ArchMmuUnmap->OsUnmapL2PTE to info->archMmu
.
Concurrent Access 2
ShmatVmmAlloc->LOS_MMap->OsUserHeapFree->LOS_ArchMmuUnmap->OsUnmapL2PTE to vmSpace->archMmu
.
May these accesses to page table happen concurrently?
May these PTE be the same?
fix: MMU竞态问题修复
背景:同一个进程的多个线程读写同一个PTE时,由于PTE无保护,存在竞态问题。
方案:新增spinlock保护PTE,包括大锁跟小锁。大锁:一个进程只有一个spinlock锁,多个线程
读写PTE时竞争一把锁,锁的内存占用小,但系统性能降低;小锁:每个页表持有一把spinlock,
由于锁是page结构体的一个字段,内存消耗较大,但是相对大锁性能较优。系统默认使用大锁,用
户可根据具体需要配置使用大锁还是小锁。
close #I2WARC:Synchronization Discipline for PTE Accesses
Signed-off-by: Haryslee lihao189@huawei.com
Change-Id: I5612eeac1f65507160035eae16af61f285182eda
-----来自 commit 748e0d8
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
登录 后才可以发表评论