pginfo problem

Hans Van den Eynden hans.vandeneynden at student.kuleuven.ac.be
Mon Nov 22 14:02:01 PST 2004


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




More information about the freebsd-questions mailing list