From owner-freebsd-hackers@FreeBSD.ORG Thu Nov 3 02:39:37 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 A269C16A41F for ; Thu, 3 Nov 2005 02:39:37 +0000 (GMT) (envelope-from kamal_ckk@yahoo.com) Received: from web35704.mail.mud.yahoo.com (web35704.mail.mud.yahoo.com [66.163.179.158]) by mx1.FreeBSD.org (Postfix) with SMTP id EB74D43D45 for ; Thu, 3 Nov 2005 02:39:36 +0000 (GMT) (envelope-from kamal_ckk@yahoo.com) Received: (qmail 63211 invoked by uid 60001); 3 Nov 2005 02:39:36 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding; b=cGkSehjBbHmvKq0zEWd0onPWFNbm18yA5y8j5G6/lWdgL5TCgsPiSx8+QvVuXYwUmNzR3j97aANAGCePL8f2C/8Rz62PW9Wcxlu2J70LsjGj5oVfELBnwLtNoq9pwV57i9rJ2CqLr+s93ormkuhlAc46A3l9ejH+ZYQtwfGhDLo= ; Message-ID: <20051103023936.63209.qmail@web35704.mail.mud.yahoo.com> Received: from [202.79.62.27] by web35704.mail.mud.yahoo.com via HTTP; Wed, 02 Nov 2005 18:39:36 PST Date: Wed, 2 Nov 2005 18:39:36 -0800 (PST) From: kamal kc To: freebsd MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: freebsd Subject: allocating 14KB memory per packet compression/decompression results in vm_fault X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Nov 2005 02:39:37 -0000 dear everybody, 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. I used malloc() to allocate the memory space. i made the call as below: malloc(4096,M_TEMP, M_NOWAIT); I call the malloc 3 to 4 times with 4096 bytes. and release it with call to free() I also sometimes allocate an mbuf during compression/decompression. i use the macro-- struct mbuf *m; MGET(m, M_DONTWAIT,MT_DATA); MCLGET(m,M_DONTWAIT); 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 ?? I am really confused and don't know what to do as this is the only thing that is holding me back to implement the compression/decompression module. I know you guys can provide some help/info. Thanks kamal --------------------------------- Yahoo! FareChase - Search multiple travel sites in one click.