[lc-checkins] CVS: linux26/mm filemap.c,1.9,1.10 vmscan.c,1.9,1.10
Status: Beta
Brought to you by:
nitin_sf
From: Nitin G. <nit...@us...> - 2006-03-25 18:59:04
|
Update of /cvsroot/linuxcompressed/linux26/mm In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9266/mm Modified Files: filemap.c vmscan.c Log Message: Ported to 2.6.16, bug fixes, stable Index: filemap.c =================================================================== RCS file: /cvsroot/linuxcompressed/linux26/mm/filemap.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** filemap.c 23 Mar 2006 18:27:53 -0000 1.9 --- filemap.c 25 Mar 2006 18:58:47 -0000 1.10 *************** *** 132,141 **** } - static int chunk_head_wait(void *word) - { - schedule(); - return 0; - } - static int sync_page(void *word) { --- 132,135 ---- *************** *** 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 --- 514,517 ---- *************** *** 536,599 **** { struct page *page; ! 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; } --- 521,541 ---- { struct page *page; ! 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; } *************** *** 633,641 **** { struct page *page; ! struct page *ch; // chunk head //read_lock_irq(&mapping->tree_lock); write_lock_irq(&mapping->tree_lock); - repeat: page = radix_tree_lookup(&mapping->page_tree, offset); --- 575,582 ---- { struct page *page; ! struct page *ch; // chunk head //read_lock_irq(&mapping->tree_lock); write_lock_irq(&mapping->tree_lock); repeat: page = radix_tree_lookup(&mapping->page_tree, offset); *************** *** 650,663 **** //kfree(ch); } - page_cache_get(page); if (TestSetPageLocked(page)) { //read_unlock_irq(&mapping->tree_lock); write_unlock_irq(&mapping->tree_lock); - __lock_page(page); //read_lock_irq(&mapping->tree_lock); write_lock_irq(&mapping->tree_lock); - /* Has the page been truncated while we slept? */ --- 591,601 ---- *************** *** 744,751 **** unsigned int i; unsigned int ret; ! struct page *ch; // chunk head //read_lock_irq(&mapping->tree_lock); write_lock_irq(&mapping->tree_lock); ret = radix_tree_gang_lookup(&mapping->page_tree, (void **)pages, start, nr_pages); --- 682,690 ---- unsigned int i; unsigned int ret; ! struct page *ch; // chunk_head //read_lock_irq(&mapping->tree_lock); write_lock_irq(&mapping->tree_lock); + ret = radix_tree_gang_lookup(&mapping->page_tree, (void **)pages, start, nr_pages); *************** *** 759,763 **** radix_tree_insert(&mapping->page_tree, ch->index, pages[i]); //kfree(ch); ! } page_cache_get(pages[i]); } --- 698,702 ---- 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.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** vmscan.c 23 Mar 2006 18:27:53 -0000 1.9 --- vmscan.c 25 Mar 2006 18:58:47 -0000 1.10 *************** *** 308,320 **** 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; } --- 308,329 ---- static int should_add_to_ccache(struct page *page) { //printk("<1>Some page to be added to ccache.\n"); ! /* ! * Only pass through clean page-cache pages ! * does the flags (Uptodate and Mappedtodisk) correctly ! * determine clean page cache pages? ! */ ! /* ! * Had certain pages having PG_uptodate && PG_mappedtodisk and ! * still have page->mapping==NULL ! */ ! /* some of these checks are probably redundant */ ! if (!page_mapping(page)) return 0; // i.e. either Anon or mapping=0 ! if (PageSwapCache(page)) return 0; ! if (PagePrivate(page)) return 0; // these are buffer heads ! 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; } *************** *** 323,339 **** { unsigned long flags; ! struct page *newpage; struct address_space *mapping; ! struct page *ch; // dummy struct page as 'chunk head' //struct chunk_head *ch; mapping=page_mapping(page); ! ! /* ! printk ("<1> Add to CCache called.\n"); ! printk ("<1> orig page->count=%d\n", atomic_read(&page->_count)); ! printk ("<1> orig page->mapcount=%d\n", atomic_read(&page->_mapcount)); ! printk ("<1> orig page->flags=%u\n", page->flags); ! printk ("<1> orig page->private=%u\n", page->private); ! */ newpage=alloc_pages(GFP_KERNEL, 0); --- 332,349 ---- { unsigned long flags; ! struct page *newpage=NULL; struct address_space *mapping; ! struct page *ch=NULL; // dummy struct page as 'chunk head' //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)); ! printk ("<1> orig page->mapcount=%d\n", atomic_read(&page->_mapcount)); ! printk ("<1> orig page->flags=%u\n", page->flags); ! printk ("<1> orig page->mapping=%p\n", page->mapping); ! printk ("<1> orig page->private=%u\n", page->private); ! goto out; ! } newpage=alloc_pages(GFP_KERNEL, 0); *************** *** 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; --- 376,380 ---- ch->mapping=mapping; ! //ch->mapping=NULL; ch->index=page->index; *************** *** 408,413 **** --- 418,425 ---- out: if (newpage) __free_page(newpage); + if (ch) kfree(ch); return -1; } + EXPORT_SYMBOL(add_to_ccache); /* *************** *** 441,445 **** if (ret==0) { ! //ClearPageWillCompress(page); return PAGE_SUCCESS; } else { --- 453,457 ---- if (ret==0) { ! //ClearPageWillCompress(page); return PAGE_SUCCESS; } else { *************** *** 659,669 **** if (TestSetPageLocked(page)) goto keep; - - if (PageWillCompress(page)) { - //page->mapping=NULL; - ClearPageWillCompress(page); - goto free_it; - } - if (PageDirty(page) || PageWriteback(page)) goto keep_locked; --- 671,674 ---- *************** *** 716,720 **** pgactivate++; keep_locked: - //ClearPageWillCompress(page); unlock_page(page); keep: --- 721,724 ---- *************** *** 848,852 **** */ if (!mapping || page_mapcount(page) + nr_refs != page_count(page)) ! return 1; /* --- 852,856 ---- */ if (!mapping || page_mapcount(page) + nr_refs != page_count(page)) ! return -EAGAIN; /* *************** *** 869,873 **** * is still set and the operation may continue. */ ! try_to_unmap(page, 1); /* --- 873,879 ---- * is still set and the operation may continue. */ ! if (try_to_unmap(page, 1) == SWAP_FAIL) ! /* A vma has VM_LOCKED set -> Permanent failure */ ! return -EPERM; /* *************** *** 875,879 **** */ if (page_mapcount(page)) ! return 1; write_lock_irq(&mapping->tree_lock); --- 881,885 ---- */ if (page_mapcount(page)) ! return -EAGAIN; write_lock_irq(&mapping->tree_lock); *************** *** 886,890 **** *radix_pointer != page) { write_unlock_irq(&mapping->tree_lock); ! return 1; } --- 892,896 ---- *radix_pointer != page) { write_unlock_irq(&mapping->tree_lock); ! return -EAGAIN; } *************** *** 961,968 **** int migrate_page(struct page *newpage, struct page *page) { BUG_ON(PageWriteback(page)); /* Writeback must be complete */ ! if (migrate_page_remove_references(newpage, page, 2)) ! return -EAGAIN; migrate_page_copy(newpage, page); --- 967,978 ---- int migrate_page(struct page *newpage, struct page *page) { + int rc; + BUG_ON(PageWriteback(page)); /* Writeback must be complete */ ! rc = migrate_page_remove_references(newpage, page, 2); ! ! if (rc) ! return rc; migrate_page_copy(newpage, page); *************** *** 2031,2035 **** if (!(gfp_mask & __GFP_WAIT) || zone->all_unreclaimable || ! atomic_read(&zone->reclaim_in_progress) > 0) return 0; --- 2041,2046 ---- if (!(gfp_mask & __GFP_WAIT) || zone->all_unreclaimable || ! atomic_read(&zone->reclaim_in_progress) > 0 || ! (p->flags & PF_MEMALLOC)) return 0; |