linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Stephen C. Tweedie" <sct@redhat.com>
To: Rik van Riel <H.H.vanRiel@phys.uu.nl>
Cc: Linux MM <linux-mm@kvack.org>, Stephen Tweedie <sct@redhat.com>
Subject: Re: [PATCH] swapin readahead v4
Date: Thu, 3 Dec 1998 12:35:14 GMT	[thread overview]
Message-ID: <199812031235.MAA03337@dax.scot.redhat.com> (raw)
In-Reply-To: <Pine.LNX.3.96.981203111953.4894B-100000@mirkwood.dummy.home>

Hi,

In article
<Pine.LNX.3.96.981203111953.4894B-100000@mirkwood.dummy.home>, Rik van
Riel <H.H.vanRiel@phys.uu.nl> writes:

> Stephen's messages gave away the clue to something I was just
> about to track down myself. Anyway, here is the 4th version of
> my swapin readahead patch.

> @@ -329,6 +329,8 @@
 
>  	set_bit(PG_locked, &new_page->flags);
>  	rw_swap_page(READ, entry, (char *) new_page_addr, wait);
> +	if (!wait)
> +		__free_page(new_page);
>  #ifdef DEBUG_SWAP
>  	printk("DebugVM: read_swap_cache_async created "
>  	       "entry %08lx at %p\n",

Much better to do this after calling read_swap_cache_async(): it's bad
policy to make the reference count of the page after calling this
function dependent on the arguments: that is a maintenance nightmare.  

Oh, and you _still_ need to check the swap_lockmap before calling
read_swap_cache_async(), and you still have the extra break() in the
readahead loop...

Finally, the code before the start of the readahead loop loops really
broken.  You do both a lookup_swap_cache AND a read_swap_cache on the
entry, which is going to double-increment the page count: bad news.
It's probably best to leave the original swapin code intact, and just
add the readahead bits.  You also seem to have a construct

    if (!page_map) {
	page_map = read_swap_cache(entry);
	do something else
    } else {
	page_map = read_swap_cache(entry);
    }

and I can't for the life of me work out why you are doing things this
way!

--Stephen
 
--
This is a majordomo managed list.  To unsubscribe, send a message with
the body 'unsubscribe linux-mm me@address' to: majordomo@kvack.org

  reply	other threads:[~1998-12-03 12:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-12-03 10:21 Rik van Riel
1998-12-03 12:35 ` Stephen C. Tweedie [this message]
1998-12-03 13:28   ` Rik van Riel

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=199812031235.MAA03337@dax.scot.redhat.com \
    --to=sct@redhat.com \
    --cc=H.H.vanRiel@phys.uu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox