public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Nigel Cunningham <ncunningham@cyclades.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Andrew Morton <akpm@osdl.org>,
	Rusty Russell <rusty@rustcorp.com.au>,
	Linus Torvalds <torvalds@osdl.org>, Pavel Machek <pavel@ucw.cz>,
	Linux-pm mailing list <linux-pm@lists.osdl.org>,
	Kernel development list <linux-kernel@vger.kernel.org>
Subject: Re: [linux-pm] [PATCH] Threads shouldn't inherit PF_NOFREEZE
Date: Thu, 20 Oct 2005 07:01:17 +1000	[thread overview]
Message-ID: <1129755676.4577.51.camel@localhost> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0510181515450.4518-100000@iolanthe.rowland.org>

Hi Alan.

On Wed, 2005-10-19 at 05:29, Alan Stern wrote:
> The PF_NOFREEZE process flag should not be inherited when a thread is 
> forked.  This patch (as585) removes the flag from the child.
> 
> This problem is starting to show up more and more as drivers turn to the
> kthread API instead of using kernel_thread().  As a result, their kernel
> threads are now children of the kthread worker instead of modprobe, and
> they inherit the PF_NOFREEZE flag.  This can cause problems during system
> suspend; the kernel threads are not getting frozen as they ought to be.
> 
> Alan Stern

I have this in kthread instead, so that multithreaded userspace
processes only need to have NOFREEZE set once (before forking). Yes, I
have one that fits this scenario - I'm working on a userspace storage
maanger, which will setup and tear down a network connection at
appropriate times during a suspend-to-disk cycle. The initial version is
based on nbd and uses two threads because the one that sets up storage
blocks in a syscall as Pavel & others have written it.

Anyway, I agree that the general need you're trying to address is real.

Regards,

Nigel

> 
> 
> Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
> 
> ---
> 
> What I said above may not be quite true.  For all I know, there may be
> threads which rely on inheriting PF_NOFREEZE from their parent.  But it
> should not be inherited by default.
> 
> Index: usb-2.6/kernel/fork.c
> ===================================================================
> --- usb-2.6.orig/kernel/fork.c
> +++ usb-2.6/kernel/fork.c
> @@ -848,7 +848,7 @@ static inline void copy_flags(unsigned l
>  {
>  	unsigned long new_flags = p->flags;
>  
> -	new_flags &= ~PF_SUPERPRIV;
> +	new_flags &= ~(PF_SUPERPRIV | PF_NOFREEZE);
>  	new_flags |= PF_FORKNOEXEC;
>  	if (!(clone_flags & CLONE_PTRACE))
>  		p->ptrace = 0;
> 
> 
> ______________________________________________________________________
> _______________________________________________
> linux-pm mailing list
> linux-pm@lists.osdl.org
> https://lists.osdl.org/mailman/listinfo/linux-pm
-- 



      reply	other threads:[~2005-10-19 21:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-18 19:29 [PATCH] Threads shouldn't inherit PF_NOFREEZE Alan Stern
2005-10-19 21:01 ` Nigel Cunningham [this message]

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=1129755676.4577.51.camel@localhost \
    --to=ncunningham@cyclades.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@lists.osdl.org \
    --cc=pavel@ucw.cz \
    --cc=rusty@rustcorp.com.au \
    --cc=stern@rowland.harvard.edu \
    --cc=torvalds@osdl.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