函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:Scan data sections and all the referenced memory blocks allocated via the* kernel's standard allocators. This function must be called with the* scan_mutex held.

函数原型:static void kmemleak_scan(void)

返回类型:void

参数:

1403  new_leaks等于0
1405  jiffies_last_scan等于jiffies
1408  _read_lock() - mark the beginning of an RCU read-side critical section* When synchronize_rcu() is invoked on one CPU while other CPUs* are within RCU read-side critical sections, then the* synchronize_rcu() is guaranteed to block until after all the other
1410  spin_lock_irqsave( & lock, flags)
1416  如果atomic_read( & bject usage count; object freed when use_count == 0 )大于1则
1417  pr_debug("object->use_count = %d\n", atomic_read( & bject usage count; object freed when use_count == 0 ))
1419  Print the kmemleak_object information. This function is used mainly for* debugging special cases when kmemleak operations. It must be called with* the object->lock held.
1423  he total number of pointers found pointing to this object 等于0
1424  如果color_gray(object)且Increment the object use_count. Return 1 if successful or 0 otherwise. Note* that once an object's use_count reached 0, the RCU freeing was already* registered and the object should no longer be used. This function must be添加链表项
1427  spin_unlock_irqrestore( & lock, flags)
1429  _read_unlock() - marks the end of an RCU read-side critical section.* In most situations, rcu_read_unlock() is immune from deadlock.* However, in kernels built with CONFIG_RCU_BOOST, rcu_read_unlock()
1441  get_online_mems()
1442  for_each_online_node(i)
1443  start_pfn等于node_start_pfn(i)
1444  end_pfn等于node_end_pfn(i)
1447 pfn小于end_pfn循环
1450  如果非page则继续下一循环
1454  如果page_to_nid(page)不等于i则继续下一循环
1457  如果page_count(page)恒等于0则继续下一循环
1460  如果非pfn按位与63的值则cond_resched()
1464  put_online_mems()
1469  如果ables or disables the task stacks scanning
1472  read_lock( & tasklist_lock)
1474  stack等于try_get_task_stack(p)
1475  如果stack
1504  _read_unlock() - marks the end of an RCU read-side critical section.* In most situations, rcu_read_unlock() is immune from deadlock.* However, in kernels built with CONFIG_RCU_BOOST, rcu_read_unlock()
1509  Scan the objects already referenced (gray objects). More objects will be* referenced and, if there are no memory leaks, all the objects are scanned.
1514  如果Memory scanning is a long process and it needs to be interruptable. This* function checks whether such interrupt condition occurred.则返回
1520  _read_lock() - mark the beginning of an RCU read-side critical section* When synchronize_rcu() is invoked on one CPU while other CPUs* are within RCU read-side critical sections, then the* synchronize_rcu() is guaranteed to block until after all the other
1522  spin_lock_irqsave( & lock, flags)
1530  new_leaks自加
1532  spin_unlock_irqrestore( & lock, flags)
1534  _read_unlock() - marks the end of an RCU read-side critical section.* In most situations, rcu_read_unlock() is immune from deadlock.* However, in kernels built with CONFIG_RCU_BOOST, rcu_read_unlock()
1536  如果new_leaks
1537  If there are leaks that can be reported = true
1539  打印信息("%d new suspected memory leaks (see /sys/kernel/debug/kmemleak)\n", new_leaks)
调用者
名称描述
kmemleak_scan_threadThread function performing automatic memory scanning. Unreferenced objects* at the end of a memory scan are reported but only the first time.
kmemleak_writeFile write operation to configure kmemleak at run-time