Padding in MCS-PDR qnodes (XCC)
authorBarret Rhoden <brho@cs.berkeley.edu>
Wed, 20 Mar 2013 23:29:32 +0000 (16:29 -0700)
committerBarret Rhoden <brho@cs.berkeley.edu>
Wed, 20 Mar 2013 23:29:32 +0000 (16:29 -0700)
Check the comment about weird padding issues.  Either way, we want some
padding.  Too much wasn't right either, for some reason.

Reinstall kernel headers.

kern/include/ros/ucq.h
user/parlib/include/mcs.h

index 510b722..09e632d 100644 (file)
@@ -34,7 +34,7 @@ struct ucq {
        atomic_t                                        cons_idx;               /* cons pg and slot nr */
        bool                                            ucq_ready;              /* ucq is ready to be used */
        /* Userspace lock for modifying the UCQ */
-       void                                            *u_lock[2];             /* sizeof an mcs_pdr_lock */
+       char                                            u_lock[2 * ARCH_CL_SIZE];       /* mcs_pdr_lock */
 };
 
 /* Struct at the beginning of every page/buffer, tracking consumers and
index 8d6dfe1..624ca4e 100644 (file)
@@ -68,9 +68,14 @@ struct mcs_pdr_qnode
        uint32_t vcoreid;
 }__attribute__((aligned(ARCH_CL_SIZE)));
 
+/* Want to pad out so lock doesn't share a CL with qnodes.  If we align both
+ * pointers so that they have their own cache line, this actually performs
+ * worse.  Meaning (for some unknown reason), if the lock shares a CL with
+ * other random bss/data, the lock tests perf better... */
 struct mcs_pdr_lock
 {
        struct mcs_pdr_qnode *lock;
+       char padding[ARCH_CL_SIZE];
        struct mcs_pdr_qnode *vc_qnodes;        /* malloc this at init time */
 };