public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch 2/13] remove pages from the LRU in __free_pages_ok()
@ 2002-07-28  7:32 Andrew Morton
  2002-07-28 23:54 ` Linus Torvalds
  0 siblings, 1 reply; 29+ messages in thread
From: Andrew Morton @ 2002-07-28  7:32 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: lkml



There are some situations where a page's final release is performed by
put_page().  Such as in access_process_vm().  This tends to go BUG()
because the page is on the LRU.

The patch changes __free_pages_ok() to remove the page from the LRU
in this case, as in 2.4.

We need to make changes to this code again later - I have workloads in
which page_cache_release() consumes 5% of CPU resources.  But this
should keep people out of trouble meanwhile.



 page_alloc.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

--- 2.5.29/mm/page_alloc.c~lru-removal	Sat Jul 27 23:38:59 2002
+++ 2.5.29-akpm/mm/page_alloc.c	Sat Jul 27 23:49:03 2002
@@ -89,10 +89,14 @@ static void __free_pages_ok (struct page
 
 	KERNEL_STAT_ADD(pgfree, 1<<order);
 
+	if (PageLRU(page)) {
+		BUG_ON(in_interrupt());		/* It could deadlock */
+		lru_cache_del(page);
+	}
+
 	BUG_ON(PagePrivate(page));
 	BUG_ON(page->mapping != NULL);
 	BUG_ON(PageLocked(page));
-	BUG_ON(PageLRU(page));
 	BUG_ON(PageActive(page));
 	BUG_ON(PageWriteback(page));
 	BUG_ON(page->pte.chain != NULL);
@@ -451,11 +455,8 @@ unsigned long get_zeroed_page(unsigned i
 
 void page_cache_release(struct page *page)
 {
-	if (!PageReserved(page) && put_page_testzero(page)) {
-		if (PageLRU(page))
-			lru_cache_del(page);
+	if (!PageReserved(page) && put_page_testzero(page))
 		__free_pages_ok(page, 0);
-	}
 }
 
 void __free_pages(struct page *page, unsigned int order)

.

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

end of thread, other threads:[~2002-08-04  3:04 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-07-28  7:32 [patch 2/13] remove pages from the LRU in __free_pages_ok() Andrew Morton
2002-07-28 23:54 ` Linus Torvalds
2002-07-29  0:32   ` Andrew Morton
2002-07-29  0:37     ` Linus Torvalds
2002-07-29  0:59       ` Andrew Morton
2002-07-29  0:59         ` Rik van Riel
2002-07-29  2:50     ` David S. Miller
2002-07-29  3:51       ` Linus Torvalds
2002-07-29  3:43         ` David S. Miller
2002-07-29  4:21           ` Linus Torvalds
2002-07-29  5:43             ` David S. Miller
2002-07-29  6:16               ` Linus Torvalds
2002-07-29  6:10                 ` David S. Miller
2002-07-29  6:27                   ` Linus Torvalds
2002-07-29  6:59                     ` Andrew Morton
2002-07-30 11:30                     ` Ed Tomlinson
     [not found]                     ` <200208011942.49342.tomlins@cam.org>
     [not found]                       ` <3D49C951.AB7C527E@zip.com.au>
2002-08-03 19:27                         ` [PATCH] slablru for linux-2.5 bk tree Ed Tomlinson
2002-08-03 20:43                           ` Rik van Riel
2002-08-04  3:17                           ` Andrew Morton
2002-07-29  8:35                 ` [patch 2/13] remove pages from the LRU in __free_pages_ok() Rik van Riel
2002-07-29  4:25           ` Andrew Morton
2002-07-29  4:28             ` Linus Torvalds
2002-07-29  4:52               ` Andrew Morton
2002-07-29  4:50                 ` Linus Torvalds
2002-07-29  5:15                   ` Andrew Morton
2002-07-29  4:17         ` Andrew Morton
2002-07-29  4:23           ` Linus Torvalds
2002-07-29  5:43           ` David S. Miller
2002-07-29  6:24           ` Paul Mackerras

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