diff mbox

[v2,0/9] Remove spin_unlock_wait()

Message ID 20170707093249.3pskpxhf3ozfhrsr@gmail.com
State RFC
Delegated to: Pablo Neira
Headers show

Commit Message

Ingo Molnar July 7, 2017, 9:32 a.m. UTC
* Ingo Molnar <mingo@kernel.org> wrote:

> 
> * Peter Zijlstra <peterz@infradead.org> wrote:
> 
> > > It might even be that this is the defined semantics of spin_unlock_wait().
> > 
> > As is, spin_unlock_wait() is somewhat ill defined. IIRC it grew from an 
> > optimization by Oleg and subsequently got used elsewhere. And it being the 
> > subtle bugger it is, there were bugs.
> 
> I believe the historical, original spin_unlock_wait() came from early SMP 
> optimizations of the networking code - and then spread elsewhere, step by step. 
> All but one of the networking uses went away since then - so I don't think there's 
> any original usecase left.

No - the original usecase was task teardown: I still remembered that but didn't 
find the commit - but it's there in very old Linux kernel patches, done by DaveM 
originally in v2.1.36 (!):

[hard]irq_enter() was the second user, net_family_read_lock() was the third user, 
followed by more uses in networking. All but one of those are not present in the 
current upstream kernel anymore.

This task-teardown FIXME was fixed in v2.1.114 (was replaced by an open coded poll 
loop), but the spin_unlock_wait() primitive remained.

The rest is history! ;-)

Thanks,

	Ingo
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -136,6 +136,12 @@  void release(struct task_struct * p)
        }
        for (i=1 ; i<NR_TASKS ; i++)
                if (task[i] == p) {
+#ifdef __SMP__
+                       /* FIXME! Cheesy, but kills the window... -DaveM */
+                       while(p->processor != NO_PROC_ID)
+                               barrier();
+                       spin_unlock_wait(&scheduler_lock);
+#endif


Other code learned to use spin_unlock_wait(): the original version of