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

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

 



On 05/03/2010 10:49 AM, Avi Kivity wrote:
> On 05/03/2010 10:52 AM, Changli Gao wrote:
>> On Mon, May 3, 2010 at 3:42 PM, Avi Kivity<avi@xxxxxxxxxx>  wrote:
>>   
>>> On 05/03/2010 10:05 AM, Changli Gao wrote:
>>>     
>>>> On Mon, May 3, 2010 at 2:06 PM, Avi Kivity<avi@xxxxxxxxxx>    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.

But it won't work well for vmalloc_to_{page,pfn} and similar. Some code
may expect vmalloc result to be in the vmalloc area and page-aligned
(both in position and size).

Not that it won't be possible to inspect the callers, but in my eyes it
would definitely be better to introduce kmalloc_or_vmalloc-alike where
the caller explicitly doesn't care about the resulting position and size.

regards,
-- 
js
suse labs
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux