patch for 2.1.109 mm/page_io.c error messages

Bill Hawes (whawes@star.net)
Fri, 17 Jul 1998 14:40:56 -0400


This is a multi-part message in MIME format.
--------------E6913525D10987048E9E13C5
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

The attached patch cleans up the error messages in mm/page_io.c, adding
a KERN_ERR classification and function name where needed.

It also adds a test message to check pages lost due to becoming unused
while being swapped out. This shouldn't happen, but I can't see that
it's impossible, and it would be a difficult-to-detect memory leak.

Regards,
Bill
--------------E6913525D10987048E9E13C5
Content-Type: text/plain; charset=us-ascii; name="mm_pageio109-patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="mm_pageio109-patch"

--- linux-2.1.109/mm/page_io.c.old Fri Jul 3 10:32:34 1998
+++ linux-2.1.109/mm/page_io.c Fri Jul 17 10:14:13 1998
@@ -74,18 +74,19 @@
return;
}
if (p->swap_map && !p->swap_map[offset]) {
- printk("Hmm.. Trying to %s unallocated swap (%08lx)\n",
- (rw == READ) ? "read" : "write",
- entry);
+ printk(KERN_ERR "rw_swap_page: "
+ "Trying to %s unallocated swap (%08lx)\n",
+ (rw == READ) ? "read" : "write", entry);
return;
}
if (!(p->flags & SWP_USED)) {
- printk("Trying to swap to unused swap-device\n");
+ printk(KERN_ERR "rw_swap_page: "
+ "Trying to swap to unused swap-device\n");
return;
}

if (!PageLocked(page)) {
- printk("VM: swap page is unlocked\n");
+ printk(KERN_ERR "VM: swap page is unlocked\n");
return;
}

@@ -111,11 +112,11 @@
* hashing for locked pages.
*/
if (!PageSwapCache(page)) {
- printk("VM: swap page is not in swap cache\n");
+ printk(KERN_ERR "VM: swap page is not in swap cache\n");
return;
}
if (page->offset != entry) {
- printk ("swap entry mismatch");
+ printk (KERN_ERR "VM: swap entry mismatch\n");
return;
}

@@ -179,11 +180,14 @@
clear_bit(PG_locked, &page->flags);
wake_up(&page->wait);
} else
- printk("rw_swap_page: no swap file or device\n");
+ printk(KERN_ERR "rw_swap_page: no swap file or device\n");

+ /* This shouldn't happen, but check to be sure. */
+ if (atomic_read(&page->count) == 1)
+ printk(KERN_ERR "rw_swap_page: page unused while waiting!\n");
atomic_dec(&page->count);
if (offset && !test_and_clear_bit(offset,p->swap_lockmap))
- printk("rw_swap_page: lock already cleared\n");
+ printk(KERN_ERR "rw_swap_page: lock already cleared\n");
wake_up(&lock_queue);
#ifdef DEBUG_SWAP
printk ("DebugVM: %s_swap_page finished on page %p (count %d)\n",

--------------E6913525D10987048E9E13C5--

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html