patch-2.2.15 linux/mm/filemap.c

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

diff -u --new-file --recursive --exclude-from ../../exclude v2.2.14/mm/filemap.c linux/mm/filemap.c
@@ -164,6 +164,10 @@
 			clock = page - mem_map;
 		}
 		
+		/* We can't free pages unless there's just one user */
+		if (atomic_read(&page->count) != 1)
+			continue;
+
 		referenced = test_and_clear_bit(PG_referenced, &page->flags);
 
 		if (PageLocked(page))
@@ -172,10 +176,6 @@
 		if ((gfp_mask & __GFP_DMA) && !PageDMA(page))
 			continue;
 
-		/* We can't free pages unless there's just one user */
-		if (atomic_read(&page->count) != 1)
-			continue;
-
 		count--;
 
 		/*
@@ -254,6 +254,7 @@
 			if ((unsigned long)dest != source_address) {
 				wait_on_page(page);
 				memcpy(dest, buf, len);
+				flush_dcache_page(page_address(page));
 			}
 			page_cache_release(page);
 		}
@@ -1553,8 +1554,10 @@
 		 * is done with the page.
 		 */
 		dest = (char *) page_address(page) + offset;
-		if (dest != buf) /* See comment in update_vm_cache_cond. */
+		if (dest != buf) { /* See comment in update_vm_cache_cond. */
 			bytes -= copy_from_user(dest, buf, bytes);
+			flush_dcache_page(page_address(page));
+		}
 		status = -EFAULT;
 		if (bytes)
 			status = inode->i_op->updatepage(file, page, offset, bytes, sync);

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)