函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\power\snapshot.c Create Date:2022-07-27 11:01:37
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:prepare_image - Make room for loading hibernation image

函数原型:static int prepare_image(struct memory_bitmap *new_bm, struct memory_bitmap *bm)

返回类型:int

参数:

类型参数名称
struct memory_bitmap *new_bm
struct memory_bitmap *bm
2469  _image_page - Free a page allocated for hibernation image.*@addr: Address of the page to free.*@clear_nosave_free: If set, clear the PageNosaveFree bit for the page.* The page to free should have been allocated by get_image_page() (page flags
2470  Pointer to an auxiliary buffer (1 page) = NULL
2472  nr_highmem等于count_highmem_image_pages(bm)
2473  mark_unsafe_pages - Mark pages that were used before hibernation.* Mark the pages that cannot be used for storing the image during restoration,* because they conflict with the pages that had been used before hibernation.
2475  error等于memory_bm_create - Allocate memory for a memory bitmap.
2476  如果error则转到:Free
2479  duplicate_memory_bitmap(new_bm, bm)
2480  memory_bm_free(bm, PG_UNSAFE_KEEP)
2481  如果nr_highmem大于0则
2482  error等于prepare_highmem_image(bm, & nr_highmem)
2483  如果error则转到:Free
2495  nr_pages等于Total number of image pages nr_highmemallocated_unsafe_pages
2496  nr_pages等于DIV_ROUND_UP(nr_pages, PBES_PER_LINKED_PAGE)
2497 nr_pages大于0循环
2498  lp等于get_image_page - Allocate a page for a hibernation image
2499  如果非lp
2500  error等于负ENOMEM
2501  转到:Free
2503  next等于List of "safe" pages (ie. pages that were not used by the image kernel* before hibernation) that may be used as temporary storage for image kernel* memory contents.
2504  List of "safe" pages (ie. pages that were not used by the image kernel* before hibernation) that may be used as temporary storage for image kernel* memory contents.等于lp
2505  nr_pages自减
2508  nr_pages等于Total number of image pages nr_highmemallocated_unsafe_pages
2509 nr_pages大于0循环
2510  lp等于get_zeroed_page(DOC: Useful GFP flag combinations* Useful GFP flag combinations* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~* Useful GFP flag combinations that are commonly used. It is recommended* that subsystems start with one of these combinations and then set/clear)
2511  如果非lp
2512  error等于负ENOMEM
2513  转到:Free
2521  swsusp_set_page_forbidden(virt_to_page(kaddr) returns a valid pointer if and only if* virt_addr_valid(kaddr) returns true.(lp))
2522  Each page frame allocated for creating the image is marked by setting the* corresponding bits in forbidden_pages_map and free_pages_map simultaneously
2523  nr_pages自减
2525  返回:0
2527  Free :
2528  swsusp_free - Free pages allocated for hibernation image.* Image pages are alocated before snapshot creation, so they need to be* released after resume.
2529  返回:error
调用者
名称描述
snapshot_write_nextsnapshot_write_next - Get the address to store the next image page.*@handle: Snapshot handle structure to guide the writing.* On the first call, @handle should point to a zeroed snapshot_handle* structure