函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\swap_state.c Create Date:2022-07-27 16:45:04
Last Modify:2020-03-17 22:02:06 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:__read_swap_cache_async

函数原型:struct page *__read_swap_cache_async(swp_entry_t entry, gfp_t gfp_mask, struct vm_area_struct *vma, unsigned long addr, bool *new_page_allocated)

返回类型:struct page

参数:

类型参数名称
swp_entry_tentry
gfp_tgfp_mask
struct vm_area_struct *vma
unsigned longaddr
bool *new_page_allocated
363  struct page * found_page = NULL, * new_page = NULL
366  * new_page_allocated = false
368  循环
374  si等于Check whether swap entry is valid in the swap device
375  如果非si退出
377  found_page等于d_get_page - find and get a page reference*@mapping: the address_space to search*@offset: the page index* Looks up the page cache slot at @mapping & @offset. If there is a* page cache page, it is returned with an increased refcount.
379  put_swap_device(si)
380  如果found_page退出
391  如果非__swp_swapcount(entry)且swap_slot_cache_enabled退出
397  如果非new_page
399  如果非new_page退出
406  err等于swapcache_prepare(entry)
407  如果err恒等于负EEXIST
413  cond_resched()
414  继续下一循环
415  否则如果err退出
419  __SetPageLocked(new_page)
420  __SetPageSwapBacked(new_page)
421  err等于add_to_swap_cache resembles add_to_page_cache_locked on swapper_space,* but sets SwapCache flag and private instead of mapping and index.
426  * new_page_allocated = true
427  返回:new_page
429  __ClearPageLocked(new_page)
434  put_swap_page(new_page, entry)
435 err不等于负ENOMEM循环
437  如果new_pagePerform a free_page(), also freeing any swap cache associated with* this page if it is the last user of the page.
439  返回:found_page
调用者
名称描述
read_swap_cache_asyncLocate a page of swap in physical memory, reserving swap cache space* and reading the disk if it is not already cached.* A failure return means that either the page allocation failed or that* the swap entry is no longer in use.
swap_cluster_readaheadswap_cluster_readahead - swap in pages in hope we need them soon*@entry: swap entry of this memory*@gfp_mask: memory allocation flags*@vmf: fault information* Returns the struct page for entry and addr, after queueing swapin.
swap_vma_readaheadswap_vma_readahead - swap in pages in hope we need them soon*@entry: swap entry of this memory*@gfp_mask: memory allocation flags*@vmf: fault information* Returns the struct page for entry and addr, after queueing swapin.* Primitive swap readahead code
zswap_get_swap_cache_pagezswap_get_swap_cache_page* This is an adaption of read_swap_cache_async()* This function tries to find a page with the given swap entry* in the swapper_space address space (the swap cache). If the page* is found, it is returned in retpage