slab usage in linux

2011-01-04 Thread Sowmya Sridharan
Hi List,

I have a few queries regarding slab memory and it's usage.
I have seen slab cache increase by even 1GB, over two to three days on a 
stable system.(The system was sending and receiving bulk amounts of 
packets).
 
When is slab usually freed? Also when I analyzed /proc/slabinfo, I was 
able to see that the number of active slab objects were increasing mostly 
for task_struct, dentry_cache and proc_inode_caches. When are these caches 
allotted objects, in general?

Can anyone please explain the behavior related to slab allocation; or 
point to any reference material?

Thanks,
Sowmya.
=-=-=
Notice: The information contained in this e-mail
message and/or attachments to it may contain 
confidential or privileged information. If you are 
not the intended recipient, any dissemination, use, 
review, distribution, printing or copying of the 
information contained in this e-mail message 
and/or attachments to it are strictly prohibited. If 
you have received this communication in error, 
please notify us by reply e-mail or telephone and 
immediately and permanently delete the message 
and any attachments. Thank you


___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


floating points in kernel space

2011-01-04 Thread mohit verma
hi all,
i read somewhere that there is no floating point arithmatic supported in the
kernel space . is it true??
but the floating point registers and even floating point arithmatic units
are all handled by the.( kernel i think).


thanks in advance for help...


-- 

*MOHIT VERMA*
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: floating points in kernel space

2011-01-04 Thread Victor Rodriguez
On Tue, Jan 4, 2011 at 6:43 AM, mohit verma mohit89m...@gmail.com wrote:
 hi all,
 i read somewhere that there is no floating point arithmatic supported in the
 kernel space . is it true??
 but the floating point registers and even floating point arithmatic units
 are all handled by the.( kernel i think).


 thanks in advance for help...



HI it is true , the floating point is not supported on printk , AFAIK
the only way to handle is to send it like HEX values and then some
other application like perl or python transform it to floating point

Hope it helps

Regards

Victor Rodriguez
 --
 
 MOHIT VERMA

 ___
 Kernelnewbies mailing list
 Kernelnewbies@kernelnewbies.org
 http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: floating points in kernel space

2011-01-04 Thread Dave Hylands
Hi Mohit,

On Tue, Jan 4, 2011 at 4:43 AM, mohit verma mohit89m...@gmail.com wrote:
 hi all,
 i read somewhere that there is no floating point arithmatic supported in the
 kernel space . is it true??
 but the floating point registers and even floating point arithmatic units
 are all handled by the.( kernel i think).

That is correct. In some architectures, attempts to use floating point
from the kernel will work. I've seen some x86 code that uses it.
However, with ARM for example, there is no float support in the
kernel, and some ARM architectures have no floating point support in
the hardware either. For ARM, there is a kernel implemented emulation
of the floating point instructions, but these can only be called from
user space. There are also some ARM software floating point libraries
(aka soft-fp) which can be used from user space (which are much more
efficient than using the kernel emulation library)

The kernel also doesn't support 64-bit division using the C divide
statement, unless you happen to be running on a 64-bit architecture.
There are some helper functions to achieve 64-bit division (see
div64.h).

Dave Hylands

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: slab usage in linux

2011-01-04 Thread Mulyadi Santosa
Hi

I cc: the reply to the new list address. I hope you don't mind
Now, let's what I can share here

On Tue, Jan 4, 2011 at 18:49, Sowmya Sridharan sowmya.sridha...@tcs.com wrote:
 I have seen slab cache increase by even 1GB, over two to three days on a
 stable system.(The system was sending and receiving bulk amounts of
 packets).

No kidding? 1 Gig? Wow But that's alright, I think that still make
sense ... highly frequent sock related cache creation I guess
slabtop -s c would tell you the highest cache size ...

 When is slab usually freed?

AFAIK when it can no longer grow same like page cache, it will
grow to fill your RAM  until  it exhausts everything left by anonymous
page allocation plus some amount of  reserved pages. And AFAIK too,
it's tunable, but I couldn't recall which kernel parameters that
control it.

Also when I analyzed /proc/slabinfo, I was able
 to see that the number of active slab objects were increasing mostly for
 task_struct, dentry_cache and proc_inode_caches. When are these caches
 allotted objects, in general?

task_struct-- during new process creation

dentry_cache -- after reading directory entry metadata from a block
devices and cache them

proc_inode_cache -- almost similar like above, but this one is
strictly for /proc entries.

-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: floating points in kernel space

2011-01-04 Thread Mulyadi Santosa
Hi..

On Tue, Jan 4, 2011 at 22:44, Dave Hylands dhyla...@gmail.com wrote:
 That is correct. In some architectures, attempts to use floating point
 from the kernel will work. I've seen some x86 code that uses it.


AFAIK, once x86 didn't supported due to floating point related
registers are not correctly (or even doing?) saved and restored during
context switching. So maybe it is fixed now...

-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: ASLR implementation

2011-01-04 Thread Mulyadi Santosa
Hi...

On Tue, Jan 4, 2011 at 20:04, Zubin Mithra zubin.mit...@gmail.com wrote:
 Hi,

 I recently read about the Linux kernel implementing ASLR to prevent buffer 
 overflow attacks.

nope...that is done to make symbol address guessing harder

 I would like to have a look at how this is implemented by reading the kernel 
 source code.

 Could someone offer a few pointers on where to start looking?(It would make 
 my work slightly easier.)

try http://lxr.linux.no/#linux+v2.6.36/arch/x86/vdso/vma.c

-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: fixed memory bytes

2011-01-04 Thread John Mahoney
Please reply all..I added back list.

On Tue, Jan 4, 2011 at 1:58 PM, mohit verma mohit89m...@gmail.com wrote:
 thnx john,.
 but i know that this indicates to compiler to  align the structure to its
 nearest boundries.   is that so?

I am not sure of your definition of boundary, but I would say it does
the opposite.  It tells the compiler not to align the struct to
boundaries.

--
John

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: floating points in kernel space

2011-01-04 Thread julie Sullivan

 On Tue, Jan 4, 2011 at 22:44, Dave Hylands dhyla...@gmail.com wrote:
  That is correct. In some architectures, attempts to use floating point
  from the kernel will work. I've seen some x86 code that uses it.


 AFAIK, once x86 didn't supported due to floating point related
 registers are not correctly (or even doing?) saved and restored during
 context switching. So maybe it is fixed now...

 --


I've often wondered about this oft-cited kernel behaviour too, in my
naivety.  I understand
that this must be on a per-arch basis, but does this mean that the kernel
doesn't police FP
access at _all_ (perhaps this is what Mohit means too)? Does code like X for
example have to access it directly, or does it just use the GPU? What about
other user-space code - does it
have a separate library and do its own security? Video drivers?
Sorry if these are basic questions, I grepped for float in the kernel but
as-yet the associated
code looks really arcane to me - if anyone could answer any of these
questions generally
(if that's possible) that would be very helpful with visualizing the
mechanism.
Maybe I'm looking in the wrong place.

When I started looking at the kernel I imagined this small, neat, concise
piece of highly
efficient code so I wasn't surprised there was no float (don't laugh - how
one learns :-/ ) ...
I suppose any float per-arch 'hacks' (to get a larger word size) would not
be worth
the overhead of the mode switch and extra code?

Thanks
Julie
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: fixed memory bytes

2011-01-04 Thread julie Sullivan
 i have seen many places in  kernel where the variables specially the
 structures should be of  fixed size independent of the architecture. i went
 through the  definitions of them  but dint  get  clearly (or frankly  say
 ...dint get them even a bit) .


Hi Mohit

I'm not sure whether we are interpreting your question correctly. Do you
mean

1. you've seen some code in the kernel which you think means the size of a
structure/
variable (and its resulting binary footprint) is set to be the same (in
bytes),
regardless of the architecture, and you are confused about it?

2. you think that there should be a way of fixing the structure/variable
(binary footprint)
size to be the same (in bytes) regardless of the architecture and you are
wondering if this
is possible?

In my (uninformed) opinion (2) is not be possible with the kernel due to
portability
issues - not only do natural word types differ (as others here are
explaining) but you
have no control over what optimization settings the kernel's user might set
in gcc,
for example. This is one of the problems with trying to maintain
closed-source drivers
and other binary code for the kernel, as I understand.

Thanks
Julie
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Adding Module to kernel

2011-01-04 Thread Praveen kumar
Dear All,
I have a kernel module which i want to add to kernel permanently(I was
doing it dynamically) .
How can we achieve this ?

Regards,
Praveen

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: fixed memory bytes

2011-01-04 Thread Rajat Sharma
A nice kernel document regarding unaligned memory access. It may not
be directly answering all the questions asked, but once gone through
and understood completely, it will become easy to figure out how to
write portable kernel code.

http://lxr.linux.no/#linux+v2.6.36/Documentation/unaligned-memory-access.txt

Rajat

On Wed, Jan 5, 2011 at 4:29 AM, julie Sullivan kernelmail@gmail.com wrote:

 i have seen many places in  kernel where the variables specially the
 structures should be of  fixed size independent of the architecture. i went
 through the  definitions of them  but dint  get  clearly (or frankly  say
 ...dint get them even a bit) .

 Hi Mohit

 I'm not sure whether we are interpreting your question correctly. Do you
 mean

 1. you've seen some code in the kernel which you think means the size of a
 structure/
 variable (and its resulting binary footprint) is set to be the same (in
 bytes),
 regardless of the architecture, and you are confused about it?

 2. you think that there should be a way of fixing the structure/variable
 (binary footprint)
 size to be the same (in bytes) regardless of the architecture and you are
 wondering if this
 is possible?

 In my (uninformed) opinion (2) is not be possible with the kernel due to
 portability
 issues - not only do natural word types differ (as others here are
 explaining) but you
 have no control over what optimization settings the kernel's user might set
 in gcc,
 for example. This is one of the problems with trying to maintain
 closed-source drivers
 and other binary code for the kernel, as I understand.

 Thanks
 Julie

 ___
 Kernelnewbies mailing list
 Kernelnewbies@kernelnewbies.org
 http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Kernel compilation

2011-01-04 Thread scott
I'm new to the list and would like to say hello to everyone. Now on to 
the meat.

I have tried to compile a kernel with a grsec patch 5 times now using a
couple of different methods and I keep getting a No init found and
Couldn't support optional features errors every time at bootup.
I'm trying to use a vanilla 2.6.32.27 kernel on 10.04 Ubuntu and it 
compiles fine,
just will not boot.

I've tried CONCURRENCY_LEVEL=`getconf _NPROCESSORS_ONLN` fakeroot make-kpkg
--initrd --append-to-version=-custom kernel_image kernel_headers,
CONCURRENCY_LEVEL=3 make-kpkg --initrd --append-to-version=-586
kernel_image kernel_headers modules_image.

I have all the reqs for building kernels such as build-essentials, fakeroot,
kernel-package, kernel-wedge, nurces-dev and qt for xconfig.

These are the steps I've taken. DL the kernel image from kernels.org, get
the patch from grsec.net, untar the kernel, cd into the directory created,
do a 'cp /boot/config-`uname -r` .config', 'make oldconfig', apply the
patch, then either 'make menuconfig' or 'make xconfig'. Then I do a
'make-kpkg clean' and run one of the commands in the first paragraph above.

I get the debs built and can install them just fine, but I keep getting the
same errors. I've cut out as many Experimental options I thought might
cause a problem and still get a kernel panic at boot.

Anyone have a clue what I'm doing wrong?
Scott


___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Kernel compilation

2011-01-04 Thread Mulyadi Santosa
Hi Scott :)

On Wed, Jan 5, 2011 at 12:34, scott redhowlingwol...@nc.rr.com wrote:
 I'm new to the list and would like to say hello to everyone. Now on to
 the meat.

 I have tried to compile a kernel with a grsec patch 5 times now using a
 couple of different methods and I keep getting a No init found and
 Couldn't support optional features errors every time at bootup.
 I'm trying to use a vanilla 2.6.32.27 kernel on 10.04 Ubuntu and it
 compiles fine,
 just will not boot.

My first question is: did the patching go successfully? were you
applying the correct grsec version against a matching vanilla kernel
version?

And last, maybe you can attach your kernel .config content...and one
of fine people here will try to decipher what's wrong with it :)

-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


how opensolaris stores the major number ?

2011-01-04 Thread Deepen Mehta
Hi,

zfs_mknode is the function use by mknod syscall to create device special
file
in solaris kernel. I traverse the code and just found how they stores the
minor number
which is in znode's(disk inode of Linux) attributes struct called
sa_bulk_attr field
uint16_t sa_buftype which is of 16bit only. so, it just store minor number
in this field.
And I am failed to understand where/how the solaris exact stores major
number
from code traversing.

so, can somebody clarify where/how the major number stores in solaris code
or in znode(disk inode).

the source is available online and following link is of zfs_znode.c file
having
zfs_mknode function...
http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/fs/zfs/zfs_znode.c

Regards,
Deepen Mehta
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Kernel compilation

2011-01-04 Thread scott
On 01/05/2011 01:46 AM, Mulyadi Santosa wrote:
 Hi Scott :)

 On Wed, Jan 5, 2011 at 12:34, scottredhowlingwol...@nc.rr.com  wrote:
 I'm new to the list and would like to say hello to everyone. Now on to
 the meat.

 I have tried to compile a kernel with a grsec patch 5 times now using a
 couple of different methods and I keep getting a No init found and
 Couldn't support optional features errors every time at bootup.
 I'm trying to use a vanilla 2.6.32.27 kernel on 10.04 Ubuntu and it
 compiles fine,
 just will not boot.
 My first question is: did the patching go successfully? were you
 applying the correct grsec version against a matching vanilla kernel
 version?

 And last, maybe you can attach your kernel .config content...and one
 of fine people here will try to decipher what's wrong with it :)

The patch was matched and was successful. It compiled with no errors. 
Just the 'no init' at boot.
I'll post my .config later today as it's late here and have to work. I'm 
beginning to think it may have something to do with the limits on file 
size as I got a few warnings about out-of-range sizes. I have it set to 
1024.

Thanks for your reply,
Scott

Thanks for your reply.

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Kernel compilation

2011-01-04 Thread Robert P. J. Day
On Wed, 5 Jan 2011, scott wrote:

 I'm new to the list and would like to say hello to everyone. Now on
 to the meat.

 I have tried to compile a kernel with a grsec patch 5 times now
 using a couple of different methods and I keep getting a No init
 found and Couldn't support optional features errors every time at
 bootup. I'm trying to use a vanilla 2.6.32.27 kernel on 10.04 Ubuntu
 and it compiles fine, just will not boot.

 I've tried CONCURRENCY_LEVEL=`getconf _NPROCESSORS_ONLN` fakeroot
 make-kpkg --initrd --append-to-version=-custom kernel_image
 kernel_headers, CONCURRENCY_LEVEL=3 make-kpkg --initrd
 --append-to-version=-586 kernel_image kernel_headers modules_image.

 I have all the reqs for building kernels such as build-essentials,
 fakeroot, kernel-package, kernel-wedge, nurces-dev and qt for
 xconfig.

 These are the steps I've taken. DL the kernel image from
 kernels.org, get the patch from grsec.net, untar the kernel, cd into
 the directory created, do a 'cp /boot/config-`uname -r` .config',
 'make oldconfig', apply the patch, then either 'make menuconfig' or
 'make xconfig'. Then I do a 'make-kpkg clean' and run one of the
 commands in the first paragraph above.

 I get the debs built and can install them just fine, but I keep
 getting the same errors. I've cut out as many Experimental options
 I thought might cause a problem and still get a kernel panic at
 boot.

 Anyone have a clue what I'm doing wrong?

  you are clearly using ubuntu, so here's a simpler recipe i've used
successfully.

  1) configure and build your kernel from the source
  2) sudo make modules_install
  3) sudo make install
  4) sudo update-initramfs -c -k kernel version goes here
  5) sudo update-grub

the drawback to the above is that your kernel is not built as an
official *package* but for testing purposes, it should do.  you'll get
your kernel installed under /boot, your modules installed, a new
initramfs image, and your grub file updated.  can you try it this way
and see if it makes a difference?

rday

-- 


Robert P. J. Day   Waterloo, Ontario, CANADA
http://crashcourse.ca

Twitter:   http://twitter.com/rpjday
LinkedIn:   http://ca.linkedin.com/in/rpjday


___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies