函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\vmscan.c Create Date:2022-07-27 15:41:31
Last Modify:2022-05-23 13:41:30 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:Same as remove_mapping, but if the page is removed from the mapping, it* gets returned with a refcount of 0.

函数原型:static int __remove_mapping(struct address_space *mapping, struct page *page, bool reclaimed, struct mem_cgroup *target_memcg)

返回类型:int

参数:

类型参数名称
struct address_space *mapping
struct page *page
boolreclaimed
struct mem_cgroup *target_memcg
871  BUG_ON(!PageLocked(page))
872  BUG_ON(mapping != page_mapping(page))
874  xa_lock_irqsave( & i_pages, flags)
900  refcount等于1加Returns the number of pages in this potentially compound page.
901  如果非page_ref_freeze(page, refcount)则转到:cannot_free
904  如果此条件成立可能性小(为编译器优化)(PageDirty(page))则
905  page_ref_unfreeze(page, refcount)
906  转到:cannot_free
909  如果PageSwapCache(page)则
910  swp_entry_t swap = {val = page_private(page)}
911  mem_cgroup_swapout(page, swap)
912  __delete_from_swap_cache(page, swap)
913  xa_unlock_irqrestore( & i_pages, flags)
914  put_swap_page(page, swap)
915  否则
917  void * shadow = NULL
919  freepage等于freepage
936  如果reclaimedpage_is_file_cache - should the page be on a file LRU or anon LRU?*@page: the page to test* Returns 1 if @page is page cache page backed by a regular filesystem,* or 0 if @page is anonymous, tmpfs or otherwise ram or swap backed且非mapping_exiting(mapping)且非dax_mapping(mapping)则shadow等于linux/mm/workingset.c
939  Delete a page from the page cache and free it. Caller has to make* sure the page is locked and that nobody else uses it - or that usage* is safe. The caller must hold the i_pages lock.
940  xa_unlock_irqrestore( & i_pages, flags)
942  如果(freepage != NULL)则freepage(page)
946  返回:1
948  cannot_free :
949  xa_unlock_irqrestore( & i_pages, flags)
950  返回:0
调用者
名称描述
remove_mappingAttempt to detach a locked page from its ->mapping. If it is dirty or if* someone else has a ref on the page, abort and return 0. If it was* successfully detached, return 1. Assumes the caller has a single ref on* this page.
shrink_page_listshrink_page_list() returns the number of reclaimed pages