Re: 2.4 and 2GB swap partition limit

David S. Miller (davem@redhat.com)
Tue, 1 May 2001 17:34:28 -0700 (PDT)


Rik van Riel writes:
> Then we will be scanning through memory looking for something to
> swap out (otherwise we'd not be in need of swap space, right?).
> At this point we can simply free up swap entries while scanning
> through memory looking for stuff to swap out.

Sounds a lot like my patch I posted a few weeks ago:

--- mm/vmscan.c.~1~ Wed Apr 11 19:05:59 2001
+++ mm/vmscan.c Thu Apr 12 17:19:51 2001
@@ -441,8 +441,14 @@
maxscan = nr_inactive_dirty_pages;
while ((page_lru = inactive_dirty_list.prev) != &inactive_dirty_list &&
maxscan-- > 0) {
+ int dead_swap_page;
+
page = list_entry(page_lru, struct page, lru);

+ dead_swap_page =
+ (PageSwapCache(page) &&
+ page_count(page) == (1 + !!page->buffers));
+
/* Wrong page on list?! (list corruption, should not happen) */
if (!PageInactiveDirty(page)) {
printk("VM: page_launder, wrong page on list.\n");
@@ -453,9 +459,10 @@
}

/* Page is or was in use? Move it to the active list. */
- if (PageTestandClearReferenced(page) || page->age > 0 ||
- (!page->buffers && page_count(page) > 1) ||
- page_ramdisk(page)) {
+ if (!dead_swap_page &&
+ (PageTestandClearReferenced(page) || page->age > 0 ||
+ (!page->buffers && page_count(page) > 1) ||
+ page_ramdisk(page))) {
del_page_from_inactive_dirty_list(page);
add_page_to_active_list(page);
continue;
@@ -481,8 +488,11 @@
if (!writepage)
goto page_active;

- /* First time through? Move it to the back of the list */
- if (!launder_loop) {
+ /* First time through? Move it to the back of the list,
+ * but not if it is a dead swap page. We want to reap
+ * those as fast as possible.
+ */
+ if (!launder_loop && !dead_swap_page) {
list_del(page_lru);
list_add(page_lru, &inactive_dirty_list);
UnlockPage(page);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/