Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\migrate.c Create Date:2022-07-28 15:59:13
Last Modify:2022-05-20 09:53:13 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:Counterpart of unmap_and_move_page() for hugepage migration

Proto:static int unmap_and_move_huge_page(new_page_t get_new_page, free_page_t put_new_page, unsigned long private, struct page *hpage, int force, enum migrate_mode mode, int reason)

Type:int

Parameter:

TypeParameterName
new_page_tget_new_page
free_page_tput_new_page
unsigned longprivate
struct page *hpage
intforce
enum migrate_modemode
intreason
1281  rc = -EAGAIN
1282  page_was_mapped = 0
1284  struct anon_vma * anon_vma = NULL
1293  If Not hugepage_migration_supported(page_hstate(hpage)) Then
1294  putback_active_hugepage(hpage)
1295  Return -ENOSYS
1298  new_hpage = get_new_page(hpage, private)
1299  If Not new_hpage Then Return -ENOMEM
1302  If Not Return true if the page was successfully locked Then
1303  If Not force Then Go to out
1306  Case mode == MIGRATE_SYNC
1307  Case mode == MIGRATE_SYNC_NO_COPY
1308  Break
1309  Default
1310  Go to out
1312  lock_page may only be called if we have the page's inode pinned.
1320  If page_private(hpage) && Not page_mapping(hpage) Then
1321  rc = -EBUSY
1322  Go to out_unlock
1325  If PageAnon(hpage) Then anon_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
1328  If Value for the false possibility is greater at compile time(!Return true if the page was successfully locked) Then Go to put_anon
1331  If Return true if this page is mapped into pagetables.* For compound page it returns true if any subpage of compound page is mapped. Then
1332  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.
1334  page_was_mapped = 1
1337  If Not Return true if this page is mapped into pagetables.* For compound page it returns true if any subpage of compound page is mapped. Then 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
1340  If page_was_mapped Then Get rid of all migration entries and replace them by* references to the indicated page.
1344  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.
1346  put_anon :
1347  If anon_vma Then put_anon_vma(anon_vma)
1350  If rc == Return values from addresss_space_operations.migratepage():* - negative errno on page migration failure;* - zero on page migration success; Then
1351  move_hugetlb_state(hpage, new_hpage, reason)
1352  put_new_page = NULL
1355  out_unlock :
1356  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.
1357  out :
1358  If rc != -EAGAIN Then putback_active_hugepage(hpage)
1366  If put_new_page Then put_new_page(new_hpage, private)
1368  Else putback_active_hugepage(new_hpage)
1371  Return rc
Caller
NameDescribe
migrate_pagesmigrate_pages - migrate the pages specified in a list, to the free pages* supplied as the target for the page migration*@from: The list of pages to be migrated.*@get_new_page: The function used to allocate free pages to be used