From: Minchan Kim <minchan.kim@gmail.com>
To: Johannes Weiner <hannes@cmpxchg.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
linux-mm@kvack.org
Subject: Re: [patch 2/4] mm: introduce page_lru_type()
Date: Wed, 22 Jul 2009 21:37:10 +0900 [thread overview]
Message-ID: <28c262360907220537j28035086x82869da4fb819da3@mail.gmail.com> (raw)
In-Reply-To: <20090722090719.GA1971@cmpxchg.org>
On Wed, Jul 22, 2009 at 6:07 PM, Johannes Weiner<hannes@cmpxchg.org> wrote:
> Hello Minchan,
>
> On Wed, Jul 22, 2009 at 10:52:21AM +0900, Minchan Kim wrote:
>> Hi.
>>
>> On Tue, Jul 21, 2009 at 5:56 PM, Johannes Weiner<hannes@cmpxchg.org> wrote:
>> > Instead of abusing page_is_file_cache() for LRU list index arithmetic,
>> > add another helper with a more appropriate name and convert the
>> > non-boolean users of page_is_file_cache() accordingly.
>> >
>> > Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
>> > ---
>> > include/linux/mm_inline.h | 19 +++++++++++++++++--
>> > mm/swap.c | 4 ++--
>> > mm/vmscan.c | 6 +++---
>> > 3 files changed, 22 insertions(+), 7 deletions(-)
>> >
>> > diff --git a/include/linux/mm_inline.h b/include/linux/mm_inline.h
>> > index 7fbb972..ec975f2 100644
>> > --- a/include/linux/mm_inline.h
>> > +++ b/include/linux/mm_inline.h
>> > @@ -60,6 +60,21 @@ del_page_from_lru(struct zone *zone, struct page *page)
>> > }
>> >
>> > /**
>> > + * page_lru_type - which LRU list type should a page be on?
>> > + * @page: the page to test
>> > + *
>> > + * Used for LRU list index arithmetic.
>> > + *
>> > + * Returns the base LRU type - file or anon - @page should be on.
>> > + */
>> > +static enum lru_list page_lru_type(struct page *page)
>> > +{
>> > + if (page_is_file_cache(page))
>> > + return LRU_INACTIVE_FILE;
>> > + return LRU_INACTIVE_ANON;
>> > +}
>>
>> page_lru_type function's semantics is general but this function only
>> considers INACTIVE case.
>> So we always have to check PageActive to know exact lru type.
>>
>> Why do we need double check(ex, page_lru_type and PageActive) to know
>> exact lru type ?
>>
>> It wouldn't be better to check it all at once ?
>
> page_lru() does that for you already.
>
> But look at the users of page_lru_type(), they know the active bit
> when they want to find out the base type, see check_move_unevictable
> e.g.
Yes. You already mentioned proper function name. :)
How about changing function name from page_lru_type to page_lru_base_type ?
it might be a nitpick. :)
--
Kind regards,
Minchan Kim
--
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>
next prev parent reply other threads:[~2009-07-22 12:37 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 [this message]
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
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=28c262360907220537j28035086x82869da4fb819da3@mail.gmail.com \
--to=minchan.kim@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.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 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).