All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcelo Tosatti <marcelo.tosatti@cyclades.com>
To: a.p.zijlstra@chello.nl
Cc: linux-mm@kvack.org
Subject: Re: [RFC][PATCH 0/6] CART Implementation
Date: Sat, 27 Aug 2005 21:25:19 -0300	[thread overview]
Message-ID: <20050828002519.GA26764@dmt.cnet> (raw)
In-Reply-To: <20050827215756.726585000@twins>

Hi Peter,

On Sat, Aug 27, 2005 at 11:57:56PM +0200, a.p.zijlstra@chello.nl wrote:
> Hi All,
> 
> (now split as per request)
> 
> After another day of hard work I feel I have this CART implementation
> complete.
> 
> It survives a pounding and the stats seem pretty stable.
> 
> The things that need more work:
>  1) the hash function seems pretty lousy
>  2) __cart_remember() called from shrink_list() needs zone->lru_lock
> 
> The whole non-resident code is based on the idea that the hash function
> gives an even spread so that:
> 
>  B1_j     B1
> ------ ~ ---- 
>  B2_j     B2
> 
> However after a pounding the variance in (B1_j - B2_j) as given by the
> std. deviation: sqrt(<x^2> - <x>^2) is around 10. And this for a bucket
> with 57 slots.
> 
> The other issue is that __cart_remember() needs the zone->lru_lock. This
> function is called from shrink_list() where the lock is explicitly
> avoided, so this seems like an issue. Alternatives would be atomic_t for
> zone->nr_q or a per cpu counter delta. Suggestions? 
>
> Also I made quite some changes in swap.c and vmscan.c without being an
> expert on the code. Did I foul up too bad?
> 
> Then ofcourse I need to benchmark, suggestions?
> 
> Some of this code is shamelessly copied from Rik van Riel, other parts 
> are inspired by code from Rahul Iyer. 
> 
> Any comments appreciated.

+/* This function selects the candidate and returns the corresponding
+ * struct page * or returns NULL in case no page can be freed.
+ */
+struct page *__cart_replace(struct zone *zone)
+{
+	struct page *page;
+	int referenced;
+
+	while (!list_empty(list_T2)) {
+		page = list_entry(list_T2->next, struct page, lru);
+
+		if (!page_referenced(page, 0, 0))
+			break;
+
+		del_page_from_inactive_list(zone, page);
+		add_page_to_active_tail(zone, page);
+		SetPageActive(page);
+
+		cart_q_inc(zone);
+	}

If you find an unreferenced page in the T2 list you don't keep a reference 
to it performing a search on the T1 list below? That looks bogus.

Apart from that, both while (!list_empty(list_T2)) are problematic. If there
are tons of referenced pages you simply loop, unlimited? And what about 
the lru lock required for dealing with page->lru ?

Look at the original algorithm: it grabs SWAP_CLUSTER_MAX pages from the inactive
list, puts them into a CPU local list (on the stack), releases the lru lock, 
and works on the isolated pages. You want something similar.

As for testing, STP is really easy: 

http://www.osdl.org/lab_activities/kernel_testing/stp

+
+	while (!list_empty(list_T1)) {
+		page = list_entry(list_T1->next, struct page, lru);
+		referenced = page_referenced(page, 0, 0);

--
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>

  parent reply	other threads:[~2005-08-28  0:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-27 21:57 [RFC][PATCH 0/6] CART Implementation a.p.zijlstra
2005-08-27 21:57 ` [RFC][PATCH 1/6] " a.p.zijlstra
2005-08-27 21:57 ` [RFC][PATCH 2/6] " a.p.zijlstra
2005-08-29  3:02   ` Rik van Riel
2005-08-29  4:15     ` Peter Zijlstra
2005-08-29  6:20       ` Peter Zijlstra
2005-08-27 21:57 ` [RFC][PATCH 3/6] " a.p.zijlstra
2005-08-27 21:58 ` [RFC][PATCH 4/6] " a.p.zijlstra
2005-08-27 21:58 ` [RFC][PATCH 5/6] " a.p.zijlstra
2005-08-27 21:58 ` [RFC][PATCH 6/6] " a.p.zijlstra
2005-08-28  0:25 ` Marcelo Tosatti [this message]
2005-08-28  8:03   ` [RFC][PATCH 0/6] " Peter Zijlstra

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=20050828002519.GA26764@dmt.cnet \
    --to=marcelo.tosatti@cyclades.com \
    --cc=a.p.zijlstra@chello.nl \
    --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.