[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 12 Nov 2008 00:31:48 +0200
From: Izik Eidus <ieidus@...hat.com>
To: Jonathan Corbet <corbet@....net>
CC: linux-kernel@...r.kernel.org, linux-mm@...ck.org,
kvm@...r.kernel.org, aarcange@...hat.com, chrisw@...hat.com,
avi@...hat.com
Subject: Re: [PATCH 3/4] add ksm kernel shared memory driver
Jonathan Corbet wrote:
> On Wed, 12 Nov 2008 00:17:39 +0200
> Izik Eidus <ieidus@...hat.com> wrote:
>
>
>>>> +static int ksm_dev_open(struct inode *inode, struct file *filp)
>>>> +{
>>>> + try_module_get(THIS_MODULE);
>>>> + return 0;
>>>> +}
>>>> +
>>>> +static int ksm_dev_release(struct inode *inode, struct file *filp)
>>>> +{
>>>> + module_put(THIS_MODULE);
>>>> + return 0;
>>>> +}
>>>> +
>>>> +static struct file_operations ksm_chardev_ops = {
>>>> + .open = ksm_dev_open,
>>>> + .release = ksm_dev_release,
>>>> + .unlocked_ioctl = ksm_dev_ioctl,
>>>> + .compat_ioctl = ksm_dev_ioctl,
>>>> +};
>>>>
>>>>
>>> Why do you roll your own module reference counting? Is there a
>>> reason you don't just set .owner and let the VFS handle it?
>>>
>>>
>> Yes, I am taking get_task_mm() if the module will be removed before i
>> free the mms, things will go wrong
>>
>
> But...if you set .owner, the VFS will do the try_module_get() *before*
> calling into your module (as an added bonus, it will actually check the
> return value too).
Ohhh i see what you mean
you are right i had at least needed to check for the return value of
try_module_get(),
anyway will check this issue for V2.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists