From: Johannes Weiner <hannes@cmpxchg.org>
To: Christoph Lameter <cl@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
linux-mm@kvack.org
Subject: Re: [patch 4/4] mm: return boolean from page_has_private()
Date: Wed, 22 Jul 2009 19:50:31 +0200 [thread overview]
Message-ID: <20090722175031.GA3484@cmpxchg.org> (raw)
In-Reply-To: <alpine.DEB.1.10.0907221220350.3588@gentwo.org>
On Wed, Jul 22, 2009 at 12:49:44PM -0400, Christoph Lameter wrote:
> On Tue, 21 Jul 2009, Johannes Weiner wrote:
>
> > Make page_has_private() return a true boolean value and remove the
> > double negations from the two callsites using it for arithmetic.
>
> page_has_private_data()?
I am not so fond of changing that, because then we should probably
also rename page_private() and that is moot for slightly improved
source code English.
> Also note that you are adding unecessary double negation to the other
> callers. Does the compiler catch that?
Yes, callsites using it in a conditionals do not change here with gcc
4.3.3.
> > +static inline int page_has_private(struct page *page)
> > +{
> > + return !!(page->flags & ((1 << PG_private) | (1 << PG_private_2)));
> > +}
>
> Two private bits? How did that happen?
fscache :)
> Could we define a PAGE_FLAGS_PRIVATE in page-flags.h?
It would certainly look nicer, I will add that.
> > diff --git a/mm/vmscan.c b/mm/vmscan.c
> > index 6b368d3..67e2824 100644
> > --- a/mm/vmscan.c
> > +++ b/mm/vmscan.c
> > @@ -286,7 +286,7 @@ static inline int page_mapping_inuse(struct page *page)
> >
> > static inline int is_page_cache_freeable(struct page *page)
> > {
> > - return page_count(page) - !!page_has_private(page) == 2;
> > + return page_count(page) - page_has_private(page) == 2;
>
> That looks funky and in need of comments.
Agreed, I will add one in a different patch.
Hannes
---
next prev parent reply other threads:[~2009-07-22 17:51 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 [this message]
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
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=20090722175031.GA3484@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 \
/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.