Re: how to use errno in kernel loadable modules

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,On 12/30/05, Arjan van de Ven <arjan@xxxxxxxxxxxxx> wrote:> On Fri, 2005-12-30 at 15:39 +0530, Parag N(पराग़) wrote:> > Hi,> >> > On 12/30/05, Tetsuo Handa <from-kernelnewbies@xxxxxxxxxxxxxxxxxxx> wrote:> > > Hi,> > >> > > kishore wrote:> > > >     I am using kmalloc in my module. It returned NULL; by that i understood> > > > there may be some scarcity in allocating the requested amount of memory ( i> > > > requested for 64 bytes). I returned -ENOMEM, but i thought there may be some> > > > way to return error number rather than what am using.> > > The kmalloc() can allocate up to 128 Kilo Bytes.> > > Allocation for only 64 Bytes SHOULD NOT FAIL!> > > I doubt you passed wrong parameters to kmalloc().> > >> >      I think you have to use kmalloc(64,GFP_ATOMIC) then u will not> > get any memory allocation error.>> GFP_ATOMIC allocations are MORE likely to fail actually!> (and are also more likely to bring the VM into big trouble so should be> avoided if at all possible)>>   What leads me to think to use GFP_ATOMIC is following explanation for flagsGFP_ATOMIC 	The allocation is high-priority and does not sleep. Thisis the flag to use in interrupt handlers, bottom halves and othersituations where you cannot sleep.GFP_KERNEL 	This is a normal allocation and might block. This is theflag to use in process context code when it is safe to sleep.        If kmalloc fails for allocating memory thru' GFP_KERNEL whichmight be case of blocking request of kmalloc then i thought to usehigh priority allocation flag.If i am wrong correct me.Regards,Parag.��������!���W��v������ޗ��{��f������ޖw�n'�������Y�����


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux