hc
2023-12-08 01573e231f18eb2d99162747186f59511f56b64d
kernel/include/linux/cache.h
....@@ -15,8 +15,14 @@
1515
1616 /*
1717 * __read_mostly is used to keep rarely changing variables out of frequently
18
- * updated cachelines. If an architecture doesn't support it, ignore the
19
- * hint.
18
+ * updated cachelines. Its use should be reserved for data that is used
19
+ * frequently in hot paths. Performance traces can help decide when to use
20
+ * this. You want __read_mostly data to be tightly packed, so that in the
21
+ * best case multiple frequently read variables for a hot path will be next
22
+ * to each other in order to reduce the number of cachelines needed to
23
+ * execute a critical path. We should be mindful and selective of its use.
24
+ * ie: if you're going to use it please supply a *good* justification in your
25
+ * commit log
2026 */
2127 #ifndef __read_mostly
2228 #define __read_mostly
....@@ -28,7 +34,7 @@
2834 * but may get written to during init, so can't live in .rodata (via "const").
2935 */
3036 #ifndef __ro_after_init
31
-#define __ro_after_init __attribute__((__section__(".data..ro_after_init")))
37
+#define __ro_after_init __section(".data..ro_after_init")
3238 #endif
3339
3440 #ifndef ____cacheline_aligned