Re: [PATCH] fs: use kmalloc() to allocate fdmem if possible

Avi Kivity
2010-05-03T08:50:28Z

On 05/03/2010 10:52 AM, Changli Gao wrote:
> On Mon, May 3, 2010 at 3:42 PM, Avi Kivity<avi@redhat.com> wrote:
>
>> On 05/03/2010 10:05 AM, Changli Gao wrote:
>>
>>> On Mon, May 3, 2010 at 2:06 PM, Avi Kivity<avi@redhat.com> wrote:
>>>
>>>
>>>> My point is, vmalloc() and vfree should do this, not their callers:
>>>>
>>>> vmalloc(size):
>>>> if (size<= PAGE_SIZE)
>>>> return kmalloc(size, GFP_KERNEL);
>>>> ...
>>>>
>>>> vfree(p):
>>>> if (!is_vmalloc_addr(p) {
>>>> kfree(p);
>>>> return;
>>>> }
>>>> ...
>>>>
>>>>
>>> I think we should not change vmalloc/vfree, and you can invent new
>>> memory APIs, such as malloc()/free().
>>>
>>>
>> Why?
>>
>>
> Because vmalloc is used to allocate virtually contiguous memory. v in
> vmalloc means virtually.
>
>

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

--
error compiling committee.c: too many arguments to function