For storing swapslots aobj's select between a hashtable or an array
(sizes vary between a page and the kernel address space), by definition
we only need one of those, so make it a union and possibly shave some
bytes.

ok?

been running with this for a while, I hit swap daily and my machine
allocs a lot of uaos.

-0-


Index: uvm_aobj.c
===================================================================
RCS file: /cvs/src/sys/uvm/uvm_aobj.c,v
retrieving revision 1.51
diff -u -p -r1.51 uvm_aobj.c
--- uvm_aobj.c  2 Jul 2010 02:08:53 -0000       1.51
+++ uvm_aobj.c  27 Apr 2011 12:37:35 -0000
@@ -147,12 +147,16 @@ struct uvm_aobj {
        struct uvm_object u_obj; /* has: lock, pgops, memt, #pages, #refs */
        int u_pages;             /* number of pages in entire object */
        int u_flags;             /* the flags (see uvm_aobj.h) */
-       int *u_swslots;          /* array of offset->swapslot mappings */
-                                /*
-                                 * hashtable of offset->swapslot mappings
-                                 * (u_swhash is an array of bucket heads)
-                                 */
-       struct uao_swhash *u_swhash;
+       /*
+        * Either an array or hashtable (array of bucket heads) of
+        * offset -> swapslot mappings for the aobj.
+        */
+#define u_swslots      u_swap.slot_array 
+#define u_swhash       u_swap.slot_hash
+       union swslots {
+               int                     *slot_array;
+               struct uao_swhash       *slot_hash;
+       } u_swap;
        u_long u_swhashmask;            /* mask for hashtable */
        LIST_ENTRY(uvm_aobj) u_list;    /* global list of aobjs */
 };
 
 
-- 
I used to work in a fire hydrant factory.  You couldn't park anywhere
near the place.
                -- Steven Wright

Reply via email to