Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\kasan\quarantine.c Create Date:2022-07-28 15:54:50
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:quarantine_reduce

Proto:void quarantine_reduce(void)

Type:void

Parameter:Nothing

218  to_free = QLIST_INIT
220  If Value is more likely to compile time(READ_ONCE(Total size of all objects in global_quarantine across all batches. ) <= READ_ONCE(Maximum size of the global queue. )) Then Return
233  srcu_idx = srcu_read_lock - register a new reader for an SRCU-protected structure
234  raw_spin_lock_irqsave( & quarantine_lock, flags)
240  total_size = (totalram_pages() << PAGE_SHIFT determines the page size ) / The fraction of physical memory the quarantine is allowed to occupy.* Quarantine doesn't support memory shrinker with SLAB allocator, so we keep* the ratio low to avoid OOM.
242  percpu_quarantines = QUARANTINE_PERCPU_SIZE * num_online_cpus()
243  new_quarantine_size = If total_size < percpu_quarantines Then 0 Else total_size - percpu_quarantines
245  WRITE_ONCE(Maximum size of the global queue. , new_quarantine_size)
247  WRITE_ONCE(Target size of a batch in global_quarantine.* Usually equal to QUARANTINE_PERCPU_SIZE unless we have too much RAM., max - return maximum of two values of the same or compatible types*@x: first value*@y: second value((size_t)QUARANTINE_PERCPU_SIZE, 2 * total_size / QUARANTINE_BATCHES))
250  If Value is more likely to compile time(Total size of all objects in global_quarantine across all batches. > Maximum size of the global queue. ) Then
251  qlist_move_all( & Round-robin FIFO array of batches. [quarantine_head], & to_free)
252  WRITE_ONCE(Total size of all objects in global_quarantine across all batches. , Total size of all objects in global_quarantine across all batches. - bytes)
253  quarantine_head++
254  If quarantine_head == QUARANTINE_BATCHES Then quarantine_head = 0
258  raw_spin_unlock_irqrestore( & quarantine_lock, flags)
260  qlist_free_all( & to_free, NULL)
261  srcu_read_unlock - unregister a old reader from an SRCU-protected structure.*@ssp: srcu_struct in which to unregister the old reader.*@idx: return value from corresponding srcu_read_lock().* Exit an SRCU read-side critical section.
Caller
NameDescribe
kasan_kmalloc_large