函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:Spill all the per-cpu pages from all CPUs back into the buddy allocator.* When zone parameter is non-NULL, spill just the single zone's pages.* Note that this can be extremely slow as the draining happens in a workqueue.

函数原型:void drain_all_pages(struct zone *zone)

返回类型:void

参数:

类型参数名称
struct zone *zone
2894  如果WARN_ON_ONCE(!mm_percpu_wq)则返回
2902  如果此条件成立可能性小(为编译器优化)(!mutex_trylock - try to acquire the mutex, without waiting*@lock: the mutex to be acquired* Try to acquire the mutex atomically)则
2903  如果非zone则返回
2905  mutex_lock( & pcpu_drain_mutex)
2914  遍历在线CPU(cpu)
2917  bool has_pcps = false
2919  如果zone
2921  如果 number of pages in the list has_pcps = true
2923  否则
2924  do nothing (z)
2927  has_pcps = true
2928  退出
2933  如果has_pcps设置CPU信息
2935  否则清空CPU信息
2940  drain等于per_cpu_ptr( & pcpu_drain, cpu)
2942  zone等于zone
2943  INIT_WORK( & work, drain_local_pages_wq)
2944  queue_work_on - queue work on specific cpu*@cpu: CPU number to execute work on*@wq: workqueue to use*@work: work to queue* We queue the work to a specific CPU, the caller must ensure it* can't go away.
2946  遍历CPU(cpu, & cpus_with_pcps)
2947  lush_work - wait for a work to finish executing the last queueing instance*@work: the work to flush* Wait until @work has finished execution
2949  mutex_unlock - release the mutex*@lock: the mutex to be released* Unlock a mutex that has been locked by this task previously.* This function must not be used in interrupt context. Unlocking* of a not locked mutex is not allowed.
调用者
名称描述
__alloc_pages_direct_reclaimThe really slow allocator path where we enter direct reclaim
madvise_inject_errorError injection support for memory error handling.
shake_pageWhen a unknown page type is encountered drain as many buffers as possible* in the hope to turn the page into a LRU or free page, which we can handle.
read_page_owner
set_migratetype_isolate
pagetypeinfo_showmixedcountPrint out the number of pageblocks for each migratetype that contain pages* of other types. This gives an indication of how well fallbacks are being* contained by rmqueue_fallback(). It requires information from PAGE_OWNER* to determine what is going on