Satyam Sharma wrote:
> On 4/28/07, Tejun Heo <htejun@xxxxxxxxx> wrote:
>> Implement bin_buffer which contains a mutex and pointer to PAGE_SIZE
>> buffer to properly synchronize accesses to per-openfile buffer and
>> prepare for immediate-kobj-disconnect.
>>
>> Signed-off-by: Tejun Heo <htejun@xxxxxxxxx>
>> ---
>> [...]
>> @@ -135,14 +160,22 @@ static int open(struct inode * inode, struct
>> file * file)
>> goto Error;
>>
>> error = -ENOMEM;
>> - file->private_data = kmalloc(PAGE_SIZE, GFP_KERNEL);
>> - if (!file->private_data)
>> + bb = kzalloc(sizeof(*bb), GFP_KERNEL);
>> + if (!bb)
>> goto Error;
>>
>> + bb->buffer = kmalloc(PAGE_SIZE, GFP_KERNEL);
>
> You could simply do a __get_free_page() here instead of a
> kmalloc(PAGE_SIZE).
Yes, I could but 1. the original code was done using kmalloc
2. I'm not sure __get_free_page() is better than kmalloc(PAGE_SIZE, ), is it?