Groups | Search | Server Info | Keyboard shortcuts | Login | Register
Groups > comp.os.linux.development.system > #486
| From | "Mark" <mark_cruzNOTFORSPAM@hotmail.com> |
|---|---|
| Newsgroups | comp.os.linux.development.system, comp.os.linux.embedded |
| Subject | sock_create() in kernel |
| Date | 2012-12-19 10:18 -0500 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <kasls6$jdk$1@speranza.aioe.org> (permalink) |
Cross-posted to 2 groups.
Hello,
I was looking in to __sock_create() code to get better understanding of the
kernel's internal machinery and found that the kernel calls try_module_get()
twice; here is a snippet:
static int __sock_create(struct net *net, int family, int type, int
protocol, struct socket **res, int kern)
{
sock = sock_alloc();
...
if (!try_module_get(pf->owner))
goto out_release;
err = pf->create(net, sock, protocol);
...
if (!try_module_get(sock->ops->owner))
goto out_module_busy
...
}
Essentially if socket relevant callbacks are in a module, then whenever
every socket() from the user space will bump the module's reference count
twice. What's the rationale for such behaviour ?
Thanks.
Mark
Back to comp.os.linux.development.system | Previous | Next — Next in thread | Find similar
sock_create() in kernel "Mark" <mark_cruzNOTFORSPAM@hotmail.com> - 2012-12-19 10:18 -0500 Re: sock_create() in kernel Rainer Weikusat <rweikusat@mssgmbh.com> - 2012-12-19 16:06 +0000
csiph-web