Re: [linux-pm] [PATCH] Threads shouldn't inherit PF_NOFREEZE

From: Nigel Cunningham (ncunningham_at_cyclades.com)
Date: 10/19/05

  • Next message: Badari Pulavarty: "Re: Is ext3 flush data to disk when files are closed?"
    To: Alan Stern <stern@rowland.harvard.edu>
    Date:	Thu, 20 Oct 2005 07:01:17 +1000
    
    

    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

    -- 
    -
    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/
    

  • Next message: Badari Pulavarty: "Re: Is ext3 flush data to disk when files are closed?"

    Relevant Pages

    • [PATCH] Threads shouldnt inherit PF_NOFREEZE
      ... This patch removes the flag from the child. ... they inherit the PF_NOFREEZE flag. ... the kernel threads are not getting frozen as they ought to be. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • RE: Verifying if ntfs files/folders rights are inherited or not...
      ... RE-APPLY the same security (remove the inherit from parent flag from the ... I don't know how to manipulate the ace flags to know if the ... For child objects that are containers, ...
      (microsoft.public.scripting.vbscript)
    • Re: Removal of inherited aces
      ... SetNamedSecurityInfo flag PROTECTED_DACL_SECURITY_INFORMATION. ... So you are in effect choosing not to inherit the ACEs and then wondering why ... ACE for X, the inherited ACEs on B and C remain in place. ... Is there any other way to set a DACL exactly as specified other than ...
      (microsoft.public.platformsdk.security)
    • Re: File handle inheritance with "independent" sessions?
      ... You can start an independent session and still choose to inherit the parent's environment or not ... Ilya Zakharevich schrieb: ... I always thought that /I switch of START command corresponds to this flag. ...
      (comp.os.os2.programmer.misc)