PERFORCE change 113673 for review

Roman Divacky rdivacky at FreeBSD.org
Mon Jan 29 20:33:32 UTC 2007


http://perforce.freebsd.org/chv.cgi?CH=113673

Change 113673 by rdivacky at rdivacky_witten on 2007/01/29 20:33:26

	o	dont set p->p_emuldata to NULL when the process is exiting.
		it doesnt make any sense and only costs us 2 mtx operations.
	o	dont lock emul_data to unlock it on the very next line. it
		doesnt serve any purpose and only slow things down. There might
		be race though, I am not sure and this needs some checking. Add
		a comment about it.

Affected files ...

.. //depot/projects/linuxolator/src/sys/compat/linux/linux_emul.c#27 edit

Differences ...

==== //depot/projects/linuxolator/src/sys/compat/linux/linux_emul.c#27 (text+ko) ====

@@ -167,10 +167,6 @@
 	EMUL_SHARED_WLOCK(&emul_shared_lock);
 	LIST_REMOVE(em, threads);
 
-	PROC_LOCK(p);
-	p->p_emuldata = NULL;
-	PROC_UNLOCK(p);
-
 	em->shared->refs--;
 	if (em->shared->refs == 0)
 		free(em->shared, M_LINUX);
@@ -241,12 +237,15 @@
 	    && p->p_sysent == &elf_linux_sysvec)) {
 		struct linux_emuldata *em;
 
-		em = em_find(p, EMUL_DOLOCK);
+		/* 
+		 * XXX: is it racy? if p->p_sysent still points at linux_sysvec
+		 * it is. someone please check this. we were running with
+		 * this race for quite a long time though.
+		 */
+		em = em_find(p, EMUL_DONTLOCK);
 
 		KASSERT(em != NULL, ("proc_exec: emuldata not found.\n"));
 
-		EMUL_UNLOCK(&emul_lock);
-
 		EMUL_SHARED_WLOCK(&emul_shared_lock);
 		LIST_REMOVE(em, threads);
 


More information about the p4-projects mailing list