kernel - Add missing flag to vm_page_alloc() initializer.
authorMatthew Dillon <dillon@apollo.backplane.com>
Mon, 30 Jan 2017 04:25:42 +0000 (20:25 -0800)
committerMatthew Dillon <dillon@apollo.backplane.com>
Mon, 30 Jan 2017 17:50:19 +0000 (09:50 -0800)
* vm_page_alloc() (and the contig functions too) clear most vm_page->flags,
  but not all.  PG_ACTIONLIST was being improperly cleared.

* Fix the case (may fix occassional races in usched).

* Add a #define to ensure the flags we need to keep are defined in only
  one place.

sys/vm/vm_contig.c
sys/vm/vm_page.c
sys/vm/vm_page.h

index 474fa20..bd1dd73 100644 (file)
@@ -415,9 +415,7 @@ again:
                         * Clear all flags except PG_[S]BUSY and PG_WANTED,
                         * then unbusy the now allocated page.
                         */
-                       vm_page_flag_clear(m, ~(PG_BUSY |
-                                               PG_SBUSY |
-                                               PG_WANTED));
+                       vm_page_flag_clear(m, ~PG_KEEP_NEWPAGE_MASK);
                        vm_page_wire(m);
                        vm_page_wakeup(m);
                }
index 3b41d27..21c8abd 100644 (file)
@@ -1959,7 +1959,8 @@ done:
         * Initialize the structure, inheriting some flags but clearing
         * all the rest.  The page has already been busied for us.
         */
-       vm_page_flag_clear(m, ~(PG_BUSY | PG_SBUSY));
+       vm_page_flag_clear(m, ~PG_KEEP_NEWPAGE_MASK);
+
        KKASSERT(m->wire_count == 0);
        KKASSERT(m->busy == 0);
        m->act_count = 0;
index 95cc212..ce22990 100644 (file)
@@ -305,6 +305,10 @@ extern struct vpgqueues vm_page_queues[PQ_COUNT];
 #define PG_SBUSY       0x00020000      /* soft-busy also set */
 #define PG_NEED_COMMIT 0x00040000      /* clean page requires commit */
 
+#define PG_KEEP_NEWPAGE_MASK   (PG_BUSY | PG_SBUSY |           \
+                                PG_WANTED | PG_ACTIONLIST)
+
+
 /*
  * Misc constants.
  */