From: Greg KH <greg@kroah.com>
To: "Mukund JB." <mukundjb@esntechnologies.co.in>
Cc: linux-kernel@vger.kernel.org
Subject: Re: clarity on kref needed.
Date: Wed, 18 Jan 2006 07:51:07 -0800 [thread overview]
Message-ID: <20060118155107.GA11895@kroah.com> (raw)
In-Reply-To: <3AEC1E10243A314391FE9C01CD65429B28BE86@mail.esn.co.in>
On Wed, Jan 18, 2006 at 12:27:45PM +0530, Mukund JB. wrote:
>
> Dear All,
>
> I have gone through kref and am planning to implement then in my usb driver.
What kind of usb driver?
> please terminate my misconceptions if any by correcting the statements below.
>
> In the call below:
> kref_init(&dev->kref);
> sets the refcount in the kref to 1.
Yes.
> kref_put(&dev->kref);
> increment the refcount.
Hm, don't you mean "kref_get()" here? If so, yes, that is correct.
> kref_put(&dev->kref, mem_release );
> What I understand is when the refcount falls back to '1', only then
> the mem_release() function will be called.
No, when it falls to 0 it will be called.
> Is it correct? I mean, when is the mem_release () called i.e. when the
> refcount is '0' or '1'.
0. There's an OLS paper from a few years ago that describes kref in
detail, as well as the in-kernel documentation of it (see the file
Documentation/kref.txt). Did you read that?
thanks,
greg k-h
next prev parent reply other threads:[~2006-01-18 15:51 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-18 6:57 Mukund JB.
2006-01-18 15:51 ` Greg KH [this message]
2006-01-19 4:45 Mukund JB.
2006-01-19 5:03 ` Greg KH
2006-01-19 5:05 Mukund JB.
2006-01-19 5:33 ` Greg KH
2006-01-19 7:00 Mukund JB.
2006-01-19 15:55 ` Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060118155107.GA11895@kroah.com \
--to=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mukundjb@esntechnologies.co.in \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®