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

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

Advertisement

Kernel v2.4.11 /mm/swapfile.c

Filename:/mm/swapfile.c
Lines Added:3
Lines Deleted:7
Also changed in: (Previous) 2.4.11-pre6  2.4.11-pre5  2.4.11-pre4  2.4.10-ac10  2.4.10-ac9  2.4.10-ac8 
(Following) 2.4.12-ac1  2.4.12-ac2  2.4.12-ac3  2.4.12-ac4  2.4.12-ac5  2.4.12-ac6 

Location
[  2.4.11
  [  mm
     o  swapfile.c

Patch

diff -u --recursive --new-file v2.4.10/linux/mm/swapfile.c linux/mm/swapfile.c
--- v2.4.10/linux/mm/swapfile.c   Sun Sep 23 11:41:01 2001
+++ linux/mm/swapfile.c   Thu Oct  4 16:46:30 2001
@@ -87,8 +87,7 @@
          si->lowest_bit = si->max;
          si->highest_bit = 0;
       }
-      /* Initial count 1 for user reference + 1 for swap cache */
-      si->swap_map[offset] = 2;
+      si->swap_map[offset] = 1;
       nr_swap_pages--;
       si->cluster_next = offset+1;
       return offset;
@@ -98,11 +97,6 @@
    return 0;
 }
 
-/*
- * Callers of get_swap_page must hold swap_list_lock across the call,
- * and across the following add_to_swap_cache, to guard against races
- * with read_swap_cache_async.
- */
 swp_entry_t get_swap_page(void)
 {
    struct swap_info_struct * p;
@@ -111,6 +105,7 @@
    int type, wrapped = 0;
 
    entry.val = 0;   /* Out of memory */
+   swap_list_lock();
    type = swap_list.next;
    if (type < 0)
       goto out;
@@ -146,6 +141,7 @@
             goto out;   /* out of swap space */
    }
 out:
+   swap_list_unlock();
    return entry;
 }
 


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