From: ren zhy <zhyu.ren@gmail.com>
To: linux-mm <linux-mm@kvack.org>
Subject: page->_count in shrink_cache() and shrink_list() ??
Date: Fri, 12 Aug 2005 22:54:57 +0800 [thread overview]
Message-ID: <aa863ca80508120754655f3200@mail.gmail.com> (raw)
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>
reply other threads:[~2005-08-12 14:54 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aa863ca80508120754655f3200@mail.gmail.com \
--to=zhyu.ren@gmail.com \
--cc=linux-mm@kvack.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.