libkdumpfile-0.4.1
Kernel coredump file access
|
Simple cache. More...
Data Fields | |
unsigned | split |
Split point between probed and precious entries (index of MRU probed entry) | |
unsigned | nprec |
Number of cached precious entries. | |
unsigned | ngprec |
Number of ghost precious entries. | |
unsigned | nprobe |
Number of cached probe entries. | |
unsigned | ngprobe |
Number of ghost probe entries. | |
unsigned | dprobe |
Desired nubmer of cached probe entries. | |
unsigned | nprobetotal |
Total number of probe list entries, including ghost and in-flight entries. | |
unsigned | cap |
Total cache capacity. | |
unsigned | inflight |
Index of first in-flight entry. | |
unsigned | ninflight |
Number of in-flight entries. | |
kdump_attr_value_t | hits |
Cache hits. | |
kdump_attr_value_t | misses |
Cache misses. | |
size_t | elemsize |
Element data size. | |
void * | data |
Actual cache data. | |
cache_entry_cleanup_fn * | entry_cleanup |
Cache entry destructor. | |
void * | cleanup_data |
User-supplied data for the destructor. | |
struct cache_entry | ce [] |
Cache entries. | |
Simple cache.
The cache is divided into five sections:
Cached entries have a non-NULL data pointer. Ghost entries do not have any data, so their data pointer is NULL.
The cache is implemented as a circular list. This allows to move around entries without copying much data even if the cache is large. The list is organized as follows:
<-- ngprobe --> <- nprobe -> <- nprec -> <--- ngprec ---> +--------+---------------+------------+-----------+----------------+ | unused | ghost probed | probed | precious | ghost precious | +--------+---------------+------------+-----------+----------------+ ^ ^ ^ ^ ^ eprobe gprobe split gprec eprec
Only the split index and the four sizes are stored in the structure. During a search, the remaining pointers are found as a side effect, and they are stored in cache_search.
Note that any section may be empty; some pointers will share the same value in such case.
Also note that since the list is circular, unused entries are in fact between ghost probed and ghost precious lists. This part of the cache is usually empty; it's used only after a flush or when an entry is discarded.