Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:__lc_get

Proto:static struct lc_element *__lc_get(struct lru_cache *lc, unsigned int enr, unsigned int flags)

Type:struct lc_element

Parameter:

TypeParameterName
struct lru_cache *lc
unsigned intenr
unsigned intflags
365  his is developers aid only.* it catches concurrent access (lack of locking on the users part) ()
366  If see below: flag-bits for lru_cache & LC_STARVING Then
367  ++starving
368  RETURN(NULL)
371  e = __lc_find(lc, enr, 1)
376  If e Then
382  If Not (flags & LC_GET_MAY_USE_UNCOMMITTED) Then RETURN(NULL)
386  ++refcnt
387  ++hits
388  RETURN(e)
391  ++hits
392  If refcnt++ == 0 Then number of elements currently on in_use list ++
394  list_move - delete from one list and add as another's head*@list: the entry to move*@head: the head that will precede our entry
395  RETURN(e)
399  ++misses
400  If Not (flags & LC_GET_MAY_CHANGE) Then RETURN(NULL)
405  st_and_set_bit - Set a bit and return its old value*@nr: Bit to set*@addr: Address to count from* This is an atomic fully-ordered operation (implied full memory barrier).
410  If st_bit - Determine whether a bit is set*@nr: bit number to test*@addr: Address to start counting from Then
411  ++locked
412  RETURN(NULL)
418  If Not lc_unused_element_available(lc) Then
419  __set_bit - Set a bit in memory*@nr: the bit to set*@addr: the address to start counting from* Unlike set_bit(), this function is non-atomic. If it is called on the same* region of memory concurrently, the effect may be that only one operation* succeeds.
420  RETURN(NULL)
426  If number of elements currently on to_be_changed list >= allow to accumulate a few (index:label) changes, * but no more than max_pending_changes Then RETURN(NULL)
429  e = lc_prepare_for_change(lc, enr)
430  BUG_ON(!e)
432  lear_bit - Clears a bit in memory*@nr: Bit to clear*@addr: Address to start counting from* This is a relaxed atomic operation (no implied memory barriers).
433  BUG_ON(++refcnt != 1)
434  number of elements currently on in_use list ++
435  number of elements currently on to_be_changed list ++
437  RETURN(e)
Caller
NameDescribe
lc_getlc_get - get element by label, maybe change the active set*@lc: the lru cache to operate on*@enr: the label to look up* Finds an element in the cache, increases its usage count,* "touches" and returns it
lc_get_cumulativelc_get_cumulative - like lc_get; also finds to-be-changed elements*@lc: the lru cache to operate on*@enr: the label to look up* Unlike lc_get this also returns the element for @enr, if it is belonging to* a pending transaction, so the return values are
lc_try_getlc_try_get - get element by label, if present; do not change the active set*@lc: the lru cache to operate on*@enr: the label to look up* Finds an element in the cache, increases its usage count,* "touches" and returns it