From: "Stone Wang" <pwstone@gmail.com>
To: Nick Piggin <nickpiggin@yahoo.com.au>
Cc: akpm@osdl.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH][8/8] mm: lru interface change
Date: Tue, 21 Mar 2006 10:53:40 -0500 [thread overview]
Message-ID: <bc56f2f0603210753k758ebf6dq@mail.gmail.com> (raw)
In-Reply-To: <441FF007.6020901@yahoo.com.au>
> I may have missed something very trivial, but... why are they on a
> list at all if they don't get scanned
Get the locked pages on a list is necessary for page management,
scatter the locked pages around isnt a good idea.
Also, we could add some kinds of scan to the locked pages,
if we find that it's necessary.
Shaoping Wang
2006/3/21, Nick Piggin <nickpiggin@yahoo.com.au>:
> Stone Wang wrote:
> > Add Wired list to LRU.
> > Add PG_Wired bit to page.
> >
>
> I may have missed something very trivial, but... why are they on a
> list at all if they don't get scanned?
>
>
> > diff -urN linux-2.6.15.orig/mm/swap.c linux-2.6.15/mm/swap.c
> > --- linux-2.6.15.orig/mm/swap.c 2006-01-02 22:21:10.000000000 -0500
> > +++ linux-2.6.15/mm/swap.c 2006-03-07 11:45:37.000000000 -0500
> > @@ -110,6 +110,44 @@
> > spin_unlock_irq(&zone->lru_lock);
> > }
> >
> > +/* Wire the page; if the page is in LRU,
> > + * try move it to Wired list.
> > + */
> > +void fastcall wire_page(struct page *page)
>
> Ahh, here's the elusive beast.
>
> > +{
> > + struct zone *zone = page_zone(page);
> > +
> > + spin_lock_irq(&zone->lru_lock);
>
> This is a fairly heavy lock for something which is going into page fault
> fastpaths and such. You might be better off making wired_count atomic and
> not using a lock in the common case if possible (even if it is only for
> mlocked pages, I'm sure someone will complain).
>
> > + page->wired_count ++;
>
> Oh dear, I missed this change you made to struct page, tucked away in 5/8.
> This alone pretty much makes it a showstopper, I'm afraid. You'll have to
> work out some other way to do it so as not to penalise 99.999% of machines
> which don't need this.
>
> (Oh, and making the field a short usually won't help either, because of
> alignment constraints).
>
> > + if(!PageWired(page)){
> > + if(PageLRU(page)){
> > + del_page_from_lru(zone, page);
> > + add_page_to_wired_list(zone,page);
> > + SetPageWired(page);
> > + }
> > + }
> > + spin_unlock_irq(&zone->lru_lock);
> > +}
> > +
> > +/* Unwire the page.
> > + * If it isnt wired by any process, try move it to active list.
> > + */
> > +void fastcall unwire_page(struct page *page)
> > +{
> > + struct zone *zone = page_zone(page);
> > +
> > + spin_lock_irq(&zone->lru_lock);
> > + page->wired_count --;
> > + if(!page->wired_count){
> > + if(PageLRU(page) && TestClearPageWired(page)){
> > + del_page_from_wired_list(zone,page);
> > + add_page_to_active_list(zone,page);
> > + SetPageActive(page);
> > + }
> > + }
> > + spin_unlock_irq(&zone->lru_lock);
> > +}
> > +
> > /*
> > * Mark a page as having seen activity.
> > *
> > @@ -119,11 +157,13 @@
> > */
> > void fastcall mark_page_accessed(struct page *page)
> > {
> > - if (!PageActive(page) && PageReferenced(page) && PageLRU(page)) {
> > - activate_page(page);
> > - ClearPageReferenced(page);
> > - } else if (!PageReferenced(page)) {
> > - SetPageReferenced(page);
> > + if(!PageWired(page)) {
> > + if (!PageActive(page) && PageReferenced(page) && PageLRU(page)) {
> > + activate_page(page);
> > + ClearPageReferenced(page);
> > + } else if (!PageReferenced(page)) {
> > + SetPageReferenced(page);
> > + }
> > }
> > }
> >
>
> So, umm... what happens when the page gets wired before activate_page()?
>
> > @@ -178,13 +218,15 @@
> > struct zone *zone = page_zone(page);
> >
> > spin_lock_irqsave(&zone->lru_lock, flags);
> > - if (TestClearPageLRU(page))
> > - del_page_from_lru(zone, page);
> > - if (page_count(page) != 0)
> > - page = NULL;
> > + if(!PageWired(page)) {
> > + if (TestClearPageLRU(page))
> > + del_page_from_lru(zone, page);
> > + if (page_count(page) != 0)
> > + page = NULL;
> > + if (page)
> > + free_hot_page(page);
> > + }
> > spin_unlock_irqrestore(&zone->lru_lock, flags);
> > - if (page)
> > - free_hot_page(page);
> > }
> >
>
> Hmm... how do PageWired pages get freed, then?
>
> > EXPORT_SYMBOL(__page_cache_release);
> > @@ -214,7 +256,8 @@
> >
> > if (!put_page_testzero(page))
> > continue;
> > -
> > + if(PageWired(page))
> > + continue;
> > pagezone = page_zone(page);
> > if (pagezone != zone) {
> > if (zone)
>
> Ditto.
>
> --
> SUSE Labs, Novell Inc.
>
>
> Send instant messages to your online friends http://au.messenger.yahoo.com
>
>
--
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:[~2006-03-21 15:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-20 13:38 Stone Wang
2006-03-21 12:22 ` Nick Piggin
2006-03-21 13:13 ` Arjan van de Ven
2006-03-21 15:53 ` Stone Wang [this message]
2006-03-22 0:18 ` Nick Piggin
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=bc56f2f0603210753k758ebf6dq@mail.gmail.com \
--to=pwstone@gmail.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=nickpiggin@yahoo.com.au \
/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