[patch] Export Last Level Cache topology to userspace

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

right now the sysfs topology information exports things like sibling
maps (which cpu is a hyperthreading peer of another) and which "linux
cpus" share the physical package. The patch below adds a bitmap in the
same style that exports which "linux cpus" share the last level cache.
This is relevant at least for the current line of Intel Quad cores (but
also for AMD's dual core offering) where the biggest cache isn't shared
on the package level, but only be some cores (Intel) or only one core
(AMD). 

This information is useful for userspace that wants to do explicit
process placement, and in specific, I'm going to need it in the
irqbalance rewrite (which is going to balance irqs on the cache domain
level).


Signed-off-by: Arjan van de Ven <[email protected]>

Index: linux-2.6.19-rc6/drivers/base/topology.c
===================================================================
--- linux-2.6.19-rc6.orig/drivers/base/topology.c
+++ linux-2.6.19-rc6/drivers/base/topology.c
@@ -81,11 +81,20 @@ define_one_ro(core_siblings);
 #define ref_core_siblings_attr
 #endif
 
+#ifdef topology_llc_siblings
+define_siblings_show_func(llc_siblings);
+define_one_ro(llc_siblings);
+#define ref_llc_siblings_attr		&attr_llc_siblings.attr,
+#else
+#define ref_llc_siblings_attr
+#endif
+
 static struct attribute *default_attrs[] = {
 	ref_physical_package_id_attr
 	ref_core_id_attr
 	ref_thread_siblings_attr
 	ref_core_siblings_attr
+	ref_llc_siblings_attr
 	NULL
 };
 
Index: linux-2.6.19-rc6/include/asm-x86_64/topology.h
===================================================================
--- linux-2.6.19-rc6.orig/include/asm-x86_64/topology.h
+++ linux-2.6.19-rc6/include/asm-x86_64/topology.h
@@ -60,6 +60,7 @@ extern int __node_distance(int, int);
 #define topology_core_id(cpu)			(cpu_data[cpu].cpu_core_id)
 #define topology_core_siblings(cpu)		(cpu_core_map[cpu])
 #define topology_thread_siblings(cpu)		(cpu_sibling_map[cpu])
+#define topology_llc_siblings(cpu)		(cpu_data[cpu].llc_shared_map)
 #define mc_capable()			(boot_cpu_data.x86_max_cores > 1)
 #define smt_capable() 			(smp_num_siblings > 1)
 #endif

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux