Messages in this thread Patch in this message | | | Date | Tue, 4 May 1999 13:31:33 +0200 (CEST) | From | Andrea Arcangeli <> | Subject | [patch] swap cache read accesses |
| |
I was running `./bw_mem 120m rd' (from lmbench) and I noticed my swap to be eaten completly in some second. All the cache was full of swap cache pages.
The problem is that there is no good reason to map in the process a read-only swap cache page if the swap cache page was not shared.
Mapping the swap cache page even if it wasn't shared not only cause the kerenl to go low of swap entry, but it will also cause an additional page fault and cow if after the read access there will be a write access.
With this my patch everything is normal while running `./bw_mem 120m rd'. I have not yet benchmarked the thing but I think it will be an improvement while using swap cache pages (for the reasons above).
Patch against 2.2.7:
Index: linux/mm//page_alloc.c =================================================================== RCS file: /var/cvs/linux/mm/page_alloc.c,v retrieving revision 1.1.1.4 diff -u -r1.1.1.4 page_alloc.c --- page_alloc.c 1999/04/28 20:46:47 1.1.1.4 +++ linux/mm/page_alloc.c 1999/05/04 01:20:30 @@ -414,17 +414,16 @@ tsk->min_flt++; swap_free(entry); - if (!write_access || is_page_shared(page_map)) { + if (is_page_shared(page_map)) { set_pte(page_table, mk_pte(page, vma->vm_page_prot)); return; } - /* The page is unshared, and we want write access. In this - case, it is safe to tear down the swap cache and give the - page over entirely to this process. */ + /* The page is unshared. In this case, it is safe to tear down the + * swap cache and give the page over entirely to this process. + */ - if (PageSwapCache(page_map)) - delete_from_swap_cache(page_map); + delete_from_swap_cache(page_map); set_pte(page_table, pte_mkwrite(pte_mkdirty(mk_pte(page, vma->vm_page_prot)))); return; }
The check for PageSwapCache() was useless.
Andrea Arcangeli
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |