public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch 2/2] clone: prepare to recycle CLONE_DETACHED and CLONE_STOPPED
@ 2007-11-08 21:31 akpm
  2007-11-08 22:09 ` Roland McGrath
  2007-11-09  4:36 ` Andrew Morton
  0 siblings, 2 replies; 3+ messages in thread
From: akpm @ 2007-11-08 21:31 UTC (permalink / raw)
  To: linux-kernel; +Cc: akpm, drepper, mingo, roland

From: Andrew Morton <akpm@linux-foundation.org>

Ulrich says that we never used these clone flags and that nothing should be
using them.

As we're down to only a single bit left in clone's flags argument, let's add a
warning to check that no userspace is actually using these.  Hopefully we will
be able to recycle them.

Cc: Ulrich Drepper <drepper@redhat.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Roland McGrath <roland@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 kernel/fork.c |   16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff -puN kernel/fork.c~clone-prepare-to-recycle-clone_detached-and-clone_stopped kernel/fork.c
--- a/kernel/fork.c~clone-prepare-to-recycle-clone_detached-and-clone_stopped
+++ a/kernel/fork.c
@@ -1420,10 +1420,18 @@ long do_fork(unsigned long clone_flags,
 	int trace = 0;
 	long nr;
 
-	if (unlikely(current->ptrace)) {
-		trace = fork_traceflag (clone_flags);
-		if (trace)
-			clone_flags |= CLONE_PTRACE;
+	/*
+	 * We hope to recycle these flags after 2.6.26
+	 */
+	if (unlikely(clone_flags & (CLONE_DETACHED|CLONE_STOPPED))) {
+		if (printk_ratelimit()) {
+			char comm[TASK_COMM_LEN];
+
+			printk(KERN_INFO "fork(): process `%s' used deprecated "
+					"clone flags 0x%lx\n",
+				get_task_comm(comm, current),
+				clone_flags & (CLONE_DETACHED|CLONE_STOPPED));
+		}
 	}
 
 	p = copy_process(clone_flags, stack_start, regs, stack_size,
_

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch 2/2] clone: prepare to recycle CLONE_DETACHED and CLONE_STOPPED
  2007-11-08 21:31 [patch 2/2] clone: prepare to recycle CLONE_DETACHED and CLONE_STOPPED akpm
@ 2007-11-08 22:09 ` Roland McGrath
  2007-11-09  4:36 ` Andrew Morton
  1 sibling, 0 replies; 3+ messages in thread
From: Roland McGrath @ 2007-11-08 22:09 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, drepper, mingo

CLONE_STOPPED was previously used by some NTPL versions when under
thread_db (i.e. only when being actively debugged by gdb), but not for a
long time now, and it never worked reliably when it was used.
Removing it seems fine to me.


Thanks,
Roland

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch 2/2] clone: prepare to recycle CLONE_DETACHED and CLONE_STOPPED
  2007-11-08 21:31 [patch 2/2] clone: prepare to recycle CLONE_DETACHED and CLONE_STOPPED akpm
  2007-11-08 22:09 ` Roland McGrath
@ 2007-11-09  4:36 ` Andrew Morton
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Morton @ 2007-11-09  4:36 UTC (permalink / raw)
  To: linux-kernel, drepper, mingo, roland

> On Thu, 08 Nov 2007 13:31:43 -0800 akpm@linux-foundation.org wrote:
> From: Andrew Morton <akpm@linux-foundation.org>
> 
> Ulrich says that we never used these clone flags and that nothing should be
> using them.
> 
> As we're down to only a single bit left in clone's flags argument, let's add a
> warning to check that no userspace is actually using these.  Hopefully we will
> be able to recycle them.
> 
> Cc: Ulrich Drepper <drepper@redhat.com>
> Cc: Ingo Molnar <mingo@elte.hu>
> Cc: Roland McGrath <roland@redhat.com>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
> 
>  kernel/fork.c |   16 ++++++++++++----
>  1 file changed, 12 insertions(+), 4 deletions(-)
> 
> diff -puN kernel/fork.c~clone-prepare-to-recycle-clone_detached-and-clone_stopped kernel/fork.c
> --- a/kernel/fork.c~clone-prepare-to-recycle-clone_detached-and-clone_stopped
> +++ a/kernel/fork.c
> @@ -1420,10 +1420,18 @@ long do_fork(unsigned long clone_flags,
>  	int trace = 0;
>  	long nr;
>  
> -	if (unlikely(current->ptrace)) {
> -		trace = fork_traceflag (clone_flags);
> -		if (trace)
> -			clone_flags |= CLONE_PTRACE;
> +	/*
> +	 * We hope to recycle these flags after 2.6.26
> +	 */
> +	if (unlikely(clone_flags & (CLONE_DETACHED|CLONE_STOPPED))) {
> +		if (printk_ratelimit()) {
> +			char comm[TASK_COMM_LEN];
> +
> +			printk(KERN_INFO "fork(): process `%s' used deprecated "
> +					"clone flags 0x%lx\n",
> +				get_task_comm(comm, current),
> +				clone_flags & (CLONE_DETACHED|CLONE_STOPPED));
> +		}
>  	}
>  
>  	p = copy_process(clone_flags, stack_start, regs, stack_size,

That was all screwed up.  Better version:

From: Andrew Morton <akpm@linux-foundation.org>

Ulrich says that we never used these clone flags and that nothing should be
using them.

As we're down to only a single bit left in clone's flags argument, let's add a
warning to check that no userspace is actually using these.  Hopefully we will
be able to recycle them.

Roland said:

  CLONE_STOPPED was previously used by some NTPL versions when under
  thread_db (i.e.  only when being actively debugged by gdb), but not for a
  long time now, and it never worked reliably when it was used.  Removing it
  seems fine to me.

Cc: Ulrich Drepper <drepper@redhat.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Roland McGrath <roland@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 kernel/fork.c |   17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff -puN kernel/fork.c~clone-prepare-to-recycle-clone_detached-and-clone_stopped kernel/fork.c
--- a/kernel/fork.c~clone-prepare-to-recycle-clone_detached-and-clone_stopped
+++ a/kernel/fork.c
@@ -1420,6 +1420,23 @@ long do_fork(unsigned long clone_flags,
 	int trace = 0;
 	long nr;
 
+	/*
+	 * We hope to recycle these flags after 2.6.26
+	 */
+	if (unlikely(clone_flags & (CLONE_DETACHED|CLONE_STOPPED))) {
+		static int __read_mostly count = 100;
+
+		if (count && printk_ratelimit()) {
+			char comm[TASK_COMM_LEN];
+
+			count--;
+			printk(KERN_INFO "fork(): process `%s' used deprecated "
+					"clone flags 0x%lx\n",
+				get_task_comm(comm, current),
+				clone_flags & (CLONE_DETACHED|CLONE_STOPPED));
+		}
+	}
+
 	if (unlikely(current->ptrace)) {
 		trace = fork_traceflag (clone_flags);
 		if (trace)
_


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-11-09  4:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-08 21:31 [patch 2/2] clone: prepare to recycle CLONE_DETACHED and CLONE_STOPPED akpm
2007-11-08 22:09 ` Roland McGrath
2007-11-09  4:36 ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox