Linux Headquarters
[ Register ]
[ About us ] [ Home Page ]

Advertisement
[ Kernel ] [ Documentation ] [ Links ] [ Books ]

Advertisement

Kernel v2.4.27 /mm/page_alloc.c

Filename:/mm/page_alloc.c
Lines Added:42
Lines Deleted:3
Also changed in: (Previous) 2.4.27-rc6  2.4.27-rc5  2.4.27-rc4  2.4.27-rc3  2.4.27-rc2  2.4.27-rc1 
(Following) 2.4.28-pre1  2.4.28-pre2  2.4.28-pre3  2.4.28-pre4  2.4.28-rc1  2.4.28-rc2 

Location
[  2.4.27
  [  mm
     o  page_alloc.c

Patch

diff -urN linux-2.4.26/mm/page_alloc.c linux-2.4.27/mm/page_alloc.c
--- linux-2.4.26/mm/page_alloc.c   2004-02-18 05:36:32.000000000 -0800
+++ linux-2.4.27/mm/page_alloc.c   2004-08-07 16:26:06.506422876 -0700
@@ -46,6 +46,34 @@
 
 int vm_gfp_debug = 0;
 
+static void FASTCALL(__free_pages_ok (struct page *page, unsigned int order));
+
+static spinlock_t free_pages_ok_no_irq_lock = SPIN_LOCK_UNLOCKED;
+struct page * free_pages_ok_no_irq_head;
+
+static void do_free_pages_ok_no_irq(void * arg)
+{
+       struct page * page, * __page;
+
+       spin_lock_irq(&free_pages_ok_no_irq_lock);
+
+       page = free_pages_ok_no_irq_head;
+       free_pages_ok_no_irq_head = NULL;
+
+       spin_unlock_irq(&free_pages_ok_no_irq_lock);
+
+       while (page) {
+               __page = page;
+               page = page->next_hash;
+               __free_pages_ok(__page, __page->index);
+       }
+}
+
+static struct tq_struct free_pages_ok_no_irq_task = {
+       .routine        = do_free_pages_ok_no_irq,
+};
+
+
 /*
  * Temporary debugging check.
  */
@@ -81,7 +109,6 @@
  * -- wli
  */
 
-static void FASTCALL(__free_pages_ok (struct page *page, unsigned int order));
 static void __free_pages_ok (struct page *page, unsigned int order)
 {
    unsigned long index, page_idx, mask, flags;
@@ -94,8 +121,20 @@
     * a reference to a page in order to pin it for io. -ben
     */
    if (PageLRU(page)) {
-      if (unlikely(in_interrupt()))
-         BUG();
+      if (unlikely(in_interrupt())) {
+         unsigned long flags;
+
+         spin_lock_irqsave(&free_pages_ok_no_irq_lock, flags);
+         page->next_hash = free_pages_ok_no_irq_head;
+         free_pages_ok_no_irq_head = page;
+         page->index = order;
+   
+         spin_unlock_irqrestore(&free_pages_ok_no_irq_lock, flags);
+   
+         schedule_task(&free_pages_ok_no_irq_task);
+         return;
+      }
+      
       lru_cache_del(page);
    }
 


Comments: webmaster (at) linuxhq.com.
Advertising: banners (at) linuxhq.com.
Compilation ©1998-2008 Linux Headquarters, Inc.