linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Schlichter <schlicht@uni-mannheim.de>
To: Andrew Morton <akpm@digeo.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [RFC] first try for swap prefetch
Date: Fri, 11 Apr 2003 13:51:55 +0200	[thread overview]
Message-ID: <200304111352.05774.schlicht@uni-mannheim.de> (raw)
In-Reply-To: <20030410161826.04332890.akpm@digeo.com>

[-- Attachment #1: signed data --]
[-- Type: text/plain, Size: 2682 bytes --]

On April 11, Andrew Morton wrote:
> Thomas Schlichter <schlicht@uni-mannheim.de> wrote:
> > Hi,
> >
> > as mentioned a few days ago I was going to try to implement a swap
> > prefetch to better utilize the free memory. Now here is my first try.
>
> That's surprisingly cute.  Does it actually do anything noticeable?

Well, it fills free pagecache memory with swapped pages... ;-)

But at the moment I can not 'feel' any real improvement... :-(
I think the problem is that R/O pages are not written to swap space and so not 
prefetched with my patch. But I will look after it...

> +	swapped_entry = kmalloc(sizeof(*swapped_entry), GFP_ATOMIC);
>
> These guys will need a slab cache (not SLAB_HW_CACHE_ALIGNED) to save
> space.

OK, I'll do it.

> +	swapped_entry = radix_tree_lookup(&swapped_root.tree, entry.val);
> +	if(swapped_entry) {
> +		list_del(&swapped_entry->list);
> +		radix_tree_delete(&swapped_root.tree, entry.val);
>
> you can just do
>
> 	if (radix_tree_delete(...) != -ENOENT)
> 		list_del(...)
>
> +		read_swap_cache_async(entry);

Sorry, but I think I can not. The list_del() needs the value returned by 
radix_tree_lookup(), so I can not kick it... By the way, the only reason for 
the radix tree is to make this list_del() not O(n) for searching the list... 
Do you know how expensive the radix_tree_lookup() is? O(1) or O(log(n))?? For 
my shame I do not really know that data structure... :-(

> What you want here is a way of telling if the disk(s) which back the swap
> are idle.  We used to have that, but Hugh deleted it.  It can be put back,
> but it's probably better to put a `last_read_request_time' and
> `last_write_request_time' into struct backing_dev_info.  If nobody has used
> the disk in the past N milliseconds, then start the speculative swapin.

That's good. I was looking for anything like that but didn't find anything 
fitting in the current sources...

> It might make sense to poke the speculative swapin code in the page-freeing
> path too.

I wanted to do this but don't know which function is the correct one for this. 
But I will search harder... or can you give me a hint?

> And to put the speculatively-swapped-in pages at the tail of the inactive
> list (perhaps).

This may be a good idea...

> But first-up, some demonstrated goodness is needed...

Yup, but currently it improves nothing very much, as stated above, I think 
first I should implement the R/O pages thing and investigete which part of 
the kernel works against my code and frees some pages after I just filled 
them...

Thank you for helping me with your comments!

Best regards
   Thomas

[-- Attachment #2: signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2003-04-11 11:40 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-10 17:47 [RFC] first try for swap prefetch Thomas Schlichter
2003-04-10 23:18 ` Andrew Morton
2003-04-11 11:51   ` Thomas Schlichter [this message]
2003-04-11 12:13     ` William Lee Irwin III
2003-04-11 12:21     ` John Bradford
2003-04-11 12:22       ` Zwane Mwaikambo
2003-04-11 13:29         ` John Bradford
2003-04-11 21:39     ` Andrew Morton
2003-04-12  5:05       ` Thomas Schlichter
2003-04-12  5:37         ` Andrew Morton
2003-04-17 16:02           ` [RFC] second try for swap prefetch (does Oops!) Thomas Schlichter
2003-04-11 16:57 [RFC] first try for swap prefetch Chuck Ebbert

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=200304111352.05774.schlicht@uni-mannheim.de \
    --to=schlicht@uni-mannheim.de \
    --cc=akpm@digeo.com \
    --cc=linux-kernel@vger.kernel.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).