Commit e2e77098764636456ba7092a8b3b3b34b2a8e8d8

Authored by Lai Jiangshan
Committed by Linus Torvalds
1 parent 26498e89e8

edac,rcu: use synchronize_rcu() instead of call_rcu()+rcu_barrier()

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>

Showing 4 changed files with 18 additions and 55 deletions Side-by-side Diff

drivers/edac/edac_core.h
... ... @@ -421,10 +421,6 @@
421 421 u32 ce_count; /* Total Correctable Errors for this MC */
422 422 unsigned long start_time; /* mci load start time (in jiffies) */
423 423  
424   - /* this stuff is for safe removal of mc devices from global list while
425   - * NMI handlers may be traversing list
426   - */
427   - struct rcu_head rcu;
428 424 struct completion complete;
429 425  
430 426 /* edac sysfs device control */
... ... @@ -620,10 +616,6 @@
620 616  
621 617 unsigned long start_time; /* edac_device load start time (jiffies) */
622 618  
623   - /* these are for safe removal of mc devices from global list while
624   - * NMI handlers may be traversing list
625   - */
626   - struct rcu_head rcu;
627 619 struct completion removal_complete;
628 620  
629 621 /* sysfs top name under 'edac' directory
... ... @@ -722,10 +714,6 @@
722 714  
723 715 unsigned long start_time; /* edac_pci load start time (jiffies) */
724 716  
725   - /* these are for safe removal of devices from global list while
726   - * NMI handlers may be traversing list
727   - */
728   - struct rcu_head rcu;
729 717 struct completion complete;
730 718  
731 719 /* sysfs top name under 'edac' directory
drivers/edac/edac_device.c
... ... @@ -346,30 +346,18 @@
346 346 }
347 347  
348 348 /*
349   - * complete_edac_device_list_del
350   - *
351   - * callback function when reference count is zero
352   - */
353   -static void complete_edac_device_list_del(struct rcu_head *head)
354   -{
355   - struct edac_device_ctl_info *edac_dev;
356   -
357   - edac_dev = container_of(head, struct edac_device_ctl_info, rcu);
358   - INIT_LIST_HEAD(&edac_dev->link);
359   -}
360   -
361   -/*
362 349 * del_edac_device_from_global_list
363   - *
364   - * remove the RCU, setup for a callback call,
365   - * then wait for the callback to occur
366 350 */
367 351 static void del_edac_device_from_global_list(struct edac_device_ctl_info
368 352 *edac_device)
369 353 {
370 354 list_del_rcu(&edac_device->link);
371   - call_rcu(&edac_device->rcu, complete_edac_device_list_del);
372   - rcu_barrier();
  355 +
  356 + /* these are for safe removal of devices from global list while
  357 + * NMI handlers may be traversing list
  358 + */
  359 + synchronize_rcu();
  360 + INIT_LIST_HEAD(&edac_device->link);
373 361 }
374 362  
375 363 /*
drivers/edac/edac_mc.c
... ... @@ -447,20 +447,16 @@
447 447 return 1;
448 448 }
449 449  
450   -static void complete_mc_list_del(struct rcu_head *head)
451   -{
452   - struct mem_ctl_info *mci;
453   -
454   - mci = container_of(head, struct mem_ctl_info, rcu);
455   - INIT_LIST_HEAD(&mci->link);
456   -}
457   -
458 450 static void del_mc_from_global_list(struct mem_ctl_info *mci)
459 451 {
460 452 atomic_dec(&edac_handlers);
461 453 list_del_rcu(&mci->link);
462   - call_rcu(&mci->rcu, complete_mc_list_del);
463   - rcu_barrier();
  454 +
  455 + /* these are for safe removal of devices from global list while
  456 + * NMI handlers may be traversing list
  457 + */
  458 + synchronize_rcu();
  459 + INIT_LIST_HEAD(&mci->link);
464 460 }
465 461  
466 462 /**
drivers/edac/edac_pci.c
... ... @@ -164,19 +164,6 @@
164 164 }
165 165  
166 166 /*
167   - * complete_edac_pci_list_del
168   - *
169   - * RCU completion callback to indicate item is deleted
170   - */
171   -static void complete_edac_pci_list_del(struct rcu_head *head)
172   -{
173   - struct edac_pci_ctl_info *pci;
174   -
175   - pci = container_of(head, struct edac_pci_ctl_info, rcu);
176   - INIT_LIST_HEAD(&pci->link);
177   -}
178   -
179   -/*
180 167 * del_edac_pci_from_global_list
181 168 *
182 169 * remove the PCI control struct from the global list
... ... @@ -184,8 +171,12 @@
184 171 static void del_edac_pci_from_global_list(struct edac_pci_ctl_info *pci)
185 172 {
186 173 list_del_rcu(&pci->link);
187   - call_rcu(&pci->rcu, complete_edac_pci_list_del);
188   - rcu_barrier();
  174 +
  175 + /* these are for safe removal of devices from global list while
  176 + * NMI handlers may be traversing list
  177 + */
  178 + synchronize_rcu();
  179 + INIT_LIST_HEAD(&pci->link);
189 180 }
190 181  
191 182 #if 0