Skip to contentSkip to conversation

scheduling while atomic in fs/file.c

PATCH In review Daniel Walker 2 participants 3 messages Apr 22, 2006 – May 3, 2006 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scheduling while atomic in fs/file.c

In free_fdtable_rcu() it does the following,

        } else {
                fddef = &get_cpu_var(fdtable_defer_list);
                spin_lock(&fddef->lock);
		...
                spin_unlock(&fddef->lock);
                put_cpu_var(fdtable_defer_list);
        }

I've never seen a scheduling while atomic, but seems like it could happen . Not much contention on this lock though.

fs/file.c +1 -2
Index: linux-2.6.16/fs/file.c
===================================================================
@@ -137,7 +137,7 @@ static void free_fdtable_rcu(struct rcu_
 		kfree(fdt->fd);
 		kfree(fdt);
 	} else {
-		fddef = &get_cpu_var(fdtable_defer_list);
+		fddef = &__get_cpu_var(fdtable_defer_list);
 		spin_lock(&fddef->lock);
 		fdt->next = fddef->next;
 		fddef->next = fdt;
@@ -149,7 +149,6 @@ static void free_fdtable_rcu(struct rcu_
 		if (!schedule_work(&fddef->wq))
 			mod_timer(&fddef->timer, 5);
 		spin_unlock(&fddef->lock);
-		put_cpu_var(fdtable_defer_list);
 	}
 }
 
#1 lore raw

fs/file.c static void free_fdtable_rcu(struct rcu_ · line 140

Quoted 2 lines · Daniel Walker
fs/file.c +1 -1
-		fddef = &get_cpu_var(fdtable_defer_list);
+		fddef = &__get_cpu_var(fdtable_defer_list);

ok, the bug you found is real - but i dont like the fix: now we will be using smp_processor_id() in preemptible code, which will trip up under DEBUG_PREEMPT. Since in this particular case any CPU is fine, per_cpu(...,raw_smp_processor_id()) ought to do the trick. Mind to update the patch?

Ingo

#2 lore raw
Quoted 10 lines · Ingo Molnar

fs/file.c static void free_fdtable_rcu(struct rcu_ · line 140

Quoted 2 lines · Daniel Walker
fs/file.c +1 -1
-		fddef = &get_cpu_var(fdtable_defer_list);
+		fddef = &__get_cpu_var(fdtable_defer_list);

ok, the bug you found is real - but i dont like the fix: now we will be using smp_processor_id() in preemptible code, which will trip up under DEBUG_PREEMPT. Since in this particular case any CPU is fine, per_cpu(...,raw_smp_processor_id()) ought to do the trick. Mind to update the patch?

Sure I can do it, not exactly high priority considering it's never been observed ..

Daniel