linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* swap space address layout improvements in -mm
@ 2005-04-20 17:23 Marcelo Tosatti
  2005-05-03  6:43 ` Andrew Morton
  0 siblings, 1 reply; 2+ messages in thread
From: Marcelo Tosatti @ 2005-04-20 17:23 UTC (permalink / raw)
  To: akpm, linux-mm

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>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-05-03  6:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-20 17:23 swap space address layout improvements in -mm Marcelo Tosatti
2005-05-03  6:43 ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox