public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Oleg Nesterov <oleg@tv-sign.ru>
Cc: ebiederm@xmission.com, mingo@elte.hu,
	torvalds@linux-foundation.org, roland@redhat.com,
	linux-kernel@vger.kernel.org, "Rafael J. Wysocki" <rjw@sisk.pl>
Subject: Re: [PATCH 1/3] introduce PF_KTHREAD flag
Date: Mon, 23 Jun 2008 13:40:37 -0700	[thread overview]
Message-ID: <20080623134037.8566f651.akpm@linux-foundation.org> (raw)
In-Reply-To: <20080601153042.GA8238@tv-sign.ru>

On Sun, 1 Jun 2008 19:30:42 +0400
Oleg Nesterov <oleg@tv-sign.ru> wrote:

> Introduce the new PF_KTHREAD flag to mark the kernel threads. It is set by
> INIT_TASK() and copied to the forked childs (we could set it in kthreadd()
> along with PF_NOFREEZE instead).
> 
> daemonize() was changed as well. In that case testing of PF_KTHREAD is racy,
> but daemonize() is hopeless anyway.
> 
> This flag is cleared in do_execve(), before search_binary_handler(). Probably
> not the best place, we can do this in exec_mmap() or in start_thread(), or
> clear it along with PF_FORKNOEXEC. But I think this doesn't matter in practice,
> and if do_execve() fails kthread should die soon.
> 
> Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
> 
>  include/linux/sched.h     |    1 +
>  include/linux/init_task.h |    2 +-
>  kernel/exit.c             |    2 +-
>  fs/exec.c                 |    1 +
>  4 files changed, 4 insertions(+), 2 deletions(-)
> 
> --- 26-rc2/include/linux/sched.h~2_MAKE_PF_KTHREAD	2008-05-18 15:44:16.000000000 +0400
> +++ 26-rc2/include/linux/sched.h	2008-05-18 20:08:13.000000000 +0400
> @@ -1508,6 +1508,7 @@ static inline void put_task_struct(struc
>  #define PF_MEMPOLICY	0x10000000	/* Non-default NUMA mempolicy */
>  #define PF_MUTEX_TESTER	0x20000000	/* Thread belongs to the rt mutex tester */
>  #define PF_FREEZER_SKIP	0x40000000	/* Freezer should not count it as freezeable */
> +#define PF_KTHREAD	0x80000000	/* I am a kernel thread */

Well "Freezer: Introduce PF_FREEZER_NOSIG" has cheerily come in
afterwards and stolen 0x80000000 from us.  I'll redo this patch to use,
umm, 0x00000020.  Please check that this is OK (if it isn't someone
needs thwapping for not adding a dont-use-this comment).


  parent reply	other threads:[~2008-06-23 20:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-01 15:30 [PATCH 1/3] introduce PF_KTHREAD flag Oleg Nesterov
2008-06-03 21:14 ` Andrew Morton
2008-06-04 17:44   ` Oleg Nesterov
2008-06-23 20:40 ` Andrew Morton [this message]
2008-06-23 20:47   ` Andrew Morton
2008-06-23 20:52     ` Andrew Morton
2008-06-23 21:36       ` Rafael J. Wysocki
2008-06-23 21:52         ` Andrew Morton
2008-06-24 13:42       ` Oleg Nesterov
2008-06-24 20:51         ` Rafael J. Wysocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080623134037.8566f651.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=ebiederm@xmission.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=oleg@tv-sign.ru \
    --cc=rjw@sisk.pl \
    --cc=roland@redhat.com \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox