On Mon, Apr 28, 2008 at 5:36 PM, Nai Xia &lt;<a href="mailto:nai.xia@gmail.com" target="_blank">nai.xia@gmail.com</a>&gt; wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div>&nbsp;
Hmm,,... Well, I think a reasonable up limit should be based on a wide<br>
&nbsp;range of workloads.<br>
&nbsp;The patch I posted was only a quick fix,<br>
&nbsp;It will be good if you have solid evidence of a safe up bound. :)</div></div></blockquote><div><br>&nbsp; I have tryed creating larger and larger compcaches. (2^22-4) KB appears to work while (2^22-2) fails. The problem seems to be caused by integer overflow in compcache_size_kbyte, or compcache.size at <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; compcache.size = compcache_size_kbytes &lt;&lt; 10;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; compcache.size = (compcache.size + PAGE_SIZE - 1) &amp; PAGE_MASK;<br>&nbsp;<br>We could probably eliminate the need for compcache.size by going direct from _kbytes to num_pages, allowing ~4TB devices. Using only num_pages&nbsp; would increase the max size of compcache to ~16TB and simplify the compcache code somewhat. Unfortunately it seem&nbsp; hard to get at PAGE_SIZE from userspace.<br>
<br>--<br><br>xp@xp-desktop:~/src/compcache-read-only$ sudo ./unuse_compcache.sh ; sudo ./use_compcache.sh $((1024*1024*4-4))<br>Turning off compache swap device ...<br>Unloading modules ...<br>Done!<br>Loading modules ...<br>
Setting up swap device ...<br>Done!<br>xp@xp-desktop:~/src/compcache-read-only$ sudo ./unuse_compcache.sh ; sudo ./use_compcache.sh $((1024*1024*4-2))<br>Turning off compache swap device ...<br>Unloading modules ...<br>Done!<br>
Loading modules ...<br>./use_compcache.sh: line 21:&nbsp; 7238 Segmentation fault&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $INSMOD_BIN $MOD_NAME.ko &quot;$MOD_PARAM&quot;<br>Setting up swap device ...<br>swapon: cannot stat /dev/ramzswap0: No such file or directory<br>
Could not add compcache swapdevice.<br></div></div>Apr 29 02:21:27 xp-desktop kernel: [ 2655.365401] compcache: cleanup done!<br>Apr 29 02:21:27 xp-desktop kernel: [ 2655.568661] compcache: Compressed swap size set to: 0 KB<br>
Apr 29 02:21:27 xp-desktop kernel: [ 2655.569815] compcache: Error allocating compcache address table<br>Apr 29 02:21:27 xp-desktop kernel: [ 2655.570840] BUG: unable to handle kernel NULL pointer dereference at virtual address 00000000<br>
Apr 29 02:21:27 xp-desktop kernel: [ 2655.570903] printing eip: d09b42d8 *pde = 00000000<br>Apr 29 02:21:27 xp-desktop kernel: [ 2655.572071] Oops: 0000 [#1] SMP<br>Apr 29 02:21:27 xp-desktop kernel: [ 2655.572577] Modules linked in: compcache tlsf lzo_decompress lzo_compress af_packet rfcomm l2cap bluetooth ppdev ipv6 speedstep_lib cpufreq_conservative cpufreq_userspace cpufreq_ondemand cpufreq_powersave cpufreq_stats freq_table container video output sbs sbshc dock battery parport_pc lp parport evdev psmouse ac serio_raw pcspkr button i2c_piix4 i2c_core ext3 jbd mbcache sg sr_mod cdrom sd_mod ata_generic pata_acpi floppy ata_piix pcnet32 mii libata scsi_mod thermal processor fan fuse<br>
Apr 29 02:21:27 xp-desktop kernel: [ 2655.573931]<br>Apr 29 02:21:27 xp-desktop kernel: [ 2655.574199] Pid: 7238, comm: insmod Not tainted (2.6.24-5-generic #1)<br>Apr 29 02:21:27 xp-desktop kernel: [ 2655.574299] EIP: 0060:[&lt;d09b42d8&gt;] EFLAGS: 00010246 CPU: 0<br>
Apr 29 02:21:27 xp-desktop kernel: [ 2655.574849] EIP is at compcache_init+0x2d8/0x3ff [compcache]<br>Apr 29 02:21:27 xp-desktop kernel: [ 2655.574947] EAX: 00000000 EBX: fffffff4 ECX: 00000086 EDX: 00000000<br>Apr 29 02:21:27 xp-desktop kernel: [ 2655.575043] ESI: d09c6f00 EDI: 00000000 EBP: d09c6f00 ESP: c25d9e64<br>
Apr 29 02:21:27 xp-desktop kernel: [ 2655.575140]&nbsp; DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068<br>Apr 29 02:21:27 xp-desktop kernel: [ 2655.575304] Process insmod (pid: 7238, ti=c25d8000 task=ce22c000 task.ti=c25d8000)<br>
Apr 29 02:21:27 xp-desktop kernel: [ 2655.575384] Stack: d09c59cc 00000000 a024e82f a024e84c c04a7370 00000246 00000246 c25d9e88<br>Apr 29 02:21:27 xp-desktop kernel: [ 2655.575658]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; c03ab78f c0150010 d09c6f00 00000286 cea6a5a0 d09c6f00 00000001 d09c6f00<br>
Apr 29 02:21:27 xp-desktop kernel: [ 2655.575864]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; d09c6f00 00000010 d09c6f00 d09c6f00 d09c6f00 00000010 c01515e6 00000001<br>Apr 29 02:21:27 xp-desktop kernel: [ 2655.576068] Call Trace:<br>Apr 29 02:21:27 xp-desktop kernel: [ 2655.576410]&nbsp; [__link_module+0x0/0x20] __link_module+0x0/0x20<br>
Apr 29 02:21:27 xp-desktop kernel: [ 2655.577003]&nbsp; [sys_init_module+0x126/0x19c0] sys_init_module+0x126/0x19c0<br>Apr 29 02:21:27 xp-desktop kernel: [ 2655.577660]&nbsp; [get_zeroed_page+0x0/0x50] get_zeroed_page+0x0/0x50<br>Apr 29 02:21:27 xp-desktop kernel: [ 2655.578151]&nbsp; [syscall_call+0x7/0x0b] syscall_call+0x7/0xb<br>
Apr 29 02:21:27 xp-desktop kernel: [ 2655.578536]&nbsp; =======================<br>Apr 29 02:21:27 xp-desktop kernel: [ 2655.578605] Code: 8d 76 00 a1 a0 74 9c d0 85 c0 74 1a 8b 08 85 c9 7e 0f 8d 50 0c 89 c8 e8 67 5e 85 ef a1 a0 74 9c d0 e8 5d 8c 81 ef a1 8c 74 9c d0 &lt;8b&gt; 00 85 c0 74 07 31 d2 e8 4b ae 7b ef a1 84 74 9c d0 85 c0 74<br>
Apr 29 02:21:27 xp-desktop kernel: [ 2655.579928] EIP: [&lt;d09b42d8&gt;] compcache_init+0x2d8/0x3ff [compcache] SS:ESP 0068:c25d9e64<br>Apr 29 02:21:27 xp-desktop kernel: [ 2655.581121] ---[ end trace cbd4a5ac68883bfe ]---<br>
<br clear="all"><br>-- <br>John C. McCabe-Dansted<br>PhD Student<br>University of Western Australia