libkdumpfile-0.4.1
Kernel coredump file access
Data Fields
cache Struct Reference

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. More...
 
void * cleanup_data
 User-supplied data for the destructor. More...
 
struct cache_entry ce []
 Cache entries.
 

Detailed Description

Simple cache.

The cache is divided into five sections:

  1. probed list: cached entries that have been hit only once
  2. precious list: cached entries that have been hit more than once
  3. ghost probe list: evicted entries from the probed list
  4. ghost precious list: evicted entries from the precious list
  5. unused pool: entries that haven't been used yet

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.

Field Documentation

◆ cleanup_data

void* cache::cleanup_data

User-supplied data for the destructor.

◆ entry_cleanup

cache_entry_cleanup_fn* cache::entry_cleanup

Cache entry destructor.


The documentation for this struct was generated from the following file: