linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Weiner <hannes@cmpxchg.org>
To: "Li, Ming Chun" <macli@brc.ubc.ca>
Cc: Christoph Lameter <cl@linux-foundation.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
	linux-mm@kvack.org
Subject: Re: [patch 5/4] mm: document is_page_cache_freeable()
Date: Thu, 23 Jul 2009 00:10:23 +0200	[thread overview]
Message-ID: <20090722221022.GA8667@cmpxchg.org> (raw)
In-Reply-To: <alpine.DEB.1.00.0907221447190.24706@mail.selltech.ca>

On Wed, Jul 22, 2009 at 02:55:12PM -0700, Li, Ming Chun wrote:
> On Wed, 22 Jul 2009, Christoph Lameter wrote:
> 
> > 
> > >  static inline int is_page_cache_freeable(struct page *page)
> > >  {
> > > +	/*
> > > +	 * A freeable page cache page is referenced only by the caller
> > > +	 * that isolated the page, the page cache itself and
> > 
> > The page cache "itself"? This is the radix tree reference right?
> > 
> 
> I think you are right. I had trouble understanding this function, So I 
> looked into it and found out the call path:
> 
>  add_to_page_cache_locked 
>    -> page_cache_get
>     -> atomic_inc(&page->_count) 
> 
> Please correct me if I am wrong.

This is correct.  But this is the purpose of reference counters - you
increase it when you reference the object so that it doesn't get freed
under you.

That's why everybody holding a reference to the page must have its
usage counter increased.  And this includes the page/swap cache, the
LRU lists, the page tables etc.

And I think in that context my comment should be obvious.  Do you need
to know that the page cache is actually managed with radix trees at
this point?

You need to know that the page cache is something holding a reference
to the page so you can meet the requirements that are written above
remove_from_page_cache() - which you are about to call.

I added the comment to document that magic `compare with 2' in there.
If more is needed, I am glad to help - but right now I don't really
think I know what the issue is with this patch?

--
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:[~2009-07-22 22:12 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-21  8:56 [patch 1/4] mm: drop unneeded double negations Johannes Weiner
2009-07-21  8:56 ` [patch 2/4] mm: introduce page_lru_type() Johannes Weiner
2009-07-22  1:52   ` Minchan Kim
2009-07-22  9:07     ` Johannes Weiner
2009-07-22 12:37       ` Minchan Kim
2009-07-22 16:01   ` Rik van Riel
2009-07-21  8:56 ` [patch 3/4] mm: return boolean from page_is_file_cache() Johannes Weiner
2009-07-21  8:56 ` [patch 4/4] mm: return boolean from page_has_private() Johannes Weiner
2009-07-22 16:49   ` Christoph Lameter
2009-07-22 17:50     ` Johannes Weiner
2009-07-22 17:54       ` [patch 5/4] mm: document is_page_cache_freeable() Johannes Weiner
2009-07-22 19:02         ` Christoph Lameter
2009-07-22 21:55           ` Li, Ming Chun
2009-07-22 22:10             ` Johannes Weiner [this message]
2009-07-22 23:51               ` Li, Ming Chun
2009-07-22 23:58               ` Christoph Lameter
2009-07-21  9:33 ` [patch 1/4] mm: drop unneeded double negations Mel Gorman
2009-07-21 11:18   ` Johannes Weiner

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=20090722221022.GA8667@cmpxchg.org \
    --to=hannes@cmpxchg.org \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux-foundation.org \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-mm@kvack.org \
    --cc=macli@brc.ubc.ca \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).