8 Matching Annotations
  1. Mar 2025
    1. n->colour_next++; if (n->colour_next >= cachep->colour) n->colour_next = 0; offset = n->colour_next; if (offset >= cachep->colour) offset = 0; offset *= cachep->colour_off;

      Colors are rotated through for cache coloring and offset values for next slab is calculated.

    2. cachep->align = ralign; cachep->colour_off = cache_line_size(); /* Offset must be a multiple of the alignment. */ if (cachep->colour_off < cachep->align) cachep->colour_off = cachep->align;

      defines cache coloring alignments to ensure objects likely to be accessed together aren't placed in the same cache lines

    3. size_t slab_size = PAGE_SIZE << gfporder;

      slab size is fixed based off whatever value for the page order is passed in

  2. Feb 2025
    1. pressure = scale - (reclaimed * scale / scanned); pressure = pressure * 100 / scale;

      Calculates pressure via reclaim efficiency rather than actual memory pressure.

    1. static ssize_t general_profit_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)

      Can be used to evaluate most efficient use of ksm

    1. if (new_order < MAX_PAGECACHE_ORDER) {

      Adjusts new_order so that it's balanced with the readahead window size while increasing it as much as possible.

    2. if (cur < max / 16) return 4 * cur; if (cur <= max / 2) return 2 * cur;

      Set values for scaling readahead window. Might be too minor to need changes though.

    3. unsigned long newsize = roundup_pow_of_two(size); if (newsize <= max / 32) newsize = newsize * 4; else if (newsize <= max / 4) newsize = newsize * 2; else newsize = max; return newsize;

      These are all heuristics to determine intial readahead size. Trades potentially memory overuse for faster access. Could be changed to not use these hardcoded values.