函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\migrate.c Create Date:2022-07-27 17:33:09
Last Modify:2022-05-20 09:53:13 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:__unmap_and_move

函数原型:static int __unmap_and_move(struct page *page, struct page *newpage, int force, enum migrate_mode mode)

返回类型:int

参数:

类型参数名称
struct page *page
struct page *newpage
intforce
enum migrate_modemode
1007  rc等于负EAGAIN
1008  page_was_mapped等于0
1009  struct anon_vma * anon_vma = NULL
1010  is_lru等于非__PageMovable(page)
1012  如果非Return true if the page was successfully locked
1013  如果非forcemode恒等于MIGRATE_ASYNC则转到:out
1029  如果flags按位与Allocating memory 则转到:out
1032  lock_page may only be called if we have the page's inode pinned.
1035  如果Only test-and-set exist for PG_writeback. The unconditional operators are* risky: they bypass page accounting.
1043  :mode恒等于MIGRATE_SYNC
1044  :mode恒等于MIGRATE_SYNC_NO_COPY
1045  退出
1046  默认
1047  rc等于负EBUSY
1048  转到:out_unlock
1050  如果非force则转到:out_unlock
1052  Wait for a page to complete writeback
1069  如果PageAnon(page)且非A KSM page is one of those write-protected "shared pages" or "merged pages"* which KSM maps into multiple mms, wherever identical anonymous page content* is found in VM_MERGEABLE vmas. It's a PageAnon page, pointing not to anyanon_vma等于Getting a lock on a stable anon_vma from a page off the LRU is tricky!* Since there is no serialization what so ever against page_remove_rmap()* the best this function can do is return a locked anon_vma that might* have been relevant to this page
1080  如果此条件成立可能性小(为编译器优化)(!Return true if the page was successfully locked)则转到:out_unlock
1083  如果此条件成立可能性小(为编译器优化)(!is_lru)则
1084  rc等于Move a page to a newly allocated page* The page is locked and all ptes have been successfully removed.* The new page will have replaced the old page if this function* is successful.* Return value:* < 0 - error code* MIGRATEPAGE_SUCCESS - success
1085  转到:out_unlock_both
1100  如果非 See page-flags.h for PAGE_MAPPING_FLAGS
1101  VM_BUG_ON_PAGE(PageAnon(page), page)
1102  如果页面私有占用
1104  转到:out_unlock_both
1106  否则如果Return true if this page is mapped into pagetables.* For compound page it returns true if any subpage of compound page is mapped.
1108  VM_BUG_ON_PAGE(PageAnon(page) && !A KSM page is one of those write-protected "shared pages" or "merged pages"* which KSM maps into multiple mms, wherever identical anonymous page content* is found in VM_MERGEABLE vmas. It's a PageAnon page, pointing not to any && !anon_vma, page)
1110  ry_to_unmap - try to remove all page table mappings to a page*@page: the page to get unmapped*@flags: action and flags* Tries to remove all the page table entries which are mapping this* page, used in the pageout path. Caller must hold the page lock.
1112  page_was_mapped等于1
1115  如果非Return true if this page is mapped into pagetables.* For compound page it returns true if any subpage of compound page is mapped.rc等于Move a page to a newly allocated page* The page is locked and all ptes have been successfully removed.* The new page will have replaced the old page if this function* is successful.* Return value:* < 0 - error code* MIGRATEPAGE_SUCCESS - success
1118  如果page_was_mappedGet rid of all migration entries and replace them by* references to the indicated page.
1122  out_unlock_both :
1123  lock_page - unlock a locked page*@page: the page* Unlocks the page and wakes up sleepers in ___wait_on_page_locked().* Also wakes sleepers in wait_on_page_writeback() because the wakeup* mechanism between PageLocked pages and PageWriteback pages is shared.
1124  out_unlock :
1126  如果anon_vmaput_anon_vma(anon_vma)
1128  lock_page - unlock a locked page*@page: the page* Unlocks the page and wakes up sleepers in ___wait_on_page_locked().* Also wakes sleepers in wait_on_page_writeback() because the wakeup* mechanism between PageLocked pages and PageWriteback pages is shared.
1129  out :
1139  如果rc恒等于Return values from addresss_space_operations.migratepage():* - negative errno on page migration failure;* - zero on page migration success;
1140  如果此条件成立可能性小(为编译器优化)(!is_lru)则Perform a free_page(), also freeing any swap cache associated with* this page if it is the last user of the page.
1142  否则putback_lru_page - put previously isolated page onto appropriate LRU list*@page: page to be put back to appropriate lru list* Add previously isolated @page to appropriate LRU list.* Page may still be unevictable for other reasons.
1146  返回:rc
调用者
名称描述
unmap_and_moveObtain the lock on page, remove all ptes and migrate the page* to the newly allocated page in newpage.