Re: pre12 VM doubts and patch

From: Andrea Arcangeli (andrea@suse.de)
Date: Wed Sep 19 2001 - 18:49:05 EST


On Thu, Sep 20, 2001 at 01:31:53AM +0200, Andrea Arcangeli wrote:
> --- 2.4.10pre11aa1/mm/vmscan.c.~1~ Tue Sep 18 21:23:49 2001
> +++ 2.4.10pre11aa1/mm/vmscan.c Thu Sep 20 01:29:58 2001
> @@ -415,7 +415,10 @@
> spin_unlock(&pagemap_lru_lock);
>
> ClearPageDirty(page);
> +
> + page_cache_get(page);
> writepage(page);
> + page_cache_release(page);
>
> spin_lock(&pagemap_lru_lock);
> continue;

then in turn we can backout this bit (patch -R)

diff -urN 2.4.10pre11/mm/page_io.c 2.4.10pre12/mm/page_io.c
--- 2.4.10pre11/mm/page_io.c Tue May 1 19:35:33 2001
+++ 2.4.10pre12/mm/page_io.c Thu Sep 20 01:44:20 2001
@@ -78,7 +78,15 @@
          if (!wait) {
                  SetPageDecrAfter(page);
                  atomic_inc(&nr_async_pages);
- }
+ } else
+ /*
+ * Must hold a reference until after wait_on_page()
+ * returned or it could be freed by the VM after
+ * I/O is completed and the page is been unlocked.
+ * The asynchronous path is fine since it never
+ * references the page after brw_page().
+ */
+ page_cache_get(page);
 
          /* block_size == PAGE_SIZE/zones_used */
          brw_page(rw, page, dev, zones, block_size);
@@ -94,6 +102,7 @@
         /* This shouldn't happen, but check to be sure. */
         if (page_count(page) == 0)
                 printk(KERN_ERR "rw_swap_page: page unused while waiting!\n");
+ page_cache_release(page);
 
         return 1;
 }

Andrea
-
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/



This archive was generated by hypermail 2b29 : Sun Sep 23 2001 - 21:00:34 EST