Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.os.linux.development.system > #486
| Path | csiph.com!usenet.pasdenom.info!aioe.org!.POSTED!not-for-mail |
|---|---|
| From | "Mark" <mark_cruzNOTFORSPAM@hotmail.com> |
| Newsgroups | comp.os.linux.development.system, comp.os.linux.embedded |
| Subject | sock_create() in kernel |
| Date | Wed, 19 Dec 2012 10:18:32 -0500 |
| Organization | Aioe.org NNTP Server |
| Lines | 32 |
| Message-ID | <kasls6$jdk$1@speranza.aioe.org> (permalink) |
| NNTP-Posting-Host | QUlsvjzEAzxl4LULC7y4Eg.user.speranza.aioe.org |
| X-Complaints-To | abuse@aioe.org |
| X-MimeOLE | Produced By Microsoft MimeOLE V6.00.2900.6157 |
| X-RFC2646 | Format=Flowed; Original |
| X-Notice | Filtered by postfilter v. 0.8.2 |
| X-Newsreader | Microsoft Outlook Express 6.00.2900.5931 |
| X-Priority | 3 |
| X-MSMail-Priority | Normal |
| Xref | csiph.com comp.os.linux.development.system:486 comp.os.linux.embedded:388 |
Cross-posted to 2 groups.
Show key headers only | View raw
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