[Bluetooth] Support create connection cancel command
[pandora-kernel.git] / mm / swap.c
index 8fd095c..2e0e871 100644 (file)
--- a/mm/swap.c
+++ b/mm/swap.c
 /* How many pages do we try to swap or page in/out together? */
 int page_cluster;
 
+/*
+ * This path almost never happens for VM activity - pages are normally
+ * freed via pagevecs.  But it gets used by networking.
+ */
+static void fastcall __page_cache_release(struct page *page)
+{
+       if (PageLRU(page)) {
+               unsigned long flags;
+               struct zone *zone = page_zone(page);
+
+               spin_lock_irqsave(&zone->lru_lock, flags);
+               VM_BUG_ON(!PageLRU(page));
+               __ClearPageLRU(page);
+               del_page_from_lru(zone, page);
+               spin_unlock_irqrestore(&zone->lru_lock, flags);
+       }
+       free_hot_page(page);
+}
+
 static void put_compound_page(struct page *page)
 {
        page = (struct page *)page_private(page);
@@ -54,6 +73,26 @@ void put_page(struct page *page)
 }
 EXPORT_SYMBOL(put_page);
 
+/**
+ * put_pages_list(): release a list of pages
+ *
+ * Release a list of pages which are strung together on page.lru.  Currently
+ * used by read_cache_pages() and related error recovery code.
+ *
+ * @pages: list of pages threaded on page->lru
+ */
+void put_pages_list(struct list_head *pages)
+{
+       while (!list_empty(pages)) {
+               struct page *victim;
+
+               victim = list_entry(pages->prev, struct page, lru);
+               list_del(&victim->lru);
+               page_cache_release(victim);
+       }
+}
+EXPORT_SYMBOL(put_pages_list);
+
 /*
  * Writeback is about to end against a page which has been marked for immediate
  * reclaim.  If it still appears to be reclaimable, move it to the tail of the
@@ -202,26 +241,6 @@ int lru_add_drain_all(void)
 }
 #endif
 
-/*
- * This path almost never happens for VM activity - pages are normally
- * freed via pagevecs.  But it gets used by networking.
- */
-void fastcall __page_cache_release(struct page *page)
-{
-       if (PageLRU(page)) {
-               unsigned long flags;
-               struct zone *zone = page_zone(page);
-
-               spin_lock_irqsave(&zone->lru_lock, flags);
-               BUG_ON(!PageLRU(page));
-               __ClearPageLRU(page);
-               del_page_from_lru(zone, page);
-               spin_unlock_irqrestore(&zone->lru_lock, flags);
-       }
-       free_hot_page(page);
-}
-EXPORT_SYMBOL(__page_cache_release);
-
 /*
  * Batched page_cache_release().  Decrement the reference count on all the
  * passed pages.  If it fell to zero then remove the page from the LRU and
@@ -264,7 +283,7 @@ void release_pages(struct page **pages, int nr, int cold)
                                zone = pagezone;
                                spin_lock_irq(&zone->lru_lock);
                        }
-                       BUG_ON(!PageLRU(page));
+                       VM_BUG_ON(!PageLRU(page));
                        __ClearPageLRU(page);
                        del_page_from_lru(zone, page);
                }
@@ -317,7 +336,7 @@ void __pagevec_release_nonlru(struct pagevec *pvec)
        for (i = 0; i < pagevec_count(pvec); i++) {
                struct page *page = pvec->pages[i];
 
-               BUG_ON(PageLRU(page));
+               VM_BUG_ON(PageLRU(page));
                if (put_page_testzero(page))
                        pagevec_add(&pages_to_free, page);
        }
@@ -344,7 +363,7 @@ void __pagevec_lru_add(struct pagevec *pvec)
                        zone = pagezone;
                        spin_lock_irq(&zone->lru_lock);
                }
-               BUG_ON(PageLRU(page));
+               VM_BUG_ON(PageLRU(page));
                SetPageLRU(page);
                add_page_to_inactive_list(zone, page);
        }
@@ -371,9 +390,9 @@ void __pagevec_lru_add_active(struct pagevec *pvec)
                        zone = pagezone;
                        spin_lock_irq(&zone->lru_lock);
                }
-               BUG_ON(PageLRU(page));
+               VM_BUG_ON(PageLRU(page));
                SetPageLRU(page);
-               BUG_ON(PageActive(page));
+               VM_BUG_ON(PageActive(page));
                SetPageActive(page);
                add_page_to_active_list(zone, page);
        }