kernel - add yields in the swap pager freeing path
authorMatthew Dillon <dillon@apollo.backplane.com>
Thu, 21 Feb 2013 05:10:10 +0000 (21:10 -0800)
committerMatthew Dillon <dillon@apollo.backplane.com>
Thu, 21 Feb 2013 05:10:10 +0000 (21:10 -0800)
* Add yields in swp_pager_meta_free*().  This routine can loop
  heavily on very large VM objects and we don't want it to stall
  the cpu.

sys/vm/swap_pager.c

index a5a6f10..3d7e9b4 100644 (file)
@@ -2224,7 +2224,10 @@ swp_pager_meta_free_callback(struct swblock *swap, void *data)
                }
                ++index;
        }
+
        /* swap may be invalid here due to zfree above */
+       lwkt_yield();
+
        return(0);
 }
 
@@ -2261,6 +2264,7 @@ swp_pager_meta_free_all(vm_object_t object)
                        panic("swap_pager_meta_free_all: swb_count != 0");
                zfree(swap_zone, swap);
                --object->swblock_count;
+               lwkt_yield();
        }
        KKASSERT(object->swblock_count == 0);
 }