[PATCH] Change synchronize_kernel to _rcu and _sched
authorPaul E. McKenney <paulmck@us.ibm.com>
Sun, 1 May 2005 15:59:04 +0000 (08:59 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Sun, 1 May 2005 15:59:04 +0000 (08:59 -0700)
This patch changes calls to synchronize_kernel(), deprecated in the earlier
"Deprecate synchronize_kernel, GPL replacement" patch to instead call the new
synchronize_rcu() and synchronize_sched() APIs.

Signed-off-by: Paul E. McKenney <paulmck@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
16 files changed:
arch/i386/oprofile/nmi_timer_int.c
arch/ppc64/kernel/HvLpEvent.c
drivers/acpi/processor_idle.c
drivers/char/ipmi/ipmi_si_intf.c
drivers/input/keyboard/atkbd.c
drivers/md/multipath.c
drivers/md/raid1.c
drivers/md/raid10.c
drivers/md/raid5.c
drivers/md/raid6main.c
drivers/net/r8169.c
drivers/s390/cio/airq.c
kernel/module.c
kernel/profile.c
mm/slab.c
net/core/dev.c

index b2e462abf337e44ffe7f2417b26b865542f193b9..c58d0c14f2744a0ae524f07d3f73089d9486e049 100644 (file)
@@ -36,7 +36,7 @@ static void timer_stop(void)
 {
        enable_timer_nmi_watchdog();
        unset_nmi_callback();
-       synchronize_kernel();
+       synchronize_sched();  /* Allow already-started NMIs to complete. */
 }
 
 
index 9802beefa2177b82a555e21c982f86f6e1f61760..f8f19637f73f1fa9e0ecc514989c4e005c2c9b77 100644 (file)
@@ -45,7 +45,7 @@ int HvLpEvent_unregisterHandler( HvLpEvent_Type eventType )
                        /* We now sleep until all other CPUs have scheduled. This ensures that
                         * the deletion is seen by all other CPUs, and that the deleted handler
                         * isn't still running on another CPU when we return. */
-                       synchronize_kernel();
+                       synchronize_rcu();
                }
        }
        return rc;
index 05a17812d5218f3d3810e7d4a7d0ac579a23b50b..ff64d333e95f58c68ac45f83832e41060ecb9d1c 100644 (file)
@@ -838,7 +838,7 @@ int acpi_processor_cst_has_changed (struct acpi_processor *pr)
 
        /* Fall back to the default idle loop */
        pm_idle = pm_idle_save;
-       synchronize_kernel();
+       synchronize_sched();  /* Relies on interrupts forcing exit from idle. */
 
        pr->flags.power = 0;
        result = acpi_processor_get_power_info(pr);
index 29de259a981e51980cdf01336677043d3037a543..44a7f13c788b5930fbaee14fe0bad68d7dd19c38 100644 (file)
@@ -2199,7 +2199,7 @@ static int init_one_smi(int intf_num, struct smi_info **smi)
        /* Wait until we know that we are out of any interrupt
           handlers might have been running before we freed the
           interrupt. */
-       synchronize_kernel();
+       synchronize_sched();
 
        if (new_smi->si_sm) {
                if (new_smi->handlers)
@@ -2312,7 +2312,7 @@ static void __exit cleanup_one_si(struct smi_info *to_clean)
        /* Wait until we know that we are out of any interrupt
           handlers might have been running before we freed the
           interrupt. */
-       synchronize_kernel();
+       synchronize_sched();
 
        /* Wait for the timer to stop.  This avoids problems with race
           conditions removing the timer here. */
index f7304f0ce542bac3c908c1f08e851e98baa79458..ff66ed4ee2cd0d77a0123560b854ca9f8bfc8368 100644 (file)
@@ -678,7 +678,7 @@ static void atkbd_disconnect(struct serio *serio)
        atkbd_disable(atkbd);
 
        /* make sure we don't have a command in flight */
-       synchronize_kernel();
+       synchronize_sched();  /* Allow atkbd_interrupt()s to complete. */
        flush_scheduled_work();
 
        device_remove_file(&serio->dev, &atkbd_attr_extra);
index c9b134cd1532fcb8994497aa8d37c6ff81a76ebf..1891e4930dcc0799ba35fb409b07d3a2d9565bb8 100644 (file)
@@ -355,7 +355,7 @@ static int multipath_remove_disk(mddev_t *mddev, int number)
                        goto abort;
                }
                p->rdev = NULL;
-               synchronize_kernel();
+               synchronize_rcu();
                if (atomic_read(&rdev->nr_pending)) {
                        /* lost the race, try later */
                        err = -EBUSY;
index a389394b52f6fb3f1b325baee0baaac662354550..83380b5d6593d25531a178a9aa29db17169f3a5e 100644 (file)
@@ -797,7 +797,7 @@ static int raid1_remove_disk(mddev_t *mddev, int number)
                        goto abort;
                }
                p->rdev = NULL;
-               synchronize_kernel();
+               synchronize_rcu();
                if (atomic_read(&rdev->nr_pending)) {
                        /* lost the race, try later */
                        err = -EBUSY;
index b100bfe4fdcaca356cc1b195607767f2d63b8398..e9dc2876a6269be27b0f726b83e468545be4be88 100644 (file)
@@ -977,7 +977,7 @@ static int raid10_remove_disk(mddev_t *mddev, int number)
                        goto abort;
                }
                p->rdev = NULL;
-               synchronize_kernel();
+               synchronize_rcu();
                if (atomic_read(&rdev->nr_pending)) {
                        /* lost the race, try later */
                        err = -EBUSY;
index 52c3a81c4aa7507661bb075e286fbc38750d3040..e96e2a10a9c96e53ebb63d562d951bba0258a380 100644 (file)
@@ -1873,7 +1873,7 @@ static int raid5_remove_disk(mddev_t *mddev, int number)
                        goto abort;
                }
                p->rdev = NULL;
-               synchronize_kernel();
+               synchronize_rcu();
                if (atomic_read(&rdev->nr_pending)) {
                        /* lost the race, try later */
                        err = -EBUSY;
index 7e30ab29691a090ca5e1da1b5530998ac073c8b6..8a33f351e0920f3cd4d4189b86bae39b4462e593 100644 (file)
@@ -2038,7 +2038,7 @@ static int raid6_remove_disk(mddev_t *mddev, int number)
                        goto abort;
                }
                p->rdev = NULL;
-               synchronize_kernel();
+               synchronize_rcu();
                if (atomic_read(&rdev->nr_pending)) {
                        /* lost the race, try later */
                        err = -EBUSY;
index 07e2df09491f207d5b27da4895668b68dca3bd43..c59507f8a76befe001f1313f55b6780423d1e778 100644 (file)
@@ -2385,7 +2385,7 @@ core_down:
        }
 
        /* Give a racing hard_start_xmit a few cycles to complete. */
-       synchronize_kernel();
+       synchronize_sched();  /* FIXME: should this be synchronize_irq()? */
 
        /*
         * And now for the 50k$ question: are IRQ disabled or not ?
index 3720e77b465fcf463e1ed5f178226cf29457e118..83e6a060668ead9e75fb718153fd8ee14c0229d5 100644 (file)
@@ -45,7 +45,7 @@ s390_register_adapter_interrupt (adapter_int_handler_t handler)
        else
                ret = (cmpxchg(&adapter_handler, NULL, handler) ? -EBUSY : 0);
        if (!ret)
-               synchronize_kernel();
+               synchronize_sched();  /* Allow interrupts to complete. */
 
        sprintf (dbf_txt, "ret:%d", ret);
        CIO_TRACE_EVENT (4, dbf_txt);
@@ -65,7 +65,7 @@ s390_unregister_adapter_interrupt (adapter_int_handler_t handler)
                ret = -EINVAL;
        else {
                adapter_handler = NULL;
-               synchronize_kernel();
+               synchronize_sched();  /* Allow interrupts to complete. */
                ret = 0;
        }
        sprintf (dbf_txt, "ret:%d", ret);
index 2dbfa0773faf331286f71d523aff771de6c2ea87..5734ab09d3f984af2e424a5b3da5fbf79f83aef2 100644 (file)
@@ -1801,7 +1801,7 @@ sys_init_module(void __user *umod,
                /* Init routine failed: abort.  Try to protect us from
                    buggy refcounters. */
                mod->state = MODULE_STATE_GOING;
-               synchronize_kernel();
+               synchronize_sched();
                if (mod->unsafe)
                        printk(KERN_ERR "%s: module is now stuck!\n",
                               mod->name);
index a66be468c422ca8587af2be6401ac80de9fb48da..0221a50ca867c50feda6b0f1317fd2637d41d8a6 100644 (file)
@@ -184,7 +184,7 @@ void unregister_timer_hook(int (*hook)(struct pt_regs *))
        WARN_ON(hook != timer_hook);
        timer_hook = NULL;
        /* make sure all CPUs see the NULL hook */
-       synchronize_kernel();
+       synchronize_sched();  /* Allow ongoing interrupts to complete. */
 }
 
 EXPORT_SYMBOL_GPL(register_timer_hook);
index 771cc09f9f1abf762561251952d4d0ea2813c72b..840742641152b91052d5688553f761aaff829be2 100644 (file)
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -1666,7 +1666,7 @@ int kmem_cache_destroy(kmem_cache_t * cachep)
        }
 
        if (unlikely(cachep->flags & SLAB_DESTROY_BY_RCU))
-               synchronize_kernel();
+               synchronize_rcu();
 
        /* no cpu_online check required here since we clear the percpu
         * array on cpu offline and set this to NULL.
index 7bd4cd4502c47eb1c530b548560c54a9139df04a..f5f005846fe1aca24c96caca1cbf875d3e99ebba 100644 (file)
@@ -3091,7 +3091,7 @@ void free_netdev(struct net_device *dev)
 void synchronize_net(void) 
 {
        might_sleep();
-       synchronize_kernel();
+       synchronize_rcu();
 }
 
 /**