patch-2.1.34 linux/mm/filemap.c

Next file: linux/mm/kmalloc.c
Previous file: linux/kernel/softirq.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.33/linux/mm/filemap.c linux/mm/filemap.c
@@ -168,7 +168,7 @@
 		   buffer cache; we'd have to modify the following
 		   test to allow for that case. */
 
-		switch (page->count) {
+		switch (atomic_read(&page->count)) {
 			case 1:
 				/* If it has been referenced recently, don't free it */
 				if (clear_bit(PG_referenced, &page->flags))
@@ -214,7 +214,7 @@
 unsigned long page_unuse(unsigned long page)
 {
 	struct page * p = mem_map + MAP_NR(page);
-	int count = p->count;
+	int count = atomic_read(&p->count);
 
 	if (count != 2)
 		return count;
@@ -260,7 +260,7 @@
 	struct inode * inode, unsigned long offset,
 	struct page **hash)
 {
-	page->count++;
+	atomic_inc(&page->count);
 	page->flags &= ~((1 << PG_uptodate) | (1 << PG_error));
 	page->offset = offset;
 	add_page_to_inode_queue(inode, page);
@@ -1000,7 +1000,7 @@
 {
 	unsigned long page = SWP_OFFSET(entry);
 
-	mem_map[page].count++;
+	atomic_inc(&mem_map[page].count);
 	page = (page << PAGE_SHIFT) + PAGE_OFFSET;
 	return mk_pte(page,vma->vm_page_prot);
 }
@@ -1023,7 +1023,7 @@
 		set_pte(ptep, pte_mkclean(pte));
 		flush_tlb_page(vma, address);
 		page = pte_page(pte);
-		mem_map[MAP_NR(page)].count++;
+		atomic_inc(&mem_map[MAP_NR(page)].count);
 	} else {
 		if (pte_none(pte))
 			return 0;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov