函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:This function splits huge page into normal pages. @page can point to any* subpage of huge page to split. Split doesn't change the position of @page.* Only caller must hold pin on the @page, otherwise split fails with -EBUSY.* The huge page must be locked.

函数原型:int split_huge_page_to_list(struct page *page, struct list_head *list)

返回类型:int

参数:

类型参数名称
struct page *page
struct list_head *list
2697  head等于compound_head(page)
2698  pgdata等于NUMA节点数据区(page_to_nid(head))
2699  ds_queue等于get_deferred_split_queue(page)
2700  struct anon_vma * anon_vma = NULL
2701  struct address_space * mapping = NULL
2707  VM_BUG_ON_PAGE(is_huge_zero_page(head), head)
2708  VM_BUG_ON_PAGE(!PageLocked(page), page)
2709  VM_BUG_ON_PAGE(!PageCompound(page), page)
2711  如果Only test-and-set exist for PG_writeback. The unconditional operators are* risky: they bypass page accounting.则返回:负EBUSY
2714  如果PageAnon(head)则
2723  anon_vma等于Getting a lock on a stable anon_vma from a page off the LRU is tricky!* Since there is no serialization what so ever against page_remove_rmap()* the best this function can do is return a locked anon_vma that might* have been relevant to this page
2724  如果非anon_vma
2725  ret等于负EBUSY
2726  转到:out
2728  end等于负1
2729  mapping = NULL
2730  anon_vma_lock_write(anon_vma)
2731  否则
2732  mapping等于 See page-flags.h for PAGE_MAPPING_FLAGS
2735  如果非mapping
2736  ret等于负EBUSY
2737  转到:out
2740  anon_vma = NULL
2741  i_mmap_lock_read(mapping)
2750  end等于DIV_ROUND_UP(NOTE: in a 32bit arch with a preemptable kernel and* an UP compile the i_size_read/write must be atomic* with respect to the local cpu (unlike with preempt disabled),* but they don't need to be atomic with respect to other cpus like in* true SMP (so they , PAGE_SIZE)
2757  如果非Racy check whether the huge page can be split
2758  ret等于负EBUSY
2759  转到:out_unlock
2762  mlocked等于PageMlocked(page)
2763  unmap_page(head)
2764  VM_BUG_ON_PAGE(compound_mapcount(head), head)
2767  如果mlockedlru_add_drain()
2771  spin_lock_irqsave( & Write-intensive fields used by page reclaim , flags)
2773  如果mapping
2774  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, Return the pagecache index of the passed page. Regular pagecache pages* use ->index whereas swapcache pages use swp_offset(->private))
2780  xa_lock( & i_pages)
2781  如果xas_load() - Load an entry from the XArray (advanced).*@xas: XArray operation state.* Usually walks the @xas to the appropriate state to load the entry* stored at xa_index. However, it will do nothing and return %NULL if*@xas is in an error state不等于head则转到:fail
2786  加自旋锁
2787  count等于page_count(head)
2788  mapcount等于total_mapcount(head)
2789  如果非mapcountpage_ref_freeze(head, 1 + extra_pins)则
2790  如果非链表为空
2791  split_queue_len自减
2794  如果mapping
2801  自旋锁解锁
2802  __split_huge_page(page, list, end, flags)
2803  如果PageSwapCache(head)则
2807  否则ret等于0
2809  否则
2811  打印警报信息("total_mapcount: %u, page_count(): %u\n", mapcount, count)
2813  如果PageTail(page)则dump_page(head, NULL)
2815  dump_page(page, "total_mapcount(head) > 0")
2816  BUG()
2818  自旋锁解锁
2819  fail :
2819  如果mappingxa_unlock( & i_pages)
2821  spin_unlock_irqrestore( & Write-intensive fields used by page reclaim , flags)
2822  remap_page(head)
2823  ret等于负EBUSY
2826  out_unlock :
2827  如果anon_vma
2828  anon_vma_unlock_write(anon_vma)
2829  put_anon_vma(anon_vma)
2831  如果mappingi_mmap_unlock_read(mapping)
2833  out :
2834  Disable counters
2835  返回:ret
调用者
名称描述
shrink_page_listshrink_page_list() returns the number of reclaimed pages
migrate_pagesmigrate_pages - migrate the pages specified in a list, to the free pages* supplied as the target for the page migration*@from: The list of pages to be migrated.*@get_new_page: The function used to allocate free pages to be used
split_huge_page