[lc-checkins] CVS: linux/mm/comp_cache main.c,1.39,1.40 swapout.c,1.44,1.45
Status: Beta
Brought to you by:
nitin_sf
|
From: Rodrigo S. de C. <rc...@us...> - 2002-05-24 14:41:47
|
Update of /cvsroot/linuxcompressed/linux/mm/comp_cache
In directory usw-pr-cvs1:/tmp/cvs-serv11967/mm/comp_cache
Modified Files:
main.c swapout.c
Log Message:
- Fixed a bug that would allow a compressed cache smaller than 10% of your
memory size. If you enter compsize=4096, for instance, it'd set a compressed
cache of 1 memory page (on i386).
- Fixed a bug that could make the list_for_each() in find_free_swp_buffer()
loop forever. There was no max_scan variable, so if it happens that the head
got removed, our for would be endless and since there was no schedule()
call, it would hang the system.
Index: main.c
===================================================================
RCS file: /cvsroot/linuxcompressed/linux/mm/comp_cache/main.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -C2 -r1.39 -r1.40
*** main.c 23 May 2002 21:25:33 -0000 1.39
--- main.c 24 May 2002 14:41:36 -0000 1.40
***************
*** 2,6 ****
* linux/mm/comp_cache/main.c
*
! * Time-stamp: <2002-05-23 17:49:09 rcastro>
*
* Linux Virtual Memory Compressed Cache
--- 2,6 ----
* linux/mm/comp_cache/main.c
*
! * Time-stamp: <2002-05-24 11:11:39 rcastro>
*
* Linux Virtual Memory Compressed Cache
***************
*** 164,168 ****
#ifndef CONFIG_COMP_ADAPTIVITY
! if (!init_num_comp_pages || init_num_comp_pages > max_num_comp_pages)
#endif
init_num_comp_pages = min_num_comp_pages;
--- 164,168 ----
#ifndef CONFIG_COMP_ADAPTIVITY
! if (!init_num_comp_pages || init_num_comp_pages < min_num_comp_pages || init_num_comp_pages > max_num_comp_pages)
#endif
init_num_comp_pages = min_num_comp_pages;
Index: swapout.c
===================================================================
RCS file: /cvsroot/linuxcompressed/linux/mm/comp_cache/swapout.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -C2 -r1.44 -r1.45
*** swapout.c 21 May 2002 20:33:25 -0000 1.44
--- swapout.c 24 May 2002 14:41:38 -0000 1.45
***************
*** 2,6 ****
* /mm/comp_cache/swapout.c
*
! * Time-stamp: <2002-05-21 16:52:13 rcastro>
*
* Linux Virtual Memory Compressed Cache
--- 2,6 ----
* /mm/comp_cache/swapout.c
*
! * Time-stamp: <2002-05-24 10:32:39 rcastro>
*
* Linux Virtual Memory Compressed Cache
***************
*** 39,44 ****
struct swp_buffer * swp_buffer;
comp_cache_fragment_t * old_fragment;
! int wait;
!
if (!fragment)
BUG();
--- 39,44 ----
struct swp_buffer * swp_buffer;
comp_cache_fragment_t * old_fragment;
! int wait, maxscan = NUM_SWP_BUFFERS >> 2;
!
if (!fragment)
BUG();
***************
*** 56,59 ****
--- 56,62 ----
old_fragment = swp_buffer->fragment;
+ if (!maxscan--)
+ break;
+
if (TryLockPage(buffer_page)) {
if (!wait)
***************
*** 128,132 ****
/* couldn't free any swap buffer? so let's IO to finish */
if (list_empty(&swp_free_buffer_head)) {
! wait = 1;
goto try_again;
}
--- 131,139 ----
/* couldn't free any swap buffer? so let's IO to finish */
if (list_empty(&swp_free_buffer_head)) {
! maxscan = wait = 1;
! if (unlikely(current->need_resched)) {
! __set_current_state(TASK_RUNNING);
! schedule();
! }
goto try_again;
}
|