[lkml]   [2010]   [May]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: [PATCH] fs: use kmalloc() to allocate fdmem if possible
    Le lundi 03 mai 2010 à 11:49 +0300, Avi Kivity a écrit :

    > A kmalloc()ed page is virtually contiguous, satisfying your requirement.

    Still, a different function pair is needed, at least for documentation

    Changli, _many_ patches like yours were suggested and refused in the
    past for the reason it should be generic. Maybe its time...

    So first introduce a pair of funtions, then we can use them.

    At free time we can use is_vmalloc_addr() so that no extra bit is needed
    to tell if a zone was vmalloced() or kmalloced()

    One remark :

    + data = kmalloc(size, GFP_KERNEL);

    If allocation fails (because of fragmentation), we would have a kernel
    Still, vmalloc() might be OK.
    So you should add a __GFP_NOWARN flag.

    * Warning: if size is not a power of two, kmalloc() might
    * waste memory because of its requirements.
    void *kvmalloc(size_t size)
    void *ptr = kmalloc(size, GFP_KERNEL | __GFP_NOWARN);

    if (ptr)
    return ptr;
    return vmalloc(size);

    void kvfree(void *ptr)
    if (is_vmalloc_addr(ptr))

    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    More majordomo info at
    Please read the FAQ at

     \ /
      Last update: 2010-05-03 11:17    [W:0.020 / U:106.116 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site