Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\debug\kdb\kdb_support.c Create Date:2022-07-28 11:43:28
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:debug_kmalloc

Proto:void *debug_kmalloc(size_t size, gfp_t flags)

Type:void

Parameter:

TypeParameterName
size_tsize
gfp_tflags
749  void * p = NULL
750  If Not get_dap_lock() Then
751  __release(Locking is awkward. The debug code is called from all contexts,* including non maskable interrupts. A normal spinlock is not safe* in NMI context. Try to get the debug allocator lock, if it cannot* be obtained after a second then give up)
752  Return NULL
754  h = debug_alloc_pool + dah_first
755  If dah_first_call Then
756  size = size of debug_alloc_pool_aligned - dah_overhead
757  dah_first_call = 0
759  size = @a is a power of 2 value (size, The memory returned by this allocator must be aligned, which means* so must the header size)
760  prev = best = bestprev = NULL
761  When 1 cycle
762  If size >= size && ( Not best || size < size ) Then
763  best = h
764  bestprev = prev
765  If size == size Then Break
768  If Not ffset of next header from start of pool Then Break
770  prev = h
771  h = debug_alloc_pool + ffset of next header from start of pool
773  If Not best Then Go to out
775  rem = size - size
777  If ffset of next header from start of pool == 0 && bestprev == NULL && rem < dah_overhead Then Go to out
779  If rem >= dah_overhead Then
780  size = size
781  h_offset = best - debug_alloc_pool + dah_overhead + size
783  h = debug_alloc_pool + h_offset
784  size = rem - dah_overhead
785  ffset of next header from start of pool = ffset of next header from start of pool
786  Else h_offset = ffset of next header from start of pool
788  caller = __builtin_return_address(0)
789  dah_used += size
790  dah_used_max = max - return maximum of two values of the same or compatible types*@x: first value*@y: second value(dah_used, dah_used_max)
791  If bestprev Then ffset of next header from start of pool = h_offset
793  Else dah_first = h_offset
795  p = best + dah_overhead
796  memset(p, r use-uninitialised poisoning , size - 1)
797  *( p + size - 1) = d-byte of poisoning
798  out :
799  spin_unlock( & Locking is awkward. The debug code is called from all contexts,* including non maskable interrupts. A normal spinlock is not safe* in NMI context. Try to get the debug allocator lock, if it cannot* be obtained after a second then give up)
800  Return p