lkml.org 
[lkml]   [1998]   [Jul]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subjectpatch for 2.1.109 mm/page_io.c error messages
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--- 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",
\
 
 \ /
  Last update: 2005-03-22 13:43    [from the cache]
©2003-2011 Jasper Spaans