Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\power\snapshot.c Create Date:2022-07-28 10:01:07
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:_unnecessary_pages - Release preallocated pages not needed for the image.

Proto:static unsigned long free_unnecessary_pages(void)

Type:unsigned long

Parameter:Nothing

1603  save = _data_pages - Compute the total number of saveable non-highmem pages.
1604  If Numbers of normal and highmem page frames allocated for hibernation image* before suspending devices. >= save Then
1605  to_free_normal = Numbers of normal and highmem page frames allocated for hibernation image* before suspending devices. - save
1606  save = 0
1607  Else
1608  to_free_normal = 0
1609  save -= Numbers of normal and highmem page frames allocated for hibernation image* before suspending devices.
1611  save += count_highmem_pages()
1612  If Numbers of normal and highmem page frames allocated for hibernation image* before suspending devices. >= save Then
1613  to_free_highmem = Numbers of normal and highmem page frames allocated for hibernation image* before suspending devices. - save
1614  Else
1615  to_free_highmem = 0
1616  save -= Numbers of normal and highmem page frames allocated for hibernation image* before suspending devices.
1617  If to_free_normal > save Then to_free_normal -= save
1619  Else to_free_normal = 0
1622  free = to_free_normal + to_free_highmem
1624  memory_bm_position_reset( & Memory bitmap used during hibernation for marking allocated page frames that* will contain copies of saveable pages. During restore it is initially used* for marking hibernation image pages, but then the set bits from it are)
1626  When to_free_normal > 0 || to_free_highmem > 0 cycle
1627  pfn = memory_bm_rtree_next_pfn - Find the next set bit in a memory bitmap.*@bm: Memory bitmap.* Starting from the last returned position this function searches for the next* set bit in @bm and returns the PFN represented by it. If no more bits are
1628  page = pfn_to_page(pfn)
1630  If PageHighMem(page) Then
1631  If Not to_free_highmem Then Continue
1633  to_free_highmem--
1635  Else
1636  If Not to_free_normal Then Continue
1638  to_free_normal--
1641  memory_bm_clear_bit( & Memory bitmap used during hibernation for marking allocated page frames that* will contain copies of saveable pages. During restore it is initially used* for marking hibernation image pages, but then the set bits from it are, pfn)
1642  swsusp_unset_page_forbidden(page)
1643  swsusp_unset_page_free(page)
1644  __free_page(page)
1647  Return free
Caller
NameDescribe
hibernate_preallocate_memoryhibernate_preallocate_memory - Preallocate memory for hibernation image