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

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

Advertisement

Kernel v2.6.24 /mm/swap_state.c

Filename:/mm/swap_state.c
Lines Added:4
Lines Deleted:1
Also changed in: (Previous) 2.6.24-rc8  2.6.24-rc7  2.6.24-rc6  2.6.24-rc5  2.6.24-rc4  2.6.24-rc3 
(Following) 2.6.24-git15  2.6.24-git16  2.6.24-git17  2.6.24-git18  2.6.24-git19  2.6.24-git20 

Location
[  2.6.24
  [  mm
     o  swap_state.c

Patch

diff --git a/mm/swap_state.c b/mm/swap_state.c
index 67daecb..b526356 100644
--- a/mm/swap_state.c
+++ b/mm/swap_state.c
@@ -74,6 +74,7 @@ static int __add_to_swap_cache(struct page *page, swp_entry_t entry,
 {
    int error;
 
+   BUG_ON(!PageLocked(page));
    BUG_ON(PageSwapCache(page));
    BUG_ON(PagePrivate(page));
    error = radix_tree_preload(gfp_mask);
@@ -83,7 +84,6 @@ static int __add_to_swap_cache(struct page *page, swp_entry_t entry,
                   entry.val, page);
       if (!error) {
          page_cache_get(page);
-         SetPageLocked(page);
          SetPageSwapCache(page);
          set_page_private(page, entry.val);
          total_swapcache_pages++;
@@ -99,15 +99,18 @@ static int add_to_swap_cache(struct page *page, swp_entry_t entry)
 {
    int error;
 
+   BUG_ON(PageLocked(page));
    if (!swap_duplicate(entry)) {
       INC_CACHE_INFO(noent_race);
       return -ENOENT;
    }
+   SetPageLocked(page);
    error = __add_to_swap_cache(page, entry, GFP_KERNEL);
    /*
     * Anon pages are already on the LRU, we don't run lru_cache_add here.
     */
    if (error) {
+      ClearPageLocked(page);
       swap_free(entry);
       if (error == -EEXIST)
          INC_CACHE_INFO(exist_race);


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