Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\kmemleak.c Create Date:2022-07-28 16:22:17
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name: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.

Proto:static void kmemleak_scan(void)

Type:void

Parameter:Nothing

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  If atomic_read( & bject usage count; object freed when use_count == 0 ) > 1 Then
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  If 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 Then list_add_tail - add a new entry*@new: new entry to be added*@head: list head to add it before* Insert a new entry before the specified head.* This is useful for implementing queues.
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  When pfn < end_pfn cycle
1450  If Not page Then Continue
1454  If page_to_nid(page) != i Then Continue
1457  If page_count(page) == 0 Then Continue
1460  If Not (pfn & 63) Then cond_resched()
1464  put_online_mems()
1469  If ables or disables the task stacks scanning Then
1472  read_lock( & tasklist_lock)
1475  If stack Then
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  If Memory scanning is a long process and it needs to be interruptable. This* function checks whether such interrupt condition occurred. Then Return
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  If new_leaks Then
1537  If there are leaks that can be reported = true
1539  pr_info("%d new suspected memory leaks (see /sys/kernel/debug/kmemleak)\n", new_leaks)
Caller
NameDescribe
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