DragonFly BSD
DragonFly kernel List (threaded) for 2005-01
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: splay tree and red-black tree for vm_map entry lookups.


From: Matthew Dillon <dillon@xxxxxxxxxxxxxxxxxxxx>
Date: Wed, 19 Jan 2005 14:16:57 -0800 (PST)

:Works a lot better now (I can log in and everything).
:
:http://leaf.dragonflybsd.org/~eirikn/vm_map-rb-tree-netbsd-eirikn-hint.patch
:
:-- 
:Eirik Nygaard

    Looking good.  I think there are some minor code cleanups
    that can be done.  For example:

        while (tmp) {
		if (address >= tmp->start) {
			...
                } else {
                        tmp = RB_LEFT(tmp, rb_entry);
                }
                *entry = last;		<<<<<<<<<<<<< IS THIS NEEDED?
        }
                                   
        /*
         * If there are no entries yet last will end up being NULL and we need
         * to set it to &map->header.
         */
        if (last == NULL)
                last = &map->header;

        *entry = last;
        return (FALSE);

    Double check, but I think that '*entry = last' in the loop
    is not necessary.

    Also, I think you can pre-initialize the 'last' variable
    to &map->header at the top and then get rid of this code:

	/*
	 * If there are no entries yet last will end up being NULL and we need
	 * to set it to &map->header.
	 */
	if (last == NULL)
		last = &map->header;

					-Matt
					Matthew Dillon 
					<dillon@xxxxxxxxxxxxx>



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]