LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 07-08-2011, 11:28 PM   #1
rrlangly
Member
 
Registered: Dec 2009
Posts: 47

Rep: Reputation: 0
meaning of 'struct proto' .obj_size and it's use


I'm not clear on one of the network protocol structures and hoping someone can explain. In 'struct proto', what should the .obj_size member field refer to?

I see in much of the kernel source where protocols refer to their custom sturcture which always includes 'struct sock', but I'm not realy clear on how obj_size gets used.
 
Old 07-09-2011, 05:45 PM   #2
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
Looking at the sock.h file, I see that the obj_size member occurs in the /* Memory Pressure */ section:
Code:
        struct kmem_cache       *slab;
        unsigned int            obj_size;
        int                     slab_flags;
from which I would assume that size of the object to which the slab points. (In this context, the dynamically allocated kmem_cache buffer.) I believe that the memory slab is being used for transient storage for FIFO stacks of the various protocol handlers, and storing the size is more efficient then recomputing it every time it's needed.

Look at mempool.h and slab.h for details.

Note: I'm not an expert (or even a user) of this code, and my comments flow only from a brief look at some of it.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Question about Kernel pid_namespace - struct pid and struct upid sreeharsha.t Linux - Kernel 4 03-19-2010 04:41 AM
Typecast struct sockaddr in struct sockaddr_in sudhansu Linux - Kernel 1 02-17-2009 10:33 AM
GCC compile problem:struct A have a member variable which is just a struct type name? leon.zcom Programming 3 04-18-2008 04:40 PM
g++ and wrong struct member addresses / struct size misreporting sonajiso Linux - General 5 05-22-2004 10:16 PM
switch statement converting struct char to struct int oceaneyes2 Programming 2 12-10-2003 04:30 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 10:42 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration