aboutsummaryrefslogtreecommitdiffstats
path: root/mm/swapfile.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/swapfile.c')
-rw-r--r--mm/swapfile.c29
1 files changed, 3 insertions, 26 deletions
diff --git a/mm/swapfile.c b/mm/swapfile.c
index beeeef8a1b2d..4c524f7bd0bf 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -523,13 +523,10 @@ static unsigned long scan_swap_map(struct swap_info_struct *si,
523 /* 523 /*
524 * If seek is expensive, start searching for new cluster from 524 * If seek is expensive, start searching for new cluster from
525 * start of partition, to minimize the span of allocated swap. 525 * start of partition, to minimize the span of allocated swap.
526 * But if seek is cheap, search from our current position, so 526 * If seek is cheap, that is the SWP_SOLIDSTATE si->cluster_info
527 * that swap is allocated from all over the partition: if the 527 * case, just handled by scan_swap_map_try_ssd_cluster() above.
528 * Flash Translation Layer only remaps within limited zones,
529 * we don't want to wear out the first zone too quickly.
530 */ 528 */
531 if (!(si->flags & SWP_SOLIDSTATE)) 529 scan_base = offset = si->lowest_bit;
532 scan_base = offset = si->lowest_bit;
533 last_in_cluster = offset + SWAPFILE_CLUSTER - 1; 530 last_in_cluster = offset + SWAPFILE_CLUSTER - 1;
534 531
535 /* Locate the first empty (unaligned) cluster */ 532 /* Locate the first empty (unaligned) cluster */
@@ -549,26 +546,6 @@ static unsigned long scan_swap_map(struct swap_info_struct *si,
549 } 546 }
550 } 547 }
551 548
552 offset = si->lowest_bit;
553 last_in_cluster = offset + SWAPFILE_CLUSTER - 1;
554
555 /* Locate the first empty (unaligned) cluster */
556 for (; last_in_cluster < scan_base; offset++) {
557 if (si->swap_map[offset])
558 last_in_cluster = offset + SWAPFILE_CLUSTER;
559 else if (offset == last_in_cluster) {
560 spin_lock(&si->lock);
561 offset -= SWAPFILE_CLUSTER - 1;
562 si->cluster_next = offset;
563 si->cluster_nr = SWAPFILE_CLUSTER - 1;
564 goto checks;
565 }
566 if (unlikely(--latency_ration < 0)) {
567 cond_resched();
568 latency_ration = LATENCY_LIMIT;
569 }
570 }
571
572 offset = scan_base; 549 offset = scan_base;
573 spin_lock(&si->lock); 550 spin_lock(&si->lock);
574 si->cluster_nr = SWAPFILE_CLUSTER - 1; 551 si->cluster_nr = SWAPFILE_CLUSTER - 1;