Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 6854
b: refs/heads/master
c: 048c27f
h: refs/heads/master
v: v3
  • Loading branch information
Hugh Dickins authored and Linus Torvalds committed Sep 5, 2005
1 parent 14c73c9 commit f91213c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 52b7efdbe5f5696fc80338560a3fc51e0b0a993c
refs/heads/master: 048c27fd72816b44e096997d1c6901c3abbfd45b
14 changes: 12 additions & 2 deletions trunk/mm/swapfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ static DECLARE_MUTEX(swapon_sem);
*/
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;
Expand All @@ -84,9 +82,13 @@ void swap_unplug_io_fn(struct backing_dev_info *unused_bdi, struct page *page)
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
Expand Down Expand Up @@ -117,6 +119,10 @@ static inline unsigned long scan_swap_map(struct swap_info_struct *si)
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;
Expand Down Expand Up @@ -153,6 +159,10 @@ checks: if (!(si->flags & SWP_WRITEOK))
swap_device_lock(si);
goto checks;
}
if (unlikely(--latency_ration < 0)) {
cond_resched();
latency_ration = LATENCY_LIMIT;
}
}
swap_device_lock(si);
goto lowest;
Expand Down

0 comments on commit f91213c

Please sign in to comment.