All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@transmeta.com>
To: "Stephen C. Tweedie" <sct@redhat.com>
Cc: masp0008@stud.uni-sb.de, "linux-mm@kvack.org" <linux-mm@kvack.org>
Subject: Re: [PATCH] Re: swapcache bug?
Date: Mon, 8 Feb 1999 09:32:24 -0800 (PST)	[thread overview]
Message-ID: <Pine.LNX.3.95.990208092701.31153B-100000@penguin.transmeta.com> (raw)
In-Reply-To: <199902081639.QAA03290@dax.scot.redhat.com>


On Mon, 8 Feb 1999, Stephen C. Tweedie wrote:
> 
> Good point, the line include/linux/pagemap.h:39,
> 
> 	return s(i+o) & (PAGE_HASH_SIZE-1);
> 
> should probably be 
> 
> 	return s(i+o+offset) & (PAGE_HASH_SIZE-1);
> 
> to mix in the low order bits for swap entries.  Well spotted.  Anyone
> see anything wrong with this one-liner change?

Yes, the above will potentially result in different hash entries for the
same page, which means that we now have aliasing and basically just random
behaviour. 

It _may_ be that the hash function is always called with a page-aligned
offset, but that was not how it was strictly meant to be: the way the
thing was envisioned you could just find the page at "offset" by doing

	page_hash(inode,offset)

without page-aligning offset before you did this.

If anything, maybe the swap cache should just use the high bits in the
"offset" field (or at least prefer to do so: something like

	page->offset = swap_entry_to_offset(entry);

and 
	entry = offset_to_swap_entry(page->offset);

that does a PAGE_MASK_BITS rotate on the bits..

		Linus

--
To unsubscribe, send a message with 'unsubscribe linux-mm my@address'
in the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://humbolt.geo.uu.nl/Linux-MM/

  reply	other threads:[~1999-02-07 22:27 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-02-07 18:21 swapcache bug? Manfred Spraul
1999-02-07 21:30 ` Eric W. Biederman
1999-02-08 16:39 ` [PATCH] " Stephen C. Tweedie
1999-02-08 17:32   ` Linus Torvalds [this message]
1999-02-08 17:51     ` Stephen C. Tweedie
1999-02-08 18:48       ` Linus Torvalds
1999-02-08 21:13         ` Matti Aarnio
1999-02-09  7:15         ` Eric W. Biederman
1999-02-09 16:32           ` Linus Torvalds
1999-02-10  0:28             ` Eric W. Biederman

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=Pine.LNX.3.95.990208092701.31153B-100000@penguin.transmeta.com \
    --to=torvalds@transmeta.com \
    --cc=linux-mm@kvack.org \
    --cc=masp0008@stud.uni-sb.de \
    --cc=sct@redhat.com \
    /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.