From owner-freebsd-hackers@FreeBSD.ORG Fri Nov 4 12:32:47 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 400AB16A41F; Fri, 4 Nov 2005 12:32:47 +0000 (GMT) (envelope-from babkin@verizon.net) Received: from vms048pub.verizon.net (vms048pub.verizon.net [206.46.252.48]) by mx1.FreeBSD.org (Postfix) with ESMTP id E441B43D49; Fri, 4 Nov 2005 12:32:46 +0000 (GMT) (envelope-from babkin@verizon.net) Received: from vms064.mailsrvcs.net ([192.168.1.1]) by vms048.mailsrvcs.net (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) with ESMTPA id <0IPF00AJOK6GKYV7@vms048.mailsrvcs.net>; Fri, 04 Nov 2005 06:32:40 -0600 (CST) Date: Fri, 04 Nov 2005 06:32:40 -0600 (CST) From: Sergey Babkin To: kamal kc , Giorgos Keramidas Message-id: <16844104.1131107560448.JavaMail.root@vms064.mailsrvcs.net> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit X-Mailman-Approved-At: Fri, 04 Nov 2005 13:23:27 +0000 Cc: freebsd , freebsd Subject: Re: Re: allocating 14KB memory per packet compression/decompression results in v X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: babkin@users.sf.net List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Nov 2005 12:32:47 -0000 >From: kamal kc >since i am using the adaptive LZW >compression scheme it requires construction of string >table for compression/decompression. So an ip packet > of size 1500 bytes requires a table of size (4KB + > 4KB + 2KB =12KB). > >further still i copy the ip packet > data in another data buffer (about 1.4KB) and >then compress it. > >So all this adds up to about 14KB. > >Right now i can't do with less than 14KB. > >as i said before the compression/decompression works >fine. but soon the kernel would panic with one >of the vm_fault: error message. Most likely you overrun your buffer somewhere and damage some unrelated memory area. >what would be the best possible way to >allocate/deallocate 14KB memory per packet without >causing vm_faults ?? The best possible way is to not do it at all. Allocate you 14KB buffer once and then reuse it for every packet. Obviously, your code would have to be either single-threaded, or synchronize the access to the buffer, or use a separate buffer per CPU. >is there anything i am missing ?? Also an extra memory-to-memory copy is a bad idea. It hurts the performance. -SB