linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [REVERT for 3.1-rc7] staging: zcache: revert "fix crash on high memory swap"
@ 2011-09-13 17:37 Dan Magenheimer
  2011-09-13 18:56 ` Seth Jennings
  0 siblings, 1 reply; 9+ messages in thread
From: Dan Magenheimer @ 2011-09-13 17:37 UTC (permalink / raw)
  To: Greg KH
  Cc: Francis Moreau, gregkh, Seth Jennings, devel, linux-mm,
	Nitin Gupta, linux-kernel

Hi Greg --

Please revert the following commit, hopefully before 3.1 is released.
Although it fixes a crash in 32-bit systems with high memory,
the fix apparently *causes* crashes on 64-bit systems.  Not sure why
my testing didn't catch it before but it has now been observed in
the wild in 3.1-rc4 and I can reproduce it now fairly easily.
3.1-rc3 works fine, 3.1-rc4 fails, and 3.1-rc3 plus only this
commit fails.  Let's revert it before 3.1 and Seth and Nitin and I
will sort out a better fix later.

Reported-by: Francis Moreau <francis.moro@gmail.com>
Reproduced-by: Dan Magenheimer <dan.magenheimer@oracle.com>

Thanks,
Dan

commit c5f5c4db393837ebb2ae47bf061d70e498f48f8c
Author: Seth Jennings <sjenning@linux.vnet.ibm.com>
Date:   Wed Aug 10 12:56:49 2011 -0500

    staging: zcache: fix crash on high memory swap
    
    zcache_put_page() was modified to pass page_address(page) instead of the
    actual page structure. In combination with the function signature changes
    to tmem_put() and zcache_pampd_create(), zcache_pampd_create() tries to
    (re)derive the page structure from the virtual address.  However, if the
    original page is a high memory page (or any unmapped page), this
    virt_to_page() fails because the page_address() in zcache_put_page()
    returned NULL.
    
    This patch changes zcache_put_page() and zcache_get_page() to pass
    the page structure instead of the page's virtual address, which
    may or may not exist.
    
    Signed-off-by: Seth Jennings <sjenning@linux.vnet.ibm.com>
    Acked-by: Dan Magenheimer <dan.magenheimer@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

diff --git a/drivers/staging/zcache/zcache-main.c b/drivers/staging/zcache/zcache-main.c
index 855a5bb..a3f5162 100644
--- a/drivers/staging/zcache/zcache-main.c
+++ b/drivers/staging/zcache/zcache-main.c
@@ -1158,7 +1158,7 @@ static void *zcache_pampd_create(char *data, size_t size, bool raw, int eph,
 	size_t clen;
 	int ret;
 	unsigned long count;
-	struct page *page = virt_to_page(data);
+	struct page *page = (struct page *)(data);
 	struct zcache_client *cli = pool->client;
 	uint16_t client_id = get_client_id_from_client(cli);
 	unsigned long zv_mean_zsize;
@@ -1227,7 +1227,7 @@ static int zcache_pampd_get_data(char *data, size_t *bufsize, bool raw,
 	int ret = 0;
 
 	BUG_ON(is_ephemeral(pool));
-	zv_decompress(virt_to_page(data), pampd);
+	zv_decompress((struct page *)(data), pampd);
 	return ret;
 }
 
@@ -1539,7 +1539,7 @@ static int zcache_put_page(int cli_id, int pool_id, struct tmem_oid *oidp,
 		goto out;
 	if (!zcache_freeze && zcache_do_preload(pool) == 0) {
 		/* preload does preempt_disable on success */
-		ret = tmem_put(pool, oidp, index, page_address(page),
+		ret = tmem_put(pool, oidp, index, (char *)(page),
 				PAGE_SIZE, 0, is_ephemeral(pool));
 		if (ret < 0) {
 			if (is_ephemeral(pool))
@@ -1572,7 +1572,7 @@ static int zcache_get_page(int cli_id, int pool_id, struct tmem_oid *oidp,
 	pool = zcache_get_pool_by_id(cli_id, pool_id);
 	if (likely(pool != NULL)) {
 		if (atomic_read(&pool->obj_count) > 0)
-			ret = tmem_get(pool, oidp, index, page_address(page),
+			ret = tmem_get(pool, oidp, index, (char *)(page),
 					&size, 0, is_ephemeral(pool));
 		zcache_put_pool(pool);
 	}

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-09-16 18:08 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-13 17:37 [REVERT for 3.1-rc7] staging: zcache: revert "fix crash on high memory swap" Dan Magenheimer
2011-09-13 18:56 ` Seth Jennings
2011-09-13 19:19   ` [PATCH] staging: zcache: fix cleancache crash Seth Jennings
2011-09-13 20:56     ` Dan Magenheimer
2011-09-14  9:26       ` Francis Moreau
2011-09-14 21:02         ` Francis Moreau
2011-09-15 14:16       ` Dan Magenheimer
2011-09-16 17:55         ` Greg KH
2011-09-15 23:56     ` Valdis.Kletnieks

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).