malloc() in kernel and increasing mbuf and cluster size

From: kamal kc (kamal_ckk_at_yahoo.com)
Date: 10/17/05

  • Next message: kamal kc: "Re: malloc() in kernel and increasing mbuf and cluster size"
    Date: Mon, 17 Oct 2005 04:49:01 -0700 (PDT)
    To: freebsd-net@freebsd.org
    
    

    this may be a trivial question for many of you
    but i am confused in doing memory allocation in the
    kernel.

    sys/malloc.h has function prototypes for malloc()
    kern/kern_malloc.c defines the malloc()

    the malloc() definition is

    void *
    malloc(size, type, flags)
            unsigned long size;
            struct malloc_type *type;
            int flags;

    i understand the size and flags but what shall i
    do with the malloc_type.

    suppose i want to allocate 1024 bytes then how
    should i call the malloc ?

    i set -->
        size=1024
        flags=M_WAITOK
         type=???? (i don't know what/how to initialize
                  the type)

    Next thing is that i want to make the kernel process
    network packets very fast.
    i think of increasing the mbuf and cluster size.

    i want to if there will be any effect on increasing
    the mbuf and cluster size.

    what would be an appropriate size of mbuf and cluster
    if I use
     i. 512 MB RAM
     iI. 1024 MB RAM
     
    which parts of the kernel will be affected by
    changing the mbuf and cluster size ?

    i think somebody maybe able to help me.

    thanks folks.
    kamal

                    
    __________________________________
    Yahoo! Music Unlimited
    Access over 1 million songs. Try it free.
    http://music.yahoo.com/unlimited/
    _______________________________________________
    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: kamal kc: "Re: malloc() in kernel and increasing mbuf and cluster size"

    Relevant Pages

    • malloc() in kernel and increasing mbuf and cluster size
      ... sys/malloc.h has function prototypes for malloc ... Next thing is that i want to make the kernel process ... i think of increasing the mbuf and cluster size. ...
      (freebsd-net)
    • Re: kmem leak in tmpmfs?
      ... I think) kernel should not allow disk creation in first place, ... This limits the size to the malloc bucket ... Use a swap backed disk and the problem will disappear. ...
      (freebsd-stable)
    • Re: [PATCH] nommu arch dont zero the anonymous mapping by adding UNINITIALIZE flag
      ... > malloc a big area, memsetthe area to zero makes the performance very bad. ... My theory is that NOMMU binaries should run just as well under an MMU-mode ... kernel as under a NOMMU kernel. ... memset(base + ret, 0, len - ret); ...
      (Linux-Kernel)
    • Re: [2.4.26] overcommit_memory documentation clarification
      ... > obtain virtual address space) reserves memory or not. ... But the documentation is wrong (on an official 2.4.26 kernel). ... It seems that there is no way to get malloc() always return 0 ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: NTFS - Kernel memory leak in driver for kernel 2.4.28?
      ... so the kernel does not free any of the missing RAM for ... Whatever program is using malloc() is either corrupting ... its buffers or has a memory leak. ... Mallocwill always succeed even if the kernel has no ...
      (Linux-Kernel)