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

  2. Feb 2025
    1. 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.