Re: Kernel stack

From: aq (aquynh_at_gmail.com)
Date: 10/12/04

  • Next message: Ingo Molnar: "Re: [patch] VP-2.6.9-rc4-mm1-T6"
    Date:	Tue, 12 Oct 2004 21:30:54 +0900
    To: Jan Hudec <bulb@ucw.cz>
    
    

    > > >From what you all discuss, I can say: kernel memory is devided into 2
    > > part, and the upper part are shared between processes. The below part
    > > (the kernel stack, or 8K traditionally) is specifict for each process.
    > >
    > > Is that right?
    >
    > No, it's not. There is just one kernel memory. In it each process has
    > it's own task_struct + kernel stack (by default 8K). There is no special
    > address mapping for these, nor are they allocated from a special area.
    >
    > When a context of some process is entered, esp is pointed to the top of
    > it's stack. That's exactly all it takes to exchange stacks.

    OK, lets say there are 20 processes running in the system. Then the
    kernel must allocate 20 * 8K = 160K just for the stacks of these
    processes. All of these 160K always occupy the kernel (kernel memory
    is never swapped out). When a process actives, ESP would switch to
    point to the corresponding stack (of that process).

    The remainding memory of kernel therefore is equally accessible to all
    the processes.

    Is that correct ?

    Thank you,
    AQ
    -
    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: Ingo Molnar: "Re: [patch] VP-2.6.9-rc4-mm1-T6"

    Relevant Pages

    • Re: Kernel stack
      ... There is just one kernel memory. ... When a process actives, ESP would switch to ... > point to the corresponding stack. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [x86] Access off the bottom of stack causes a segfault?
      ... > My compiler is generating accesses off the bottom of the stack (address ... > below %esp). ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [x86] Access off the bottom of stack causes a segfault?
      ... Why exactly is accessing the stack below %esp always a bug? ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: 4k stacks in 2.6
      ... > at the bottom of the stack and is referenced by masking bits off %esp. ... > So the stack size must be constant whether in process context or IRQ ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: kernel stack challenge
      ... > having current stack pointer. ... > interrupt occures. ... so with the proper masking of %esp you can get to the ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)