STRUCT CACHEINFO(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

🌸 NAME

struct cacheinfo β€” represent a cache leaf node. Okay bestie, this is struct cacheinfo(9) straight out of the Kernel API Manual, and it's giving very specific kernel-cache energy πŸ’…βœ¨

✨ SYNOPSIS

       struct cacheinfo {
           unsigned int id;
           enum cache_type type;
           unsigned int level;
           unsigned int coherency_line_size;
           unsigned int number_of_sets;
           unsigned int ways_of_associativity;
           unsigned int physical_line_partition;
           unsigned int size;
           cpumask_t shared_cpu_map;
           unsigned int attributes;
         #define CACHE_WRITE_THROUGH     BIT(0);
         #define CACHE_WRITE_BACK        BIT(1);
         #define CACHE_WRITE_POLICY_MASK                 (CACHE_WRITE_THROUGH |
       CACHE_WRITE_BACK);
         #define CACHE_READ_ALLOCATE     BIT(2);
         #define CACHE_WRITE_ALLOCATE    BIT(3);
         #define CACHE_ALLOCATE_POLICY_MASK              (CACHE_READ_ALLOCATE |
       CACHE_WRITE_ALLOCATE);
         #define CACHE_ID                BIT(4);
           void *fw_token;
           bool disable_sysfs;
           void *priv;
        };

πŸ’… Members

  • id β€” this cache's id. It is unique among caches with the same (type, level). No duplicates in that little squad, periodt πŸ’–
  • type β€” type of the cache: data, inst, or unified. Pick your fighter ✨
  • level β€” represents the hierarchy in the multi-level cache. It's giving cache-floor realness 🏒
  • coherency_line_size β€” size of each cache line, usually representing the minimum amount of data that gets transferred from memory. Iconic little transfer unit πŸŽ€
  • number_of_sets β€” total number of sets; a set is a collection of cache lines sharing the same index. Set theory but make it cache 🧚
  • ways_of_associativity β€” number of ways in which a particular memory block can be placed in the cache. So many options, honestly πŸ¦‹
  • physical_line_partition β€” number of physical cache lines sharing the same cachetag. Shared tag moment 😭
  • size β€” total size of the cache. Big? Small? It's in there πŸ’€
  • shared_cpu_map β€” logical cpumask representing all the cpus sharing this cache node. CPU besties sharing one cache 🫢
  • attributes β€” bitfield representing various cache attributes. The CACHE_* defines up top are living here, iykyk πŸ”₯
  • fw_token β€” unique value used to determine if different cacheinfo structures represent a single hardware cache instance. One hardware cache, one token, no cap πŸ‘‘
  • disable_sysfs β€” indicates whether this node is visible to the user via sysfs or not. Visible or lowkey hidden πŸ™ˆ
  • priv β€” pointer to any private data structure specific to particular cache design. Private data stays private, bestie πŸ’œ

πŸ¦‹ Description

While of_node, disable_sysfs, and priv are used for internal book keeping, the remaining members form the core properties of the cache. That's the whole vibe check 🌈

πŸ‘‘ SEE ALSO

  • Kernel file ./include/linux/cacheinfo.h β€” go read it, bestie πŸ“–

source/version: ./include/linux β€’ date: October 2026 β€’ page: struct cacheinfo(9) β€” mwah πŸ’‹ bye bestie 🫢

πŸ“¦ where this page comes from