[lc-checkins] CVS: linux/mm filemap.c,1.31,1.32 memory.c,1.32,1.33 shmem.c,1.20,1.21 swap_state.c,1.
Status: Beta
Brought to you by:
nitin_sf
|
From: Rodrigo S. de C. <rc...@us...> - 2002-07-05 15:21:58
|
Update of /cvsroot/linuxcompressed/linux/mm
In directory usw-pr-cvs1:/tmp/cvs-serv27959/mm
Modified Files:
filemap.c memory.c shmem.c swap_state.c vmscan.c
Log Message:
Bug fixes
o Fixed potential oops in __read_cache_page() due to a misplaced
steal_page_from_comp_cache() call.
o Fixed bug in __read_swap_cache_async() which would end up getting an
extra reference on a swap cache page and would also erroneously stop a
swapin readahead.
o Fixed major bug in shrink_cache() that could hang the machine. We
could write a page in compress_dirty_page() even if the GFP mask does
not allow!
Cleanups
o Added #ifdefs to some flush_comp_cache() calls.
o Replaced find_comp_page() in do_swap_page() by a in_comp_cache()
call.
Other
o Added page count check to shrink_comp_cache(). Only to make sure the
page is going to be actually freed.
o Removed write permission from /proc/sys/vm/comp_cache/size when
resize on demand option is enabled.
Index: filemap.c
===================================================================
RCS file: /cvsroot/linuxcompressed/linux/mm/filemap.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -C2 -r1.31 -r1.32
*** filemap.c 1 Jul 2002 17:37:29 -0000 1.31
--- filemap.c 5 Jul 2002 15:21:49 -0000 1.32
***************
*** 164,171 ****
#ifdef CONFIG_COMP_CACHE
if (PageTestandClearCompCache(page)) {
! if (PageMappedCompCache(page))
steal_page_from_comp_cache(page, NULL);
! else
! invalidate_comp_cache(mapping, page->index);
}
#endif
--- 164,172 ----
#ifdef CONFIG_COMP_CACHE
if (PageTestandClearCompCache(page)) {
! if (PageMappedCompCache(page)) {
steal_page_from_comp_cache(page, NULL);
! return;
! }
! invalidate_comp_cache(mapping, page->index);
}
#endif
***************
*** 1107,1115 ****
}
#ifdef CONFIG_COMP_PAGE_CACHE
- /*
- * Invalidate compressed cache entry since it may become
- * obsolete. The caller(s) will probably overwrite the data
- * from this page, without dirtying the page.
- */
if (page)
flush_comp_cache(page);
--- 1108,1111 ----
***************
*** 2946,2953 ****
if (cached_page)
page_cache_release(cached_page);
- steal_page_from_comp_cache(page, NULL);
#ifdef CONFIG_COMP_PAGE_CACHE
! if (page)
flush_comp_cache(page);
#endif
return page;
--- 2942,2950 ----
if (cached_page)
page_cache_release(cached_page);
#ifdef CONFIG_COMP_PAGE_CACHE
! if (page) {
! steal_page_from_comp_cache(page, NULL);
flush_comp_cache(page);
+ }
#endif
return page;
***************
*** 3011,3018 ****
}
#ifdef CONFIG_COMP_PAGE_CACHE
- /*
- * we have to invalidate the page since the caller function
- * (generic_file_write) will overwrite the data in the page
- */
flush_comp_cache(page);
#endif
--- 3008,3011 ----
Index: memory.c
===================================================================
RCS file: /cvsroot/linuxcompressed/linux/mm/memory.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -C2 -r1.32 -r1.33
*** memory.c 1 Jul 2002 17:37:29 -0000 1.32
--- memory.c 5 Jul 2002 15:21:49 -0000 1.33
***************
*** 1133,1139 ****
page = lookup_swap_cache(entry);
if (!page) {
- struct comp_cache_fragment * fragment;
/* perform readahead only if the page is on disk */
! if (find_comp_page(&swapper_space, entry.val, &fragment)) {
swapin_readahead(entry);
/* major fault */
--- 1133,1138 ----
page = lookup_swap_cache(entry);
if (!page) {
/* perform readahead only if the page is on disk */
! if (!in_comp_cache(&swapper_space, entry.val)) {
swapin_readahead(entry);
/* major fault */
***************
*** 1310,1314 ****
--- 1309,1315 ----
if (write_access) {
entry = pte_mkwrite(pte_mkdirty(entry));
+ #ifdef CONFIG_COMP_PAGE_CACHE
flush_comp_cache(new_page);
+ #endif
}
set_pte(page_table, entry);
Index: shmem.c
===================================================================
RCS file: /cvsroot/linuxcompressed/linux/mm/shmem.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -r1.20 -r1.21
*** shmem.c 21 Mar 2002 19:24:17 -0000 1.20
--- shmem.c 5 Jul 2002 15:21:50 -0000 1.21
***************
*** 838,843 ****
if (IS_ERR(page))
break;
!
flush_comp_cache(page);
/* We have exclusive IO access to the page.. */
--- 838,844 ----
if (IS_ERR(page))
break;
! #ifdef CONFIG_COMP_PAGE_CACHE
flush_comp_cache(page);
+ #endif
/* We have exclusive IO access to the page.. */
Index: swap_state.c
===================================================================
RCS file: /cvsroot/linuxcompressed/linux/mm/swap_state.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -C2 -r1.34 -r1.35
*** swap_state.c 1 Jul 2002 21:36:50 -0000 1.34
--- swap_state.c 5 Jul 2002 15:21:50 -0000 1.35
***************
*** 134,138 ****
__delete_from_swap_cache(page);
spin_unlock(&pagecache_lock);
!
swap_free(entry);
page_cache_release(page);
--- 134,138 ----
__delete_from_swap_cache(page);
spin_unlock(&pagecache_lock);
!
swap_free(entry);
page_cache_release(page);
***************
*** 221,227 ****
if (readahead) {
! struct page * tmp_page = find_get_page(&swapper_space, entry.val);
! if (tmp_page)
break;
if (in_comp_cache(&swapper_space, entry.val))
return new_page;
--- 221,229 ----
if (readahead) {
! found_page = find_get_page(&swapper_space, entry.val);
! if (found_page) {
! steal_page_from_comp_cache(found_page, new_page);
break;
+ }
if (in_comp_cache(&swapper_space, entry.val))
return new_page;
***************
*** 247,251 ****
}
} while (err != -ENOENT);
!
if (new_page)
page_cache_release(new_page);
--- 249,253 ----
}
} while (err != -ENOENT);
!
if (new_page)
page_cache_release(new_page);
Index: vmscan.c
===================================================================
RCS file: /cvsroot/linuxcompressed/linux/mm/vmscan.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -C2 -r1.38 -r1.39
*** vmscan.c 1 Jul 2002 18:44:40 -0000 1.38
--- vmscan.c 5 Jul 2002 15:21:52 -0000 1.39
***************
*** 410,418 ****
writepage = page->mapping->a_ops->writepage;
- #ifdef CONFIG_COMP_CACHE
- if (writepage)
- #else
if ((gfp_mask & __GFP_FS) && writepage)
- #endif
{
ClearPageDirty(page);
--- 410,414 ----
***************
*** 475,479 ****
UnlockPage(page);
page_cache_release(page);
!
spin_lock(&pagemap_lru_lock);
continue;
--- 471,475 ----
UnlockPage(page);
page_cache_release(page);
!
spin_lock(&pagemap_lru_lock);
continue;
|