linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* page->_count in shrink_cache() and shrink_list() ??
@ 2005-08-12 14:54 ren zhy
  0 siblings, 0 replies; only message in thread
From: ren zhy @ 2005-08-12 14:54 UTC (permalink / raw)
  To: linux-mm

Hi,I am a kernel newbie and have a question about page_count in
shrink_list() ( 2.6.11 source code ).
  When kswapd began to shrink_cache(),it will first collect the pages
in zone->inactive_list which are not about to free into a temp
list:page_list .
565 if (get_page_testone(page)) { 
569 __put_page(page); 
570 SetPageLRU(page); 
571 list_add(&page->lru, &zone->inactive_list); 
572 continue; 
573 } 
574 list_add(&page->lru, &page_list); 
...
Then shrink_list() will check and try to free some fit pages.
589 nr_freed = shrink_list(&page_list, sc); 

in shrink_list(),I dont know why kernel will judge the expression
if(page_count(page)!=2) before doing something with this page.
After a page is allocated ,its page_count() is 1 and again  kernel add
1  in shrink_cache (line 565).So I think if the page is in page cache
or swap cache ,its page_count() is at least 3 and line 485 will not
satisfied.
480 /* 
481 * The non-racy check for busy page. It is critical to check 
482 * PageDirty _after_ making sure that the page is freeable and 
483 * not in use by anybody. (pagecache + us == 2) 
484 */ 
485 if (page_count(page) != 2 || PageDirty(page)) { 
486 spin_unlock_irq(&mapping->tree_lock); 
487 goto keep_locked; 
488 }
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-08-12 14:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-12 14:54 page->_count in shrink_cache() and shrink_list() ?? ren zhy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox