[lc-checkins] CVS: linux/mm/comp_cache swapout.c,1.40,1.41
Status: Beta
Brought to you by:
nitin_sf
|
From: Rodrigo S. de C. <rc...@us...> - 2002-05-14 18:59:32
|
Update of /cvsroot/linuxcompressed/linux/mm/comp_cache
In directory usw-pr-cvs1:/tmp/cvs-serv18902/mm/comp_cache
Modified Files:
swapout.c
Log Message:
- One more try to fix the hang noticed by Paolo Ciarrocchi when running
mmap001. First of all, we were calling try_to_free_buffers() without the page
lock. Secondly, the swap buffer was not removed from swap buffer list before
try_to_free_buffers() and since this function may sleep, we could have two
code paths calling try_to_free_buffers() at the same time, what would
corrupt the structures.
To fix those bugs, now we hold the page lock when handling swap buffer pages
and also remove the swap buffer from any list right before calling
try_to_free_buffers().
Index: swapout.c
===================================================================
RCS file: /cvsroot/linuxcompressed/linux/mm/comp_cache/swapout.c,v
retrieving revision 1.40
retrieving revision 1.41
diff -C2 -r1.40 -r1.41
*** swapout.c 9 May 2002 12:31:01 -0000 1.40
--- swapout.c 14 May 2002 18:59:28 -0000 1.41
***************
*** 2,6 ****
* /mm/comp_cache/swapout.c
*
! * Time-stamp: <2002-05-09 09:20:50 rcastro>
*
* Linux Virtual Memory Compressed Cache
--- 2,6 ----
* /mm/comp_cache/swapout.c
*
! * Time-stamp: <2002-05-14 14:46:54 rcastro>
*
* Linux Virtual Memory Compressed Cache
***************
*** 53,61 ****
swp_buffer = list_entry(swp_buffer_lh, struct swp_buffer, list);
! if (PageLocked(swp_buffer->page)) {
if (!wait)
continue;
list_del_init(swp_buffer_lh);
! wait_on_page(swp_buffer->page);
}
--- 53,61 ----
swp_buffer = list_entry(swp_buffer_lh, struct swp_buffer, list);
! if (TryLockPage(swp_buffer->page)) {
if (!wait)
continue;
list_del_init(swp_buffer_lh);
! lock_page(swp_buffer->page);
}
***************
*** 66,72 ****
if (swp_buffer->page->buffers) {
if (!try_to_free_buffers(swp_buffer->page, gfp_mask)) {
- list_del(swp_buffer_lh);
list_add_tail(swp_buffer_lh, &swp_used_buffer_head);
continue;
}
--- 66,73 ----
if (swp_buffer->page->buffers) {
+ list_del_init(swp_buffer_lh);
if (!try_to_free_buffers(swp_buffer->page, gfp_mask)) {
list_add_tail(swp_buffer_lh, &swp_used_buffer_head);
+ UnlockPage(swp_buffer->page);
continue;
}
***************
*** 101,106 ****
--- 102,110 ----
if (!CompFragmentIO(fragment) || CompFragmentFreed(fragment)) {
CompFragmentClearIO(fragment);
+ UnlockPage(swp_buffer->page);
return NULL;
}
+
+ UnlockPage(swp_buffer->page);
if (wait)
|