Re: how can I get the meminfo of each kernel process?

From: Robert Watson (rwatson_at_FreeBSD.org)
Date: 05/30/05

  • Next message: Giorgos Keramidas: "Re: how can I get the meminfo of each kernel process?"
    Date: Mon, 30 May 2005 13:01:39 +0100 (BST)
    To: littlegege@263.net
    
    

    On Mon, 30 May 2005 littlegege@263.net wrote:

    > I want to get the meminfo of each kernel process,such as how much memory
    > size is allocated to a process.How can i do? I will do this in kernel
    > space,so which data structure can i used to achieve this.

    Kernel processes are a bit of a misnomer -- in general, they actually
    represent individual threads running in a single kernel address space. As
    such, memory is typically not owned by the kernel process, it's owned by
    the kernel as a whole. Normally, the approach taken is to track memory
    owned by individual kernel subsystems, which can (in most cases) be done
    using a combination of "vmstat -m" and "vmstat -z". Since individual
    threads may enter many different subsystems, and the largest volumes of
    memory are actually typically handed off between several threads (i.e.,
    network packet buffers), this can provide better insight into memory use
    in the kernel.

    There are plans, in the future, to start using pure threads without
    associated kernel processes in the kernel, which will reduce overhead as
    well as make it more clear that kernel threads generally operate within a
    single process (task) address space.

    If you're interested in tracking memory allocation and use for specific
    kernel threads, you might want to look at ktr(4), which is a general
    kernel tracing primitive, and has hooks into the various kernel memory
    allocators to track memory allocation and free events.

    Robert N M Watson
    _______________________________________________
    freebsd-hackers@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
    To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"


  • Next message: Giorgos Keramidas: "Re: how can I get the meminfo of each kernel process?"

    Relevant Pages