Date: Wed, 02 Nov 2005 22:45:37 -0500 From: Chuck Swiger <cswiger@mac.com> To: kamal kc <kamal_ckk@yahoo.com> Cc: freebsd <freebsd-net@freebsd.org> Subject: Re: allocating 14KB memory per packet compression/decompression results in vm_fault Message-ID: <436987E1.30706@mac.com> In-Reply-To: <20051103023936.63209.qmail@web35704.mail.mud.yahoo.com> References: <20051103023936.63209.qmail@web35704.mail.mud.yahoo.com>
next in thread | previous in thread | raw e-mail | index | archive | help
kamal kc wrote: > i am trying to compress/decompress ip packets. > for this i have implemented the adaptive lzw compression. > i put the code in the ip_output.c and do my compression/decompression > just before the if_output() function call so that i won't interfere with > the ip processing of the kernel. > > for my compression/decompression i use string tables and temporary > buffers which take about 14KB of memory per packet. It's highly likely that the problem you are trying to solve has already been implemented elsewhere, you ought to look at the code for these kernel options in particular: # The PPP_BSDCOMP option enables support for compress(1) style entire # packet compression, the PPP_DEFLATE is for zlib/gzip style compression. [ ... ] > These are the memory operations i perform in my code. > Now when i run the modified kernel the behaviour is unpredictable. > The compression/decompression > works fine with expected results. But soon the kernel would crash with > vm_fault: message. > > -Is the memory requirement of 14KB per packet too high to be allocated by > the kernel ?? > - Are there any other techniqures to allocate memory in kernel without > producing vm_faults ?? > - Am I not following the correct procedures to > allocate and deallocate memory in kernel space ?? > - Or is the problem elsewhere ?? You should allocate buffers once and reuse them, not continually free and reallocate 14KB of memory per packet. Look at "man 9 malloc" and the output of "sysctl kern.malloc". Perhaps you're leaking memory with each packet and run the kernel out of KVA pages, but without knowing more about the problem you are trying to solve, and without seeing more of the code you've written or at least a backtrace, it's not really useful to make random guesses. You should be looking to get a dump and run kgdb... -- -Chuck
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?436987E1.30706>