kmalloc usage question

From: cranium2003 (cranium2003_at_yahoo.com)
Date: 01/08/05

  • Next message: Greg KH: "Re: [PATCH] USB and Driver Core patches for 2.6.10"
    Date:	Sat, 8 Jan 2005 01:17:28 -0800 (PST)
    To: linux-kernel@vger.kernel.org
    
    

    Hello,
         I read kmalloc kernel-api.pdf page and found that

     * %GFP_USER - Allocate memory on behalf of user. May
    sleep.
     *
     * %GFP_KERNEL - Allocate normal kernel ram. May
    sleep.
     *
     * %GFP_ATOMIC - Allocation will not sleep. Use
    inside interrupt handlers.
    What i want to know if i write a Device driver that
    has kmalloc statements require allocate some string
    variable then which flag i should use?
    As apis said GFP_USER. But if i want my kernel module
    to be require to work in kernel always then can it be
    ok to use GFP_KERNEL??
    What are then disadvantages to that???
    regards,
    cranium

                    
    __________________________________
    Do you Yahoo!?
    The all-new My Yahoo! - Get yours free!
    http://my.yahoo.com
     

    -
    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: Greg KH: "Re: [PATCH] USB and Driver Core patches for 2.6.10"

    Relevant Pages

    • Re: [Lhms-devel] RE: memory hotremove prototype, take 3
      ... > address without needing to do anything more than allocate a page frame ... IA32 kernel often uses __PAGE_OFFSET. ... Even if we use Mr. Iwamoto's method use, some memories will remain. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: 2.6.4, or what I still dont quite like about the new stable branch
      ... > virtually nonexistent in the kernel source package and while I suppose I ... And if you want to put your system to sleep, you must put to sleep all ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • serverworks usb under 2.4.22
      ... board uses the Serverworks chipset and the 2.4.22 kernel is unable to ... allocate an IRQ when initializing the USB interface. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Why "PCI: Cannot allocate resource region..."?
      ... I didn't get any response to my previous query, so I figured I'd ask a ... why would the kernel say that it cannot allocate a ... *does* the kernel decide it can't do the allocation? ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: select(0,NULL,NULL,NULL,&t1) used for delay
      ... The mainline kernel can't sleep for that small an interval ... so there's not really any difference in sleep precision between ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)