Hi,

I tested removing some slop (i.e. structure packing/de-holing) on amd64, this 
went through a full kernel + userland build.

struct proc 20 bytes (6 places) --> 4 bytes (2 places)
struct process 28 bytes (6 places) --> 4 bytes (1 place)
struct vm_map 8 bytes (2 places) --> 0 bytes

Thanks



diff --git a/sys/sys/proc.h b/sys/sys/proc.h
index 1c7ea4697e2..d2955e2d0f7 100644
--- a/sys/sys/proc.h
+++ b/sys/sys/proc.h
@@ -170,8 +170,8 @@ struct process {
 
 /* The following fields are all zeroed upon creation in process_new. */
 #define        ps_startzero    ps_klist
-       struct  klist ps_klist;         /* knotes attached to this process */
        int     ps_flags;               /* PS_* flags. */
+       struct  klist ps_klist;         /* knotes attached to this process */
 
        struct  proc *ps_single;        /* Single threading to this thread. */
        int     ps_singlecount;         /* Not yet suspended threads. */
@@ -200,15 +200,6 @@ struct process {
        struct  pgrp *ps_pgrp;          /* Pointer to process group. */
        struct  emul *ps_emul;          /* Emulation information */
 
-       char    ps_comm[MAXCOMLEN+1];
-
-       vaddr_t ps_strings;             /* User pointers to argv/env */
-       vaddr_t ps_sigcode;             /* User pointer to the signal code */
-       vaddr_t ps_sigcoderet;          /* User pointer to sigreturn retPC */
-       u_long  ps_sigcookie;
-       u_int   ps_rtableid;            /* Process routing table/domain. */
-       char    ps_nice;                /* Process "nice" value. */
-
        struct uprof {                  /* profile arguments */
                caddr_t pr_base;        /* buffer base */
                size_t  pr_size;        /* buffer size */
@@ -216,7 +207,15 @@ struct process {
                u_int   pr_scale;       /* pc scaling */
        } ps_prof;
 
+       char    ps_comm[MAXCOMLEN+1];
+       char    ps_nice;                /* Process "nice" value. */
        u_short ps_acflag;              /* Accounting flags. */
+       u_int   ps_rtableid;            /* Process routing table/domain. */
+
+       vaddr_t ps_strings;             /* User pointers to argv/env */
+       vaddr_t ps_sigcode;             /* User pointer to the signal code */
+       vaddr_t ps_sigcoderet;          /* User pointer to sigreturn retPC */
+       u_long  ps_sigcookie;
 
        uint64_t ps_pledge;
        uint64_t ps_execpledge;
@@ -285,6 +284,7 @@ struct proc {
        struct  futex   *p_futex;       /* Current sleeping futex. */
 
        /* substructures: */
+       LIST_ENTRY(proc) p_hash;        /* Hash chain. */
        struct  filedesc *p_fd;         /* copy of p_p->ps_fd */
        struct  vmspace *p_vmspace;     /* copy of p_p->ps_vmspace */
 #define        p_rlimit        p_p->ps_limit->pl_rlimit
@@ -296,7 +296,6 @@ struct proc {
        u_char  p_descfd;               /* if not 255, fdesc permits this fd */
 
        pid_t   p_tid;                  /* Thread identifier. */
-       LIST_ENTRY(proc) p_hash;        /* Hash chain. */
 
 /* The following fields are all zeroed upon creation in fork. */
 #define        p_startzero     p_dupfd
@@ -305,6 +304,11 @@ struct proc {
        long    p_thrslpid;     /* for thrsleep syscall */
 
        /* scheduling */
+       struct  cpu_info * volatile p_cpu; /* CPU we're running on. */
+
+       struct  rusage p_ru;            /* Statistics */
+       struct  tusage p_tu;            /* accumulated times. */
+       struct  timespec p_rtime;       /* Real time. */
        u_int   p_estcpu;        /* Time averaged value of p_cpticks. */
        int     p_cpticks;       /* Ticks of cpu time. */
        const volatile void *p_wchan;/* Sleep address. */
@@ -315,11 +319,6 @@ struct proc {
        u_int   p_uticks;               /* Statclock hits in user mode. */
        u_int   p_sticks;               /* Statclock hits in system mode. */
        u_int   p_iticks;               /* Statclock hits processing intr. */
-       struct  cpu_info * volatile p_cpu; /* CPU we're running on. */
-
-       struct  rusage p_ru;            /* Statistics */
-       struct  tusage p_tu;            /* accumulated times. */
-       struct  timespec p_rtime;       /* Real time. */
 
        int      p_siglist;             /* Signals arrived but not delivered. */
 
diff --git a/sys/uvm/uvm_map.h b/sys/uvm/uvm_map.h
index 07ca0d0ef45..4a63463d325 100644
--- a/sys/uvm/uvm_map.h
+++ b/sys/uvm/uvm_map.h
@@ -292,16 +292,15 @@ struct vm_map {
        struct pmap *           pmap;           /* Physical map */
        struct rwlock           lock;           /* Lock for map data */
        struct mutex            mtx;
-       u_int                   serial;         /* signals stack changes */
-
        struct uvm_map_addr     addr;           /* Entry tree, by addr */
+       u_int                   serial;         /* signals stack changes */
 
-       vsize_t                 size;           /* virtual size */
        int                     ref_count;      /* Reference count */
        int                     flags;          /* flags */
-       struct mutex            flags_lock;     /* flags lock */
        unsigned int            timestamp;      /* Version number */
+       struct mutex            flags_lock;     /* flags lock */
 
+       vsize_t                 size;           /* virtual size */
        vaddr_t                 min_offset;     /* First address in map. */
        vaddr_t                 max_offset;     /* Last address in map. */
 

Reply via email to