Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\memory-failure.c Create Date:2022-07-28 16:19:08
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:Do all that is necessary to remove user space mappings. Unmap* the pages and send SIGBUS to the processes if the data was dirty.

Proto:static bool hwpoison_user_mappings(struct page *p, unsigned long pfn, int flags, struct page **hpagep)

Type:bool

Parameter:

TypeParameterName
struct page *p
unsigned longpfn
intflags
struct page **hpagep
954  ttu = ignore mlock | don't age
956  LIST_HEAD(tokill)
958  kill = 1
959  hpage = hpagep
960  mlocked = PageMlocked(hpage)
966  If PageReserved(p) || PageSlab(p) Then Return true
968  If Not (PageLRU(hpage) || PageHuge() only returns true for hugetlbfs pages, but not for normal or* transparent huge pages. See the PageTransHuge() documentation for more* details.) Then Return true
975  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 Return true
978  If 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 Then
979  pr_err("Memory failure: %#lx: can't handle KSM pages.\n", pfn)
980  Return false
983  If PageSwapCache(p) Then
984  pr_err("Memory failure: %#lx: keeping poisoned page in swap cache\n", pfn)
986  ttu |= corrupted page is recoverable
995  mapping = page_mapping(hpage)
996  If Not (flags & MF_MUST_KILL) && Not PageDirty(hpage) && mapping && mapping_cap_writeback_dirty(mapping) Then
998  If page_mkclean(hpage) Then
1000  Else
1001  kill = 0
1003  pr_info("Memory failure: %#lx: corrupted page was clean: dropped without side effects\n", pfn)
1016  If kill Then Collect the processes who have the corrupted page mapped to kill.
1019  unmap_success = 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.
1020  If Not unmap_success Then pr_err("Memory failure: %#lx: failed to unmap page (mapcount=%d)\n", pfn, page_mapcount(hpage))
1028  If mlocked Then When a unknown page type is encountered drain as many buffers as possible* in the hope to turn the page into a LRU or free page, which we can handle.
1041  forcekill = PageDirty(hpage) || flags & MF_MUST_KILL
1042  Kill the processes that have been collected earlier.* Only do anything when DOIT is set, otherwise just free the list* (this is used for clean pages which do not need killing)* Also when FAIL is set do a force kill because something went* wrong earlier.
1044  Return unmap_success
Caller
NameDescribe
memory_failure_hugetlb
memory_failurememory_failure - Handle memory failure of a page.*@pfn: Page Number of the corrupted page*@flags: fine tune action taken* This function is called by the low level machine check code* of an architecture when it detects hardware memory corruption* of a page