Skip to contentSkip to conversation

RCU statistics 2.5.52

PATCH New Dipankar Sarma 1 participant 1 message Dec 16, 2002

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 RCU statistics 2.5.52

Hi Linus,

This is a re-transmit of the patch that adds some basic statistics to RCU (/proc/rcu). The statistics made available by this patch are very generic in nature - # of RCU requests and # of actual RCU updates for each CPU. This will allow us to monitor the health of the RCU subsystem and such things have been extremely useful for investigating problems. For example, if a CPU looping in kernel stops RCU grace period from completing, we would be easily able to detect it by looking at these counters. Without these, that becomes very difficult.

dipankar@llm04 dipankar]$ cat /proc/rcu
CPU : 0
RCU requests : 0
RCU updates : 0

CPU : 1
RCU requests : 0
RCU updates : 0

CPU : 2
RCU requests : 0
RCU updates : 0

CPU : 3
RCU requests : 0
RCU updates : 0

This patch has been in akpm's -mm tree for a long time now and would be nice to have in your tree.

Thanks
Dipankar

 Documentation/filesystems/proc.txt |    4 +++
 fs/proc/proc_misc.c                |   13 ++++++++++
 include/linux/rcupdate.h           |    4 +++
 kernel/rcupdate.c                  |   48 +++++++++++++++++++++++++++++++++++--
 4 files changed, 67 insertions(+), 2 deletions(-)
Documentation/filesystems/proc.txt +4 -0
diff -urN linux-2.5.52-base/Documentation/filesystems/proc.txt linux-2.5.52-rcu_stats/Documentation/filesystems/proc.txt
@@ -222,6 +222,7 @@
  partitions  Table of partitions known to the system           
  pci	     Depreciated info of PCI bus (new way -> /proc/bus/pci/, 
              decoupled by lspci					(2.4)
+ rcu	     Read-Copy Update information			(2.5)
  rtc         Real time clock                                   
  scsi        SCSI info (see text)                              
  slabinfo    Slab pool info                                    
@@ -346,6 +347,9 @@
 ZONE_DMA, 4 chunks of 2^1*PAGE_SIZE in ZONE_DMA, 101 chunks of 2^4*PAGE_SIZE 
 availble in ZONE_NORMAL, etc... 
 
+The rcu file gives information about Read-Copy Update synchronization
+primitive. It indicates the number for RCU requests and actual
+updates for every CPU.
 
 1.3 IDE devices in /proc/ide
 ----------------------------
fs/proc/proc_misc.c +13 -0
diff -urN linux-2.5.52-base/fs/proc/proc_misc.c linux-2.5.52-rcu_stats/fs/proc/proc_misc.c
@@ -243,6 +243,18 @@
 	.release	= seq_release,
 };
 
+extern struct seq_operations rcu_op;
+static int rcu_open(struct inode *inode, struct file *file)
+{
+	return seq_open(file, &rcu_op);
+}
+static struct file_operations proc_rcu_operations = {
+	.open		= rcu_open,
+	.read		= seq_read,
+	.llseek		= seq_lseek,
+	.release	= seq_release,
+};
+
 extern struct seq_operations vmstat_op;
 static int vmstat_open(struct inode *inode, struct file *file)
 {
@@ -586,6 +598,7 @@
 	if (entry)
 		entry->proc_fops = &proc_kmsg_operations;
 	create_seq_entry("cpuinfo", 0, &proc_cpuinfo_operations);
+	create_seq_entry("rcu", 0, &proc_rcu_operations);
 	create_seq_entry("partitions", 0, &proc_partitions_operations);
 #if !defined(CONFIG_ARCH_S390)
 	create_seq_entry("interrupts", 0, &proc_interrupts_operations);
include/linux/rcupdate.h +4 -0
diff -urN linux-2.5.52-base/include/linux/rcupdate.h linux-2.5.52-rcu_stats/include/linux/rcupdate.h
@@ -95,6 +95,8 @@
         long  	       	batch;           /* Batch # for current RCU batch */
         struct list_head  nxtlist;
         struct list_head  curlist;
+ 	long		nr_rcureqs;
+ 	long		nr_rcupdates;
 };
 
 DECLARE_PER_CPU(struct rcu_data, rcu_data);
@@ -105,6 +107,8 @@
 #define RCU_batch(cpu) 		(per_cpu(rcu_data, (cpu)).batch)
 #define RCU_nxtlist(cpu) 	(per_cpu(rcu_data, (cpu)).nxtlist)
 #define RCU_curlist(cpu) 	(per_cpu(rcu_data, (cpu)).curlist)
+#define RCU_nr_rcureqs(cpu) 	(per_cpu(rcu_data, (cpu)).nr_rcureqs)
+#define RCU_nr_rcupdates(cpu) 	(per_cpu(rcu_data, (cpu)).nr_rcupdates)
 
 #define RCU_QSCTR_INVALID	0
 
kernel/rcupdate.c +46 -2

81 lines not on this page · raw message