Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:place_page_cache_page - replace a pagecache page with a new one*@old: page to be replaced*@new: page to replace with*@gfp_mask: allocation mode* This function replaces a page in the pagecache with a new one

Proto:int replace_page_cache_page(struct page *old, struct page *new, gfp_t gfp_mask)

Type:int

Parameter:

TypeParameterName
struct page *old
struct page *new
gfp_tgfp_mask
813  mapping = See page-flags.h for PAGE_MAPPING_FLAGS
814  ( = freepage
815  offset = Our offset within mapping.
816  XA_STATE() - Declare an XArray operation state.*@name: Name of this operation state (usually xas).*@array: Array to operate on.*@index: Initial index of interest.* Declare and initialise an xa_state on the stack.(xas, & i_pages, offset)
819  VM_BUG_ON_PAGE(!PageLocked(old), old)
820  VM_BUG_ON_PAGE(!PageLocked(new), new)
821  VM_BUG_ON_PAGE( See page-flags.h for PAGE_MAPPING_FLAGS , new)
823  get_page(new)
824  See page-flags.h for PAGE_MAPPING_FLAGS = mapping
825  Our offset within mapping. = offset
827  xas_lock_irqsave( & xas, flags)
828  xas_store() - Store this entry in the XArray
830  See page-flags.h for PAGE_MAPPING_FLAGS = NULL
832  If Not PageHuge(old) Then __dec_node_page_state(new, NR_FILE_PAGES)
834  If Not PageHuge(new) Then __inc_node_page_state(new, NR_FILE_PAGES)
836  If PageSwapBacked(old) Then __dec_node_page_state(new, NR_SHMEM)
838  If PageSwapBacked(new) Then __inc_node_page_state(new, NR_SHMEM)
840  xas_unlock_irqrestore( & xas, flags)
841  mem_cgroup_migrate(old, new)
842  If freepage Then freepage(old)
844  put_page(old)
846  Return 0