edac,rcu: use synchronize_rcu() instead of call_rcu()+rcu_barrier()
authorLai Jiangshan <laijs@cn.fujitsu.com>
Thu, 26 May 2011 23:25:58 +0000 (16:25 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 27 May 2011 00:12:37 +0000 (17:12 -0700)
synchronize_rcu() does the stuff as needed.

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Cc: Doug Thompson <dougthompson@xmission.com>
Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/edac/edac_core.h
drivers/edac/edac_device.c
drivers/edac/edac_mc.c
drivers/edac/edac_pci.c

index eefa3501916b60c0da2a6df740b8413da3df136a..55b8278bb172f6feda52e225581b258b3404402a 100644 (file)
@@ -421,10 +421,6 @@ struct mem_ctl_info {
        u32 ce_count;           /* Total Correctable Errors for this MC */
        unsigned long start_time;       /* mci load start time (in jiffies) */
 
-       /* this stuff is for safe removal of mc devices from global list while
-        * NMI handlers may be traversing list
-        */
-       struct rcu_head rcu;
        struct completion complete;
 
        /* edac sysfs device control */
@@ -620,10 +616,6 @@ struct edac_device_ctl_info {
 
        unsigned long start_time;       /* edac_device load start time (jiffies) */
 
-       /* these are for safe removal of mc devices from global list while
-        * NMI handlers may be traversing list
-        */
-       struct rcu_head rcu;
        struct completion removal_complete;
 
        /* sysfs top name under 'edac' directory
@@ -722,10 +714,6 @@ struct edac_pci_ctl_info {
 
        unsigned long start_time;       /* edac_pci load start time (jiffies) */
 
-       /* these are for safe removal of devices from global list while
-        * NMI handlers may be traversing list
-        */
-       struct rcu_head rcu;
        struct completion complete;
 
        /* sysfs top name under 'edac' directory
index a7408cf86f37f5ece603052bd8956cae30269777..c3f67437afb666f489cf926d573501fb79c344a4 100644 (file)
@@ -345,31 +345,19 @@ fail1:
        return 1;
 }
 
-/*
- * complete_edac_device_list_del
- *
- *     callback function when reference count is zero
- */
-static void complete_edac_device_list_del(struct rcu_head *head)
-{
-       struct edac_device_ctl_info *edac_dev;
-
-       edac_dev = container_of(head, struct edac_device_ctl_info, rcu);
-       INIT_LIST_HEAD(&edac_dev->link);
-}
-
 /*
  * del_edac_device_from_global_list
- *
- *     remove the RCU, setup for a callback call,
- *     then wait for the callback to occur
  */
 static void del_edac_device_from_global_list(struct edac_device_ctl_info
                                                *edac_device)
 {
        list_del_rcu(&edac_device->link);
-       call_rcu(&edac_device->rcu, complete_edac_device_list_del);
-       rcu_barrier();
+
+       /* these are for safe removal of devices from global list while
+        * NMI handlers may be traversing list
+        */
+       synchronize_rcu();
+       INIT_LIST_HEAD(&edac_device->link);
 }
 
 /*
index 1d8056049072698361a2eeb83db0d0a5935964e0..d69144a090435cbfdd5d883e231475e649c666d8 100644 (file)
@@ -447,20 +447,16 @@ fail1:
        return 1;
 }
 
-static void complete_mc_list_del(struct rcu_head *head)
-{
-       struct mem_ctl_info *mci;
-
-       mci = container_of(head, struct mem_ctl_info, rcu);
-       INIT_LIST_HEAD(&mci->link);
-}
-
 static void del_mc_from_global_list(struct mem_ctl_info *mci)
 {
        atomic_dec(&edac_handlers);
        list_del_rcu(&mci->link);
-       call_rcu(&mci->rcu, complete_mc_list_del);
-       rcu_barrier();
+
+       /* these are for safe removal of devices from global list while
+        * NMI handlers may be traversing list
+        */
+       synchronize_rcu();
+       INIT_LIST_HEAD(&mci->link);
 }
 
 /**
index efb5d565078304c60ea096b84bf1ae2b9761e4a4..2b378207d571b6bbd2220ac4b7deb263537b34b4 100644 (file)
@@ -163,19 +163,6 @@ fail1:
        return 1;
 }
 
-/*
- * complete_edac_pci_list_del
- *
- *     RCU completion callback to indicate item is deleted
- */
-static void complete_edac_pci_list_del(struct rcu_head *head)
-{
-       struct edac_pci_ctl_info *pci;
-
-       pci = container_of(head, struct edac_pci_ctl_info, rcu);
-       INIT_LIST_HEAD(&pci->link);
-}
-
 /*
  * del_edac_pci_from_global_list
  *
@@ -184,8 +171,12 @@ static void complete_edac_pci_list_del(struct rcu_head *head)
 static void del_edac_pci_from_global_list(struct edac_pci_ctl_info *pci)
 {
        list_del_rcu(&pci->link);
-       call_rcu(&pci->rcu, complete_edac_pci_list_del);
-       rcu_barrier();
+
+       /* these are for safe removal of devices from global list while
+        * NMI handlers may be traversing list
+        */
+       synchronize_rcu();
+       INIT_LIST_HEAD(&pci->link);
 }
 
 #if 0