From owner-freebsd-questions@FreeBSD.ORG Mon Nov 22 22:02:01 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A421916A4CE for ; Mon, 22 Nov 2004 22:02:01 +0000 (GMT) Received: from nibbel.kulnet.kuleuven.ac.be (nibbel.kulnet.kuleuven.ac.be [134.58.240.41]) by mx1.FreeBSD.org (Postfix) with ESMTP id A74BE43D3F for ; Mon, 22 Nov 2004 22:02:00 +0000 (GMT) (envelope-from hans.vandeneynden@student.kuleuven.ac.be) Received: from localhost (localhost [127.0.0.1]) by nibbel.kulnet.kuleuven.ac.be (Postfix) with ESMTP id 119174B867 for ; Mon, 22 Nov 2004 23:01:59 +0100 (CET) Received: from octavianus.kulnet.kuleuven.ac.be (octavianus.kulnet.kuleuven.ac.be [134.58.240.71]) by nibbel.kulnet.kuleuven.ac.be (Postfix) with ESMTP id A53894B848 for ; Mon, 22 Nov 2004 23:01:58 +0100 (CET) Received: from [127.0.0.1] (10-4-90-251.kotnet.org [10.4.90.251]) 0239FAF0A4 for ; Mon, 22 Nov 2004 23:01:58 +0100 (CET) Message-ID: <41A261D2.2070004@student.kuleuven.ac.be> Date: Mon, 22 Nov 2004 23:01:54 +0100 From: Hans Van den Eynden User-Agent: Mozilla Thunderbird 0.8 (Windows/20040913) X-Accept-Language: en-us, en MIME-Version: 1.0 To: freebsd-questions@freebsd.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by KULeuven Antivirus Cluster Subject: pginfo problem X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2004 22:02:01 -0000 In ifree there is index = ptr2index(ptr); //the index in the page_dir is calculated info = page_dir[index]; //the FIRST pginfo structure in the list for that specific chunksize free_bytes(ptr, index, info); in free_bytes there is /* Find the chunk number on the page */ i = ((u_long)ptr & malloc_pagemask) >> info->shift; info->bits[i/MALLOC_BITS] |= 1<<(i%MALLOC_BITS); //ALWAYS the FIRST pginfo structure is updated info->free++; //ALWAYS the FIRST pginfo structure is updated I thought that page_dir was something like this: page_dir-- first 4 not used -- first pg_info for size 1 -- first pg_info for size 2 -- first pg_info for size 3 -- second pg_info for size 1 -- third pg_info for size -- first pg_info for size 4 -- first pg_info for size 5 -- first pg_info for size 6 -- second pg_info for size 6 -- ... --MALLOC_FIRST --MALLOC_FREE --... But in the algorithm always the first pginfo structure is chosen?? What is wrong with in thinking?? thx