Removing kernel thread stack swapping

From: David Schultz (das_at_FreeBSD.ORG)
Date: 03/03/05

  • Next message: Ryan Sommers: "Re: Removing kernel thread stack swapping"
    Date: Thu, 3 Mar 2005 02:42:42 -0500
    To: arch@FreeBSD.ORG
    
    

    Any objections to the idea of removing the feature of swapping out
    kernel stacks? Unlike disabling UAREA swapping, this has the
    small downside that it wastes 16K (give or take a power of 2) of
    wired memory per kernel thread that we would otherwise have
    swapped out. However, this disadvantage is probably negligible by
    today's standards, and there are several advantages:

    1. David Xu found that some kernel code stores externally-accessible
       data structures on the stack, then goes to sleep and allows the
       stack to become swappable. This can result in a kernel panic.

    2. We don't know how many instances of the above problem there are.
       Selectively disabling swapping for the right threads at the
       right times would decrease maintainability.

    3. Thread stack swapping doesn't work very well anymore anyway.
       KSE introduced the idea that a process could have multiple
       kernel threads and hence multiple kernel stacks, but the
       swapper was not taught about this very well. All the threads
       in a process get swapped out at the same time, and this only
       happens if all the threads happen to be swappable at the same time.

    4. The code isn't well maintained. That's not to say that it
       doesn't work, but it's conceivable that changes in locking
       elsewhere might introduce new bugs. What if swapout races
       with exit() while the latter is trying to kill off the threads
       in the process, for instance? If there were a bug, it could
       be very difficult to reproduce and track down.

    At least for now, I would retain the swapper daemon and its
    medium-term scheduling feature. (That is, under high load, it
    could mark some processes as unrunnable, thereby reducing
    contention and allowing their user space pages to be paged out.)
    This feature does not add much complexity to other parts of the
    kernel. If it turns out not to be very useful by itself, it can
    be removed later, but I'm not as zealous with the axe as phk. ;-)
    _______________________________________________
    freebsd-arch@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-arch
    To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.org"


  • Next message: Ryan Sommers: "Re: Removing kernel thread stack swapping"

    Relevant Pages

    • [Full-disclosure] PHRACK 64: ATTACKING THE CORE
      ... - The Slab Allocator ... - Slab overflow exploiting: ... - Forcing a kernel path to sleep ... - Stack Frame Flow Recovery ...
      (Full-Disclosure)
    • Re: Removing kernel thread stack swapping
      ... Unlike disabling UAREA swapping, this has the ... >> wired memory per kernel thread that we would otherwise have ... >> stack to become swappable. ... The swapper sets a flag on threads that are unswappable. ...
      (freebsd-arch)
    • Re: [Bug #11342] Linux 2.6.27-rc3: kernel BUG at mm/vmalloc.c - bisected
      ... stack usages for you is that they contain a 'cpumask_t' on the stack. ... We can enable MAXSMP and raise the CPU limits some time in the future. ... not accept a specially built kernel, but only a kernel that has been ... know how extensively these distributions test and certify for many known ...
      (Linux-Kernel)
    • Re: Interrupt context...
      ... > gone through most of the posts on interrupt in usenet. ... > kernel stack and ISR is executed. ... More may be saved depending on the architecture. ... Here the kernel have assembler code to save all general ...
      (comp.os.linux.development.system)
    • Re: The Linux Staging tree, what it is and is not.
      ... if you compromize them and write the wrong ones to the stack, ... Load two user space fieldbus stacks on the same network card (remembering ... right, but that's the same, no matter if it runs in kernel or user ... need an objdict API to userspace...? ...
      (Linux-Kernel)