[lc-checkins] CVS: linux26/mm filemap.c,1.8,1.9 vmscan.c,1.8,1.9
Status: Beta
Brought to you by:
nitin_sf
From: Nitin G. <nit...@us...> - 2006-03-23 18:27:59
|
Update of /cvsroot/linuxcompressed/linux26/mm In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30432/mm Modified Files: filemap.c vmscan.c Log Message: 2.6.16-rc5: stable but has mem leaks. No real comp/decomp. Index: filemap.c =================================================================== RCS file: /cvsroot/linuxcompressed/linux26/mm/filemap.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** filemap.c 10 Mar 2006 13:46:21 -0000 1.8 --- filemap.c 23 Mar 2006 18:27:53 -0000 1.9 *************** *** 132,135 **** --- 132,141 ---- } + static int chunk_head_wait(void *word) + { + schedule(); + return 0; + } + static int sync_page(void *word) { *************** *** 514,517 **** --- 520,532 ---- EXPORT_SYMBOL(__lock_page); + void fastcall __wait_unlock_chunk_head(struct page *page) + { + DEFINE_WAIT_BIT(wait, &page->flags, PG_locked); + + __wait_on_bit_lock(page_waitqueue(page), &wait, chunk_head_wait, + TASK_UNINTERRUPTIBLE); + } + EXPORT_SYMBOL(__wait_unlock_chunk_head); + /* * a rather lightweight function, finding and getting a reference to a *************** *** 523,543 **** 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 in find_get_page **\n"); // page is actually chunk head ch=page; ! page=(struct page *)page_private(ch); ! radix_tree_delete(&mapping->page_tree, offset); ! radix_tree_insert(&mapping->page_tree, offset, page); ! kfree(ch); } - page_cache_get(page); } ! //read_unlock_irq(&mapping->tree_lock); ! write_unlock_irq(&mapping->tree_lock); return page; } --- 538,599 ---- 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)) { ! //if (offset==0) printk("<1> ## IDX: %u; mapping %p ##\n", page->index, mapping); ! printk("<1> ** Compressed page: %u in find_get_page **\n", offset); // page is actually chunk head ch=page; ! if (TestSetPageLocked(ch)) { ! printk("<1> ** WAIT DEC page: %u in find_get_page; mapping %p **\n", offset, mapping); ! ! // it's currently being decompressed ! // wait until dec completes ! //__lock_page(ch); ! //__wait_unlock_chunk_head(ch); ! //while(PageLocked(ch)) { ! // schedule(); ! //} ! ! //page=(struct page *)ch->mapping; ! page=(struct page *)page_private(ch); ! page_cache_get(page); ! //unlock_page(ch); ! } else { ! /*if (ch->mapping!=NULL) { ! page=(struct page *)(ch->mapping); ! printk("<1> GOT Page: %u; mapping %p\n", offset, mapping); ! page_cache_get(page); ! ClearPageLocked(ch); ! //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); ! 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); ! ClearPageLocked(ch); ! //unlock_page(ch); ! } ! //kfree(ch); } } ! out: ! //BUG_ON(PageCompressed(page)); ! if (!page) read_unlock_irq(&mapping->tree_lock); ! //write_unlock_irq(&mapping->tree_lock); return page; } *************** *** 592,596 **** radix_tree_delete(&mapping->page_tree, offset); radix_tree_insert(&mapping->page_tree, offset, page); ! kfree(ch); } --- 648,652 ---- radix_tree_delete(&mapping->page_tree, offset); radix_tree_insert(&mapping->page_tree, offset, page); ! //kfree(ch); } *************** *** 702,706 **** radix_tree_delete(&mapping->page_tree, ch->index); radix_tree_insert(&mapping->page_tree, ch->index, pages[i]); ! kfree(ch); } page_cache_get(pages[i]); --- 758,762 ---- radix_tree_delete(&mapping->page_tree, ch->index); radix_tree_insert(&mapping->page_tree, ch->index, pages[i]); ! //kfree(ch); } page_cache_get(pages[i]); Index: vmscan.c =================================================================== RCS file: /cvsroot/linuxcompressed/linux26/mm/vmscan.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** vmscan.c 10 Mar 2006 13:46:21 -0000 1.8 --- vmscan.c 23 Mar 2006 18:27:53 -0000 1.9 *************** *** 308,317 **** static int should_add_to_ccache(struct page *page) { if (PagePrivate(page)) return 0; if (PageSwapCache(page)) return 0; if (PageDirty(page)) return 0; ! //printk("<1>Some page to be added to ccache.\n"); ! return 1; } --- 308,321 ---- static int should_add_to_ccache(struct page *page) { + /* if (PagePrivate(page)) return 0; if (PageSwapCache(page)) return 0; if (PageDirty(page)) return 0; ! */ //printk("<1>Some page to be added to ccache.\n"); ! ! // Only pass through clean page cache pages ! if (PageUptodate(page) && PageMappedToDisk(page)) return 1; ! return 0; } *************** *** 335,338 **** --- 339,346 ---- newpage=alloc_pages(GFP_KERNEL, 0); if (!newpage) goto out; + + if (PageWillCompress(newpage)) { + printk("\n#### Strange PWC for newpage!! ###\n"); + } /* printk ("<1> NEW page->count=%d\n", atomic_read(&newpage->_count)); *************** *** 358,361 **** --- 366,370 ---- ch->mapping=mapping; + //ch->mapping=NULL; // this make it as if it's in swap ccache -- getting bad_page() ? ch->index=page->index; *************** *** 390,401 **** unlock_page(page); ! printk("<1> Page added to ccache\n"); return 0; //__free_page(newpage); out_locked: write_unlock_irq(&mapping->tree_lock); out: - printk("<1>***** PAGE COUNT NOT 2 -- IT IS %d ******\n", page_count(page)); if (newpage) __free_page(newpage); return -1; --- 399,410 ---- unlock_page(page); ! //printk("<1> Page: %u added to ccache\n", newpage->index); return 0; //__free_page(newpage); out_locked: + printk("<1>***** PAGE COUNT NOT 2 -- IT IS %d ******\n", page_count(page)); write_unlock_irq(&mapping->tree_lock); out: if (newpage) __free_page(newpage); return -1; *************** *** 550,553 **** --- 559,576 ---- list_del(&page->lru); + if (PageCompressed(page)) { + printk("<1> COMPRESSED Page here at shrink_list!\n"); + continue; + } + if (PageWillCompress(page)) { + printk("<1> WILLCOMP Page here at shrink_list!\n"); + printk ("<1> WC page->count=%d\n", page_count(page)); + printk ("<1> WC page->mapcount=%d\n", atomic_read(&page->_mapcount)); + printk ("<1> WC page->flags=%u\n", page->flags); + printk ("<1> WC page->private=%u\n", page_private(page)); + printk ("<1> WC page->mapping=%p\n", page->mapping); + continue; + } + if (TestSetPageLocked(page)) goto keep; *************** *** 693,698 **** --- 716,723 ---- pgactivate++; keep_locked: + //ClearPageWillCompress(page); unlock_page(page); keep: + ClearPageWillCompress(page); list_add(&page->lru, &ret_pages); BUG_ON(PageLRU(page)); |