From owner-freebsd-current@FreeBSD.ORG Fri Feb 17 11:52:34 2006 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DB3E716A422 for ; Fri, 17 Feb 2006 11:52:33 +0000 (GMT) (envelope-from pjd@garage.freebsd.pl) Received: from mail.garage.freebsd.pl (arm132.internetdsl.tpnet.pl [83.17.198.132]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2DA8A43D72 for ; Fri, 17 Feb 2006 11:52:18 +0000 (GMT) (envelope-from pjd@garage.freebsd.pl) Received: by mail.garage.freebsd.pl (Postfix, from userid 65534) id 9AC6451672; Fri, 17 Feb 2006 12:52:16 +0100 (CET) Received: from localhost (pjd.wheel.pl [10.0.1.1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.garage.freebsd.pl (Postfix) with ESMTP id 66A3651576; Fri, 17 Feb 2006 12:52:10 +0100 (CET) Date: Fri, 17 Feb 2006 12:52:02 +0100 From: Pawel Jakub Dawidek To: Peter Jeremy Message-ID: <20060217115202.GA1269@garage.freebsd.pl> References: <20060207183152.GA50629@troutmask.apl.washington.edu> <20060207190121.GF19674@comp.chem.msu.su> <20060207191408.GA50909@troutmask.apl.washington.edu> <20060209215513.GA3590@garage.freebsd.pl> <20060210070918.GA685@turion.vk2pj.dyndns.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="sdtB3X0nJg68CQEu" Content-Disposition: inline In-Reply-To: <20060210070918.GA685@turion.vk2pj.dyndns.org> X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc X-OS: FreeBSD 7.0-CURRENT i386 User-Agent: mutt-ng/devel-r535 (FreeBSD) X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on mail.garage.freebsd.pl X-Spam-Level: X-Spam-Status: No, score=-5.9 required=3.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.0.4 Cc: freebsd-current@freebsd.org, Steve Kargl Subject: Re: memguard monitoring of more than 1 memory_type? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Feb 2006 11:52:34 -0000 --sdtB3X0nJg68CQEu Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Feb 10, 2006 at 06:09:19PM +1100, Peter Jeremy wrote: +> On Thu, 2006-Feb-09 22:55:14 +0100, Pawel Jakub Dawidek wrote: +> >On Tue, Feb 07, 2006 at 11:14:08AM -0800, Steve Kargl wrote: +> >+> Thanks for pointing out the obvious. I've read that manpage several +> >+> times and somehow missed the word "particular". It's unfortunate +> >+> that it can't monitor more than one type of memory allocation because +> >+> the new pts code has either uncovered a latent bug in devfs or the +> >+> pts patch is stomping on memory. +> > +> >It shouldn't be hard to implement. You need to change function +> >memguard_cmp() in sys/vm/memguard.c, which decides which memory type +> >should be monitored. I'm sorry for the late response... +> It's quite a bit messier than this. memguard.c privately stores a +> record of which memory type is being debugged in vm_memguard_mtype +> and vm_memguard_desc and doesn't bother passing this information via +> the alloc/free hooks. No, no. vm_memguard_desc is only used for fast comparsion, but it is turned off by default. Anyway, it is only used to decide if specific allocation should be done on memguard's map. +> The current kern_malloc code looks like: +> #ifdef DEBUG_MEMGUARD +> if (memguard_cmp(mtp)) +> return memguard_alloc(size, flags); +> #endif +> If you are going to support multiple memory types, you need to pass +> mtp to memguard_{alloc,free}() - in which case, you might as well +> combine memguard_cmp() into these functions. +>=20 +> The easiest way to support multiple memory types is to hang the +> memguard information off the struct malloc_type - except that means +> that DEBUG_MEMGUARD changes the kernel ABI. The only thing that has to be done is to modify memguard_cmp() to operate on list of memory type short description, IMHO. --=20 Pawel Jakub Dawidek http://www.wheel.pl pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! --sdtB3X0nJg68CQEu Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (FreeBSD) iD8DBQFD9bjiForvXbEpPzQRApp4AJ45iEc723j1oMUxZD8W57Td2P4wSgCeI4k4 L2dxAUeAjcRF8HC+AiRRqPQ= =DOWc -----END PGP SIGNATURE----- --sdtB3X0nJg68CQEu--