LinuxMM:

The goals for this implementation of non-resident page bookkeeping:

Data structures

The nr_page data structure represents one non-resident page, by virtue of pointing to the page mapping (or mm) and the page offset. We steal some bits from both fields for the object generation and to indicate which pageout list the page was on before it got evicted.

struct nr_page {
        void * mapping;
        unsigned long offset_and_gen;
};

We fit multiple of these nr_page structs in one (cacheline sized?) hash bucket. This means we do not need a lookup list for these pages, we simply look through all the objects in the cacheline, doing quick pointer comparisons. Having one spin_lock per hash bucket, and having that spinlock in the same cacheline, should help SMP scalability.

/* Number of non-resident pages per hash bucket */
#define NUM_NR ((L1_CACHE_BYTES - sizeof(spinlock_t))/sizeof(struct nr_page))

struct nr_bucket
{
        spinlock_t lock;
        struct nr_page pages[NUM_NR];
} __cacheline_aligned;

LinuxMM: NonResidentPages (last edited 2005-04-21 20:12:47 by nat-pool-bos)