mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] Futex update III: don't use put_page...
@ 2002-06-06  7:04 Rusty Russell
  0 siblings, 0 replies; only message in thread
From: Rusty Russell @ 2002-06-06  7:04 UTC (permalink / raw)
  To: torvalds; +Cc: linux-kernel, frankeh, akpm

I know nothing of VM, but put_page on a page on the LRU list hits a
BUG() inside __free_pages_ok().  Andrew Morton said this was right.

Name: Unpin page bug fix.
Author: Rusty Russell
Status: Tested on 2.5.20

D: This uses page_cache_release() instead of put_page(), as it might
D: be a pagecache page.

diff -urN -I \$.*\$ --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.20.1460/kernel/futex.c linux-2.5.20.1460.updated/kernel/futex.c
--- linux-2.5.20.1460/kernel/futex.c	Sat May 25 14:35:00 2002
+++ linux-2.5.20.1460.updated/kernel/futex.c	Wed Jun  5 21:24:37 2002
@@ -33,6 +33,7 @@
 #include <linux/futex.h>
 #include <linux/highmem.h>
 #include <linux/time.h>
+#include <linux/pagemap.h>
 #include <asm/uaccess.h>
 
 /* These mutexes are a very simple counter: the winner is the one who
@@ -69,6 +70,14 @@
 	return &futex_queues[hash_long(h, FUTEX_HASHBITS)];
 }
 
+static inline void unpin_page(struct page *page)
+{
+	/* Avoid releasing the page which is on the LRU list.  I don't
+           know if this is correct, but it stops the BUG() in
+           __free_pages_ok(). */
+	page_cache_release(page);
+}
+
 static int futex_wake(struct list_head *head,
 		      struct page *page,
 		      unsigned int offset,
@@ -218,7 +227,7 @@
 	default:
 		ret = -EINVAL;
 	}
-	put_page(page);
+	unpin_page(page);
 
 	return ret;
 }

--
  Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-06-06  7:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-06-06  7:04 [PATCH] Futex update III: don't use put_page Rusty Russell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®