Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:Add a scanning area to the object. If at least one such area is added,* kmemleak will only scan these ranges rather than the whole memory block.

Proto:static void add_scan_area(unsigned long ptr, size_t size, gfp_t gfp)

Type:void

Parameter:

TypeParameterName
unsigned longptr
size_tsize
gfp_tgfp
789  struct kmemleak_scan_area * area = NULL
791  object = Look up an object in the object search tree and increase its use_count.
792  If Not object Then
793  Print a warning and dump the stack trace.("Adding scan area to unknown object at 0x%08lx\n", ptr)
795  Return
798  If scan_area_cache Then area = kmem_cache_alloc(scan_area_cache, GFP bitmask for kmemleak internal allocations (gfp))
801  spin_lock_irqsave( & lock, flags)
802  If Not area Then
803  pr_warn_once("Cannot allocate a scan area, scanning the full object\n")
805  bject status flags |= lag set to fully scan the object when scan_area allocation failed
806  Go to out_unlock
808  If size == SIZE_MAX Then
809  size = pointer + size - ptr
810  Else if ptr + size > pointer + size Then
811  Print a warning and dump the stack trace.("Scan area larger than object 0x%08lx\n", ptr)
812  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.
813  kmem_cache_free(scan_area_cache, area)
814  Go to out_unlock
817  INIT_HLIST_NODE( & node)
818  start = ptr
819  size = size
821  hlist_add_head( & node, & memory ranges to be scanned inside an object (empty for all) )
822  out_unlock :
823  spin_unlock_irqrestore( & lock, flags)
824  Decrement the object use_count. Once the count is 0, free the object using* an RCU callback. Since put_object() may be called via the kmemleak_free() ->* delete_object() path, the delayed RCU freeing ensures that there is no
Caller
NameDescribe
kmemleak_scan_areakmemleak_scan_area - limit the range to be scanned in an allocated object*@ptr: pointer to beginning or inside the object