Re: [patch] user-vm-unlock-2.5.31-A2

From: Ingo Molnar (mingo@elte.hu)
Date: Thu Aug 15 2002 - 18:01:21 EST


> personally i'd make it even more compact by merging the two clone flags
> as well, something along: CLONE_MANAGE_TID. I cannot see any reason for
> a thread library to use one of the bits only. This also reflects the
> fact that it's thread state that the kernel helps managing, both in the
> thread-create and in the thread-exit path. But this might be stretching
> things a bit?

the attached patch implements this. (ontop the previous patch.)

        Ingo

--- linux/arch/i386/kernel/process.c.orig Fri Aug 16 01:01:27 2002
+++ linux/arch/i386/kernel/process.c Fri Aug 16 01:02:03 2002
@@ -591,7 +591,7 @@
         /*
          * The common fastpath:
          */
- if (!(clone_flags & (CLONE_SETTLS | CLONE_SETTID | CLONE_CLEARTID)))
+ if (!(clone_flags & (CLONE_SETTLS | CLONE_MANAGE_TID)))
                 return 0;
         /*
          * Set a new TLS for the child thread?
@@ -616,17 +616,13 @@
         }
 
         /*
- * Notify the child of the TID?
+ * Notify the child of the TID, and clear it on exit?
          */
- if (clone_flags & CLONE_SETTID)
+ if (clone_flags & CLONE_MANAGE_TID) {
                 if (put_user(p->pid, (pid_t *)childregs->edx))
                         return -EFAULT;
-
- /*
- * Does the userspace VM want the TID cleared on mm_release()?
- */
- if (clone_flags & CLONE_CLEARTID)
                 p->user_tid = (long *) childregs->edx;
+ }
         return 0;
 }
 
--- linux/include/linux/sched.h.orig Fri Aug 16 01:00:33 2002
+++ linux/include/linux/sched.h Fri Aug 16 01:01:19 2002
@@ -46,10 +46,8 @@
 #define CLONE_NEWNS 0x00020000 /* New namespace group? */
 #define CLONE_SYSVSEM 0x00040000 /* share system V SEM_UNDO semantics */
 #define CLONE_SETTLS 0x00080000 /* create a new TLS for the child */
-#define CLONE_SETTID 0x00100000 /* write the TID back to userspace */
-#define CLONE_CLEARTID 0x00200000 /* clear the userspace TID */
-#define CLONE_DETACHED 0x00400000 /* parent wants no child-exit signal */
-#define CLONE_RELEASE_VM 0x00800000 /* release the userspace VM */
+#define CLONE_MANAGE_TID 0x00100000 /* set and clear the userspace TID */
+#define CLONE_DETACHED 0x00200000 /* parent wants no child-exit signal */
 
 #define CLONE_SIGNAL (CLONE_SIGHAND | CLONE_THREAD)
 

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Aug 15 2002 - 22:00:41 EST