diff --git a/dist/flags.py b/dist/flags.py
index 9b0c87a68..3e7cf858b 100755
--- a/dist/flags.py
+++ b/dist/flags.py
@@ -41,6 +41,11 @@ def flag_declare(name):
                         " GENERATION STOP 32", file=sys.stderr)
                     sys.exit(1)
                 end = int(m.group(0))
+
+                poweroftwo = (end != 0) and ((end & (end-1)) == 0)
+                if not poweroftwo and end != 12:
+                    print(name + ": line " + str(lcnt) + " " + str(end) + " is not power of 2", file=sys.stderr)
+                    sys.exit(1)
                 # Compare the number of flags defined and against the number
                 # of flags allowed
                 if len(defines) > end - start:
diff --git a/src/btree/bt_debug.c b/src/btree/bt_debug.c
index 2e594da33..ca1aca410 100644
--- a/src/btree/bt_debug.c
+++ b/src/btree/bt_debug.c
@@ -1132,7 +1132,7 @@ __debug_page_metadata(WT_DBG *ds, WT_REF *ref)
         WT_RET(ds->f(ds, ", overflow-keys"));
     if (F_ISSET_ATOMIC(page, WT_PAGE_SPLIT_INSERT))
         WT_RET(ds->f(ds, ", split-insert"));
-    if (F_ISSET_ATOMIC(page, WT_PAGE_UPDATE_IGNORE))
+    if (F_ISSET_ATOMIC_16(page, WT_PAGE_UPDATE_IGNORE))
         WT_RET(ds->f(ds, ", update-ignore"));
 
     if (mod != NULL)
diff --git a/src/btree/bt_discard.c b/src/btree/bt_discard.c
index 2e8e333f9..6518c4473 100644
--- a/src/btree/bt_discard.c
+++ b/src/btree/bt_discard.c
@@ -150,7 +150,7 @@ __free_page_modify(WT_SESSION_IMPL *session, WT_PAGE *page)
     mod = page->modify;
 
     /* In some failed-split cases, we can't discard updates. */
-    update_ignore = F_ISSET_ATOMIC(page, WT_PAGE_UPDATE_IGNORE);
+    update_ignore = F_ISSET_ATOMIC_16(page, WT_PAGE_UPDATE_IGNORE);
 
     switch (mod->rec_result) {
     case WT_PM_REC_MULTIBLOCK:
diff --git a/src/btree/bt_split.c b/src/btree/bt_split.c
index 2c2b25524..69e7b397f 100644
--- a/src/btree/bt_split.c
+++ b/src/btree/bt_split.c
@@ -1613,7 +1613,7 @@ __split_multi_inmem_fail(WT_SESSION_IMPL *session, WT_PAGE *orig, WT_MULTI *mult
      */
     if (ref != NULL) {
         if (ref->page != NULL)
-            F_SET_ATOMIC(ref->page, WT_PAGE_UPDATE_IGNORE);
+            F_SET_ATOMIC_16(ref->page, WT_PAGE_UPDATE_IGNORE);
         __wt_free_ref(session, ref, orig->type, true);
     }
 }
diff --git a/src/evict/evict_lru.c b/src/evict/evict_lru.c
index d50e63782..f28c19c08 100644
--- a/src/evict/evict_lru.c
+++ b/src/evict/evict_lru.c
@@ -147,7 +147,7 @@ __evict_list_clear(WT_SESSION_IMPL *session, WT_EVICT_ENTRY *e)
 {
     if (e->ref != NULL) {
         WT_ASSERT(session, F_ISSET_ATOMIC(e->ref->page, WT_PAGE_EVICT_LRU));
-        F_CLR_ATOMIC(e->ref->page, WT_PAGE_EVICT_LRU);
+        F_CLR_ATOMIC_16(e->ref->page, WT_PAGE_EVICT_LRU);
     }
     e->ref = NULL;
     e->btree = WT_DEBUG_POINT;
diff --git a/src/include/btmem.h b/src/include/btmem.h
index ac13ed388..ca6196be3 100644
--- a/src/include/btmem.h
+++ b/src/include/btmem.h
@@ -669,8 +669,8 @@ struct __wt_page {
 #define WT_PAGE_OVERFLOW_KEYS 0x040u     /* Page has overflow keys */
 #define WT_PAGE_SPLIT_INSERT 0x080u      /* A leaf page was split for append */
 #define WT_PAGE_UPDATE_IGNORE 0x100u     /* Ignore updates on page discard */
-                                         /* AUTOMATIC FLAG VALUE GENERATION STOP 9 */
-    uint8_t flags_atomic;                /* Atomic flags, use F_*_ATOMIC */
+                                         /* AUTOMATIC FLAG VALUE GENERATION STOP 16 */
+    uint16_t flags_atomic;               /* Atomic flags, use F_*_ATOMIC */
 
     uint8_t unused[2]; /* Unused padding */
 
diff --git a/src/include/hardware.h b/src/include/hardware.h
index a313fbb81..e45d805c3 100644
--- a/src/include/hardware.h
+++ b/src/include/hardware.h
@@ -50,6 +50,28 @@
         } while (!__wt_atomic_cas8(&(p)->flags_atomic, __orig, __orig & ~(uint8_t)(mask))); \
     } while (0)
 
+#define F_ISSET_ATOMIC_16(p, mask) ((p)->flags_atomic & (uint16_t)(mask))
+
+#define F_SET_ATOMIC_16(p, mask)                                                             \
+    do {                                                                                     \
+        uint16_t __orig;                                                                     \
+        if (F_ISSET_ATOMIC_16(p, mask))                                                      \
+            break;                                                                           \
+        do {                                                                                 \
+            __orig = (p)->flags_atomic;                                                      \
+        } while (!__wt_atomic_cas16(&(p)->flags_atomic, __orig, __orig | (uint16_t)(mask))); \
+    } while (0)
+
+#define F_CLR_ATOMIC_16(p, mask)                                                              \
+    do {                                                                                      \
+        uint16_t __orig;                                                                      \
+        if (!F_ISSET_ATOMIC_16(p, mask))                                                      \
+            break;                                                                            \
+        do {                                                                                  \
+            __orig = (p)->flags_atomic;                                                       \
+        } while (!__wt_atomic_cas16(&(p)->flags_atomic, __orig, __orig & ~(uint16_t)(mask))); \
+    } while (0)
+
 /*
  * Cache line alignment.
  */
diff --git a/src/reconcile/rec_write.c b/src/reconcile/rec_write.c
index 20a66b93c..60288ba05 100644
--- a/src/reconcile/rec_write.c
+++ b/src/reconcile/rec_write.c
@@ -97,7 +97,7 @@ __wt_reconcile(WT_SESSION_IMPL *session, WT_REF *ref, WT_SALVAGE_COOKIE *salvage
     ret = __reconcile(session, ref, salvage, flags, &page_locked);
 
     /* If writing a page in service of compaction, we're done, clear the flag. */
-    F_CLR_ATOMIC(ref->page, WT_PAGE_COMPACTION_WRITE);
+    F_CLR_ATOMIC_16(ref->page, WT_PAGE_COMPACTION_WRITE);
 
 err:
     if (page_locked)