cgroup: use irqsave in cgroup_rstat_flush_locked().
[linux-2.6-microblaze.git] / kernel / cgroup / rstat.c
index 9d331ba..ba7a660 100644 (file)
@@ -153,8 +153,17 @@ static void cgroup_rstat_flush_locked(struct cgroup *cgrp, bool may_sleep)
                raw_spinlock_t *cpu_lock = per_cpu_ptr(&cgroup_rstat_cpu_lock,
                                                       cpu);
                struct cgroup *pos = NULL;
+               unsigned long flags;
 
-               raw_spin_lock(cpu_lock);
+               /*
+                * The _irqsave() is needed because cgroup_rstat_lock is
+                * spinlock_t which is a sleeping lock on PREEMPT_RT. Acquiring
+                * this lock with the _irq() suffix only disables interrupts on
+                * a non-PREEMPT_RT kernel. The raw_spinlock_t below disables
+                * interrupts on both configurations. The _irqsave() ensures
+                * that interrupts are always disabled and later restored.
+                */
+               raw_spin_lock_irqsave(cpu_lock, flags);
                while ((pos = cgroup_rstat_cpu_pop_updated(pos, cgrp, cpu))) {
                        struct cgroup_subsys_state *css;
 
@@ -166,7 +175,7 @@ static void cgroup_rstat_flush_locked(struct cgroup *cgrp, bool may_sleep)
                                css->ss->css_rstat_flush(css, cpu);
                        rcu_read_unlock();
                }
-               raw_spin_unlock(cpu_lock);
+               raw_spin_unlock_irqrestore(cpu_lock, flags);
 
                /* if @may_sleep, play nice and yield if necessary */
                if (may_sleep && (need_resched() ||