diff options
Diffstat (limited to 'mm/swap.c')
-rw-r--r-- | mm/swap.c | 49 |
1 files changed, 24 insertions, 25 deletions
@@ -34,6 +34,25 @@ | |||
34 | /* How many pages do we try to swap or page in/out together? */ | 34 | /* How many pages do we try to swap or page in/out together? */ |
35 | int page_cluster; | 35 | int page_cluster; |
36 | 36 | ||
37 | /* | ||
38 | * This path almost never happens for VM activity - pages are normally | ||
39 | * freed via pagevecs. But it gets used by networking. | ||
40 | */ | ||
41 | static void fastcall __page_cache_release(struct page *page) | ||
42 | { | ||
43 | if (PageLRU(page)) { | ||
44 | unsigned long flags; | ||
45 | struct zone *zone = page_zone(page); | ||
46 | |||
47 | spin_lock_irqsave(&zone->lru_lock, flags); | ||
48 | VM_BUG_ON(!PageLRU(page)); | ||
49 | __ClearPageLRU(page); | ||
50 | del_page_from_lru(zone, page); | ||
51 | spin_unlock_irqrestore(&zone->lru_lock, flags); | ||
52 | } | ||
53 | free_hot_page(page); | ||
54 | } | ||
55 | |||
37 | static void put_compound_page(struct page *page) | 56 | static void put_compound_page(struct page *page) |
38 | { | 57 | { |
39 | page = (struct page *)page_private(page); | 58 | page = (struct page *)page_private(page); |
@@ -223,26 +242,6 @@ int lru_add_drain_all(void) | |||
223 | #endif | 242 | #endif |
224 | 243 | ||
225 | /* | 244 | /* |
226 | * This path almost never happens for VM activity - pages are normally | ||
227 | * freed via pagevecs. But it gets used by networking. | ||
228 | */ | ||
229 | void fastcall __page_cache_release(struct page *page) | ||
230 | { | ||
231 | if (PageLRU(page)) { | ||
232 | unsigned long flags; | ||
233 | struct zone *zone = page_zone(page); | ||
234 | |||
235 | spin_lock_irqsave(&zone->lru_lock, flags); | ||
236 | BUG_ON(!PageLRU(page)); | ||
237 | __ClearPageLRU(page); | ||
238 | del_page_from_lru(zone, page); | ||
239 | spin_unlock_irqrestore(&zone->lru_lock, flags); | ||
240 | } | ||
241 | free_hot_page(page); | ||
242 | } | ||
243 | EXPORT_SYMBOL(__page_cache_release); | ||
244 | |||
245 | /* | ||
246 | * Batched page_cache_release(). Decrement the reference count on all the | 245 | * Batched page_cache_release(). Decrement the reference count on all the |
247 | * passed pages. If it fell to zero then remove the page from the LRU and | 246 | * passed pages. If it fell to zero then remove the page from the LRU and |
248 | * free it. | 247 | * free it. |
@@ -284,7 +283,7 @@ void release_pages(struct page **pages, int nr, int cold) | |||
284 | zone = pagezone; | 283 | zone = pagezone; |
285 | spin_lock_irq(&zone->lru_lock); | 284 | spin_lock_irq(&zone->lru_lock); |
286 | } | 285 | } |
287 | BUG_ON(!PageLRU(page)); | 286 | VM_BUG_ON(!PageLRU(page)); |
288 | __ClearPageLRU(page); | 287 | __ClearPageLRU(page); |
289 | del_page_from_lru(zone, page); | 288 | del_page_from_lru(zone, page); |
290 | } | 289 | } |
@@ -337,7 +336,7 @@ void __pagevec_release_nonlru(struct pagevec *pvec) | |||
337 | for (i = 0; i < pagevec_count(pvec); i++) { | 336 | for (i = 0; i < pagevec_count(pvec); i++) { |
338 | struct page *page = pvec->pages[i]; | 337 | struct page *page = pvec->pages[i]; |
339 | 338 | ||
340 | BUG_ON(PageLRU(page)); | 339 | VM_BUG_ON(PageLRU(page)); |
341 | if (put_page_testzero(page)) | 340 | if (put_page_testzero(page)) |
342 | pagevec_add(&pages_to_free, page); | 341 | pagevec_add(&pages_to_free, page); |
343 | } | 342 | } |
@@ -364,7 +363,7 @@ void __pagevec_lru_add(struct pagevec *pvec) | |||
364 | zone = pagezone; | 363 | zone = pagezone; |
365 | spin_lock_irq(&zone->lru_lock); | 364 | spin_lock_irq(&zone->lru_lock); |
366 | } | 365 | } |
367 | BUG_ON(PageLRU(page)); | 366 | VM_BUG_ON(PageLRU(page)); |
368 | SetPageLRU(page); | 367 | SetPageLRU(page); |
369 | add_page_to_inactive_list(zone, page); | 368 | add_page_to_inactive_list(zone, page); |
370 | } | 369 | } |
@@ -391,9 +390,9 @@ void __pagevec_lru_add_active(struct pagevec *pvec) | |||
391 | zone = pagezone; | 390 | zone = pagezone; |
392 | spin_lock_irq(&zone->lru_lock); | 391 | spin_lock_irq(&zone->lru_lock); |
393 | } | 392 | } |
394 | BUG_ON(PageLRU(page)); | 393 | VM_BUG_ON(PageLRU(page)); |
395 | SetPageLRU(page); | 394 | SetPageLRU(page); |
396 | BUG_ON(PageActive(page)); | 395 | VM_BUG_ON(PageActive(page)); |
397 | SetPageActive(page); | 396 | SetPageActive(page); |
398 | add_page_to_active_list(zone, page); | 397 | add_page_to_active_list(zone, page); |
399 | } | 398 | } |