Hi,
Although kmalloc() gives you 24 bytes per call that you
can use, but internally it allocates in pages, and hence 1 page (=4K bytes
in each iteration)
HTH,
Rajat
Hi
From: kernelnewbies-bounce@xxxxxxxxxxxx [mailto:kernelnewbies-bounce@xxxxxxxxxxxx] On Behalf Of gagan grover
Sent: Wednesday, July 02, 2008 12:59 PM
To: kernelnewbies@xxxxxxxxxxxx
Subject: getting panic during kmalloc
I have a requirement of creating 1M buffers of 24 bytes.
So, my driver is calling kmalloc in loop but it is giving following panic after some iterations.
System have 4 GB RAM and I was continuosly checking top, it had sufficient memory to allocate.
----------- [cut here ] --------- [please bite here ] ---------
Kernel BUG at slab:1773
invalid operand: 0000 [1] SMP
CPU 3
Modules linked in: dbg(U) md5 ipv6 parport_pc lp parport autofs4 i2c_dev i2c_core nfs lockd nfs_acl sunrpc rdma_ucm(U) rdma_cm(U) ib_addr(U) ds yenta_socked
Pid: 16998, comm: dbg_fmr_create Not tainted 2.6.9-42.ELsmp
RIP: 0010:[<ffffffff80161949>] <ffffffff80161949>{cache_alloc_refill+409}
RSP: 0018:0000010134709e08 EFLAGS: 00010002
RAX: 0000000000000000 RBX: 00000100bff6f728 RCX: 00000100bff6f6e8
RDX: 00000100bff50000 RSI: 0000000000000018 RDI: 00000100bff6f728
RBP: 00000100bfe56000 R08: 0000000000000007 R09: 000001013162b000
R10: 0000000000000000 R11: 0000000000000000 R12: 00000100bff6f6c8
R13: 00000100bff6f680 R14: 0000000000000018 R15: 0000000000000003
FS: 0000002a95579b00(0000) GS:ffffffff804e5200(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
CR2: 00000036ea2befc0 CR3: 0000000005da4000 CR4: 00000000000006e0
Process dbg_fmr_create (pid: 16998, threadinfo 0000010134708000, task 0000010135cb4030)
Stack: 0000000000000018 0000000000000018 00000100bff6f680 0000010130000000
000001013162b000 0000007fbfffed20 0000000000000003 ffffffff8016174f
0000000000000202 0000000000003067
Call Trace:<ffffffff8016174f>{kmem_cache_alloc+90} <ffffffffa02571bc>{:dbg:dbg_fmr_create+114}
<ffffffffa025252c>{:dbg:dbg_handle_ioctls+8712} <ffffffff8018ae05>{sys_ioctl+853}
<ffffffff8011026a>{system_call+126}
Code: 0f 0b cc 5d 32 80 ff ff ff ff ed 06 31 d2 41 f7 c6 00 20 00
RIP <ffffffff80161949>{cache_alloc_refill+409} RSP <0000010134709e08>
<0>Kernel panic - not syncing: Oops
--
"Find what you love, and love what you find".