[lc-checkins] CVS: linux26/mm filemap.c,1.10,1.11 vmscan.c,1.10,1.11
Status: Beta
Brought to you by:
nitin_sf
From: Nitin G. <nit...@us...> - 2006-04-05 09:36:52
|
Update of /cvsroot/linuxcompressed/linux26/mm In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8760/mm Modified Files: filemap.c vmscan.c Log Message: 2.6.16: better locking, stable Index: filemap.c =================================================================== RCS file: /cvsroot/linuxcompressed/linux26/mm/filemap.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** filemap.c 25 Mar 2006 18:58:47 -0000 1.10 --- filemap.c 5 Apr 2006 09:36:39 -0000 1.11 *************** *** 30,33 **** --- 30,36 ---- #include <linux/security.h> #include <linux/syscalls.h> + + #include <linux/bit_spinlock.h> + #include "filemap.h" /* *************** *** 514,517 **** --- 517,534 ---- EXPORT_SYMBOL(__lock_page); + int chunk_head_wait(void *word) + { + schedule(); + return 0; + } + EXPORT_SYMBOL(chunk_head_wait); + + static inline void wait_on_chunk_head(struct page *ch) + { + might_sleep(); + wait_on_bit(&ch->flags, PG_locked, chunk_head_wait, TASK_UNINTERRUPTIBLE); + } + EXPORT_SYMBOL(wait_on_chunk_head); + /* * a rather lightweight function, finding and getting a reference to a *************** *** 523,541 **** struct page *ch; // chunk head ! //read_lock_irq(&mapping->tree_lock); ! write_lock_irq(&mapping->tree_lock); page = radix_tree_lookup(&mapping->page_tree, offset); if (page) { if (PageCompressed(page)) { printk("<1> ** Compressed page: %u in find_get_page **\n", offset); ch=page; ! page=(struct page *)page_private(ch); ! radix_tree_delete(&mapping->page_tree, offset); ! radix_tree_insert(&mapping->page_tree, offset, page); } - page_cache_get(page); } ! //read_unlock_irq(&mapping->tree_lock); ! write_unlock_irq(&mapping->tree_lock); return page; } --- 540,596 ---- struct page *ch; // chunk head ! read_lock_irq(&mapping->tree_lock); ! //write_lock_irq(&mapping->tree_lock); page = radix_tree_lookup(&mapping->page_tree, offset); if (page) { + page_cache_get(page); + read_unlock_irq(&mapping->tree_lock); if (PageCompressed(page)) { printk("<1> ** Compressed page: %u in find_get_page **\n", offset); ch=page; ! //if (!bit_spin_trylock(PG_locked, &ch->flags)) { ! if (TestSetPageLocked(ch)) { ! printk("<1> ** WAIT DEC page: %u mapping %p **\n", offset, mapping); ! wait_on_chunk_head(ch); ! //wait_on_bit(&ch->flags, PG_locked, chunk_head_wait, TASK_UNINTERRUPTIBLE); ! //bit_spin_lock(PG_locked, &ch->flags); ! printk("<1> ** WAIT OVER got page: %p\n", ch->mapping); ! page=(struct page*)(ch->mapping); ! //bit_spin_unlock(PG_locked, &ch->flags); ! page_cache_get(page); ! } else { ! if (ch->mapping!=NULL) { ! page=(struct page *)(ch->mapping); ! printk("<1> GOT Page: %u; mapping %p\n", offset, mapping); ! page_cache_get(page); ! wake_up_bit(&ch->flags, PG_locked); ! //bit_spin_unlock(PG_locked, &ch->flags); ! //unlock_page(ch); ! goto out; ! } ! printk("<1> DEC Page: %u; mapping %p\n", offset, mapping); ! // decompress() routine below ! ch->mapping=(struct address_space *)page_private(ch); ! //printk("<1> GIVEN mapping %p\n", ch->mapping); ! page=(struct page *)(ch->mapping); ! wake_up_bit(&ch->flags, PG_locked); ! ! //bit_spin_unlock(PG_locked, &ch->flags); ! //ClearPageLocked(ch); ! //unlock_page(ch); ! ! ! //page=(struct page *)page_private(ch); ! write_lock_irq(&mapping->tree_lock); ! radix_tree_delete(&mapping->page_tree, offset); ! radix_tree_insert(&mapping->page_tree, offset, page); ! page_cache_get(page); ! write_unlock_irq(&mapping->tree_lock); ! } } } ! out: ! if (!page) read_unlock_irq(&mapping->tree_lock); ! //write_unlock_irq(&mapping->tree_lock); return page; } Index: vmscan.c =================================================================== RCS file: /cvsroot/linuxcompressed/linux26/mm/vmscan.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** vmscan.c 25 Mar 2006 18:58:47 -0000 1.10 --- vmscan.c 5 Apr 2006 09:36:39 -0000 1.11 *************** *** 325,329 **** if (PageDirty(page)) return 0; // PG_uptodate && PG_dirty possible? if (PageUptodate(page) && PageMappedToDisk(page)) return 1; ! printk("FLAGS %u\n", page->flags); return 0; } --- 325,329 ---- if (PageDirty(page)) return 0; // PG_uptodate && PG_dirty possible? if (PageUptodate(page) && PageMappedToDisk(page)) return 1; ! //printk("FLAGS %u\n", page->flags); return 0; } *************** *** 337,341 **** //struct chunk_head *ch; mapping=page_mapping(page); ! //printk ("<1> Add to CCache called: mapping=%p\n", mapping); if (!mapping) { printk ("<1> orig page->count=%d\n", atomic_read(&page->_count)); --- 337,341 ---- //struct chunk_head *ch; mapping=page_mapping(page); ! printk ("<1> ATC: M:%p\n", mapping); if (!mapping) { printk ("<1> orig page->count=%d\n", atomic_read(&page->_count)); *************** *** 366,369 **** --- 366,371 ---- ch = kmalloc(sizeof(struct page), GFP_KERNEL); if (!ch) goto out; + //printk("<1> CH Flags init: %u\n", ch->flags); + ch->flags=0; write_lock_irq(&mapping->tree_lock); *************** *** 375,380 **** SetPageCompressed(ch); ! ch->mapping=mapping; ! //ch->mapping=NULL; ch->index=page->index; --- 377,382 ---- SetPageCompressed(ch); ! //ch->mapping=mapping; ! ch->mapping=NULL; ch->index=page->index; |