linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Marcelo Tosatti <marcelo.tosatti@cyclades.com>
To: akpm@osdl.org, linux-mm@kvack.org
Subject: swap space address layout improvements in -mm
Date: Wed, 20 Apr 2005 14:23:10 -0300	[thread overview]
Message-ID: <20050420172310.GA8871@logos.cnet> (raw)

Hi Andrew,

I have spent some time reading your swap space allocation patch.

+ * We divide the swapdev into 1024 kilobyte chunks.  We use the cookie and the
+ * upper bits of the index to select a chunk and the rest of the index as the
+ * offset into the selected chunk.
+ */
+#define CHUNK_SHIFT    (20 - PAGE_SHIFT)
+#define CHUNK_MASK     (-1UL << CHUNK_SHIFT)
+
+static int
+scan_swap_map(struct swap_info_struct *si, void *cookie, pgoff_t index)
+{
+       unsigned long chunk;
+       unsigned long nchunks;
+       unsigned long block;
+       unsigned long scan;
+
+       nchunks = si->max >> CHUNK_SHIFT;
+       chunk = 0;
+       if (nchunks)
+               chunk = hash_long((unsigned long)cookie + (index & CHUNK_MASK),
+                                       BITS_PER_LONG) % nchunks;
+
+       block = (chunk << CHUNK_SHIFT) + (index & ~CHUNK_MASK);

>From what I can understand you're aiming at having virtually contiguous pages sequentially 
allocated on disk.  

I just dont understand how you want that to be achieved using the hash function, which is 
quite randomic... In practice, the calculated hash values have most of its MostSignificantBit's 
changed at each increment of 255, resulting in non sequential block values at such 
index increments. 

The first and subsequent block allocations are simply randomic, instead of being sequential.
Hit me with your cluebat.
 
>From what I know, it is interesting to allocate from (0 in direction to -> end block) 
(roughly what sct allocation scheme does).

I suspect a more advanced fs-like swap allocation scheme is wanted. 


--
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:"aart@kvack.org"> aart@kvack.org </a>

             reply	other threads:[~2005-04-20 17:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-20 17:23 Marcelo Tosatti [this message]
2005-05-03  6:43 ` Andrew Morton

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=20050420172310.GA8871@logos.cnet \
    --to=marcelo.tosatti@cyclades.com \
    --cc=akpm@osdl.org \
    --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