Re: Checking of NULL with __GFP_NOFAIL in kzalloc()

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

 



On Sun, Mar 1, 2009 at 2:52 PM, Durga Prasad <writexdp@xxxxxxxxx> wrote:
> What happens in a situation where there is no allocatable memory? Allocator
> would return NULL, isn't it ?

>From gfp.h, these are the semantics.

 * __GFP_NOFAIL: The VM implementation _must_ retry infinitely: the caller
 * cannot handle allocation failures.

Thanks -
Manish


>
>
>
> ________________________________
> From: Manish Katiyar <mkatiyar@xxxxxxxxx>
> To: Kernelnewbies <kernelnewbies@xxxxxxxxxxxx>
> Sent: Sunday, March 1, 2009 2:09:13 PM
> Subject: Checking of NULL with __GFP_NOFAIL in kzalloc()
>
> Hi,
>
> While going through jbd code, I was wondering why do we need to check
> new_transaction for NULL, if we are passing __GFP_NOFAIL ?
> Last code change around this code was when Ted converted kmalloc to
> kzalloc, but since he also didn't remove it I am guessing there would
> be some good reason for it. Can someone enlighten me ?
>
> start_this_handle() {
> ..........
>        ..........
>        new_transaction = kzalloc(sizeof(*new_transaction),
>                        GFP_NOFS|__GFP_NOFAIL);
>        if (!new_transaction) {
>                ret = -ENOMEM;
>                goto out;
>        }
>        ..........
> }
>
>
> Thanks -
> Manish
>
> --
> To unsubscribe from this list: send an email with
> "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
> Please read the FAQ at http://kernelnewbies.org/FAQ
>
>
>

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ



[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