*/
static DECLARE_RWSEM(swap_unplug_sem);
-#define SWAPFILE_CLUSTER 256
-
void swap_unplug_io_fn(struct backing_dev_info *unused_bdi, struct page *page)
{
swp_entry_t entry;
up_read(&swap_unplug_sem);
}
+#define SWAPFILE_CLUSTER 256
+#define LATENCY_LIMIT 256
+
static inline unsigned long scan_swap_map(struct swap_info_struct *si)
{
unsigned long offset, last_in_cluster;
+ int latency_ration = LATENCY_LIMIT;
/*
* We try to cluster swap pages by allocating them sequentially
si->cluster_next = offset-SWAPFILE_CLUSTER-1;
goto cluster;
}
+ if (unlikely(--latency_ration < 0)) {
+ cond_resched();
+ latency_ration = LATENCY_LIMIT;
+ }
}
swap_device_lock(si);
goto lowest;
swap_device_lock(si);
goto checks;
}
+ if (unlikely(--latency_ration < 0)) {
+ cond_resched();
+ latency_ration = LATENCY_LIMIT;
+ }
}
swap_device_lock(si);
goto lowest;