swap partition seems faster than a swap file (Re: [SHR-Unstable] swapon: swapfile has holes)

2009-09-06 Thread Timo Juhani Lindfors
Matthias Huber matthias.hu...@wollishausen.de writes:
 afaik, it is much faster than file.

On a computer with 256M ram and compact flash as storage I ran

#include stdio.h
#include stdlib.h
#include string.h
#include assert.h

#define BUFSIZE (400*1024*1024)

int main(int argc, char *argv[]) {
  char *p;
  int i;
  int ret;

  puts(allocating memory);
  p = malloc(BUFSIZE);
  assert(p);

  puts(writing to memory);
  for (i = 0; i  BUFSIZE; i++) {
p[i] ^= 3;
  }

  puts(reading from memory);
  for (i = 0; i  BUFSIZE; i++) {
ret ^= p[i];
  }
  return ret;
}

with both cases. It seems that partition is somewhat faster indeed:

256M swap partition:

$ for i in 1 2 3 4; do time ./a.out ; done
allocating memory
writing to memory
reading from memory

real3m47.793s
user0m27.282s
sys 0m5.592s
allocating memory
writing to memory
reading from memory

real3m16.614s
user0m27.114s
sys 0m5.624s
allocating memory
writing to memory
reading from memory

real3m10.966s
user0m27.010s
sys 0m5.456s
allocating memory
writing to memory
reading from memory

real3m14.328s
user0m27.106s
sys 0m5.160s

256M swap file:

allocating memory
writing to memory
reading from memory

real6m19.494s
user0m27.630s
sys 0m6.956s
allocating memory
writing to memory
reading from memory

real3m49.047s
user0m27.698s
sys 0m5.028s
allocating memory
writing to memory
reading from memory

real4m18.462s
user0m27.442s
sys 0m5.296s
allocating memory
writing to memory
reading from memory

real4m1.905s
user0m27.858s
sys 0m4.928s

___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community


Re: [SHR-Unstable] swapon: swapfile has holes

2009-09-06 Thread Greg Bonett
On Sat, 05 Sep 2009 10:57:32 +0200
Matthias Huber matthias.hu...@wollishausen.de wrote:

 Greg Bonett schrieb:
  Hi there,
  I just installed SHR unstable and I'm impressed at how usable and
  responsive it is.  However, while I was performing a opkg operation
  I ran out of memory so I tried to add a swap file. 
  When following the instructions at:
  http://wiki.openmoko.org/wiki/SHR_User_Manual#SwapSpace
  I get the error:
  swapon: /swapfile: Invalid argument
  and dmesg shows:
  swapon: swapfile has holes
 
  I've tried files on the sd card and also on the internal memory.
  Any suggestions?
 

 i could imagine, it must be at one extent, so you should try two
 things:
 
 * format your sdcard and make the swapfile on the newly created fs.
 *** but if you are formatting the card, you can make a real swap
 _partition_ also.
 

I ended up making a swap partition and it seems to be working without
any problems.  Thanks for the help.

-Greg

___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community


Re: [SHR-Unstable] swapon: swapfile has holes

2009-09-05 Thread Matthias Huber
Greg Bonett schrieb:
 Hi there,
 I just installed SHR unstable and I'm impressed at how usable and
 responsive it is.  However, while I was performing a opkg operation I
 ran out of memory so I tried to add a swap file. 
 When following the instructions at:
 http://wiki.openmoko.org/wiki/SHR_User_Manual#SwapSpace
 I get the error:
 swapon: /swapfile: Invalid argument
 and dmesg shows:
 swapon: swapfile has holes

 I've tried files on the sd card and also on the internal memory.
 Any suggestions?

   
i could imagine, it must be at one extent, so you should try two things:

* format your sdcard and make the swapfile on the newly created fs.
*** but if you are formatting the card, you can make a real swap
_partition_ also.


___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community


Re: [SHR-Unstable] swapon: swapfile has holes

2009-09-05 Thread Laszlo KREKACS
On Sat, Sep 5, 2009 at 10:57 AM, Matthias
Hubermatthias.hu...@wollishausen.de wrote:
 *** but if you are formatting the card, you can make a real swap
 _partition_ also.

I prefer the file over partition, because you can make bigger or shrink
whenever you want. And giving a separate partition is just a luxury, when
you can only create four (above that serious tweaking is necessary).


Best regards,
 Laszlo

___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community


Re: [SHR-Unstable] swapon: swapfile has holes

2009-09-05 Thread Matthias Huber
Timo Juhani Lindfors schrieb:
 Matthias Huber matthias.hu...@wollishausen.de writes:
   
 *** but if you are formatting the card, you can make a real swap
 _partition_ also.
 

 What are the advantages of a swap partition? The only one I can think
 of is that it can be used for software suspend.

   
afaik, it is much faster than file.

-- 
MatzeHuber

___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community


Re: [SHR-Unstable] swapon: swapfile has holes

2009-09-05 Thread Laszlo KREKACS
On Sat, Sep 5, 2009 at 11:45 AM, Matthias
Hubermatthias.hu...@wollishausen.de wrote:
 afaik, it is much faster than file.

Benchmark it!;)
I think glamo is enough bottleneck to make all the two the same slowiness...

But just guessing.

Laszlo

___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community


Re: [SHR-Unstable] swapon: swapfile has holes

2009-09-05 Thread David Garabana Barro
O Sábado, 5 de Setembro de 2009, Timo Juhani Lindfors escribiu:
 Matthias Huber matthias.hu...@wollishausen.de writes:
  *** but if you are formatting the card, you can make a real swap
  _partition_ also.
 
 What are the advantages of a swap partition? The only one I can think
 of is that it can be used for software suspend.

If you have more than a distro installed, you can use *the same* partition for 
all distros.
You will only waste space onece ;)


-- 
David Garabana Barro
jabber  google talk ID:da...@garabana.com
Clave pública PGP/GPG:  http://davide.garabana.com/pgp.html


signature.asc
Description: This is a digitally signed message part.
___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community


Re: [SHR-Unstable] swapon: swapfile has holes

2009-09-05 Thread David Garabana Barro
O Sábado, 5 de Setembro de 2009, Laszlo KREKACS escribiu:
 
 I prefer the file over partition, because you can make bigger or shrink
 whenever you want. And giving a separate partition is just a luxury, when
 you can only create four (above that serious tweaking is necessary).

Four???
You can create up to 7:

r...@om-gta02 ~ $ fdisk -l /dev/mmcblk0

Disk /dev/mmcblk0: 7969 MB, 7969177600 bytes
246 heads, 62 sectors/track, 1020 cylinders
Units = cylinders of 15252 * 512 = 7809024 bytes

Device Boot  Start End  Blocks   Id  System
/dev/mmcblk0p1   1   6   45725   83  Linux
/dev/mmcblk0p2   7 108  777852   83  Linux
/dev/mmcblk0p3 109 313 1563330   83  Linux
/dev/mmcblk0p4 3141020 53915825  Extended
/dev/mmcblk0p5 314 390  587171   83  Linux
/dev/mmcblk0p6 391 994 4606073   83  Linux
/dev/mmcblk0p7 9951020  198245   82  Linux swap / 
Solaris

-- 
David Garabana Barro
jabber  google talk ID:da...@garabana.com
Clave pública PGP/GPG:  http://davide.garabana.com/pgp.html


signature.asc
Description: This is a digitally signed message part.
___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community


Re: [SHR-Unstable] swapon: swapfile has holes

2009-09-05 Thread William Kenworthy
On Sat, 2009-09-05 at 11:45 +0200, Matthias Huber wrote:
 Timo Juhani Lindfors schrieb: 
  Matthias Huber matthias.hu...@wollishausen.de writes:

   *** but if you are formatting the card, you can make a real swap
   _partition_ also.
   
  
  What are the advantages of a swap partition? The only one I can think
  of is that it can be used for software suspend.
  

 afaik, it is much faster than file.
 
 -- 
 MatzeHuber

I use swapfiles occasionally on my desktop when it looks like I need
more swap (large graphics - gimp) - I would disagree that a swap
partition is much faster - experience shows its more like much, much,
much ... faster :)

Not of much use on th FR, but swap partitions on different drives having
the same priority use a parallel striping for read/write (like raid0)
for a speedup.

BillK


___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community


[SHR-Unstable] swapon: swapfile has holes

2009-09-04 Thread Greg Bonett
Hi there,
I just installed SHR unstable and I'm impressed at how usable and
responsive it is.  However, while I was performing a opkg operation I
ran out of memory so I tried to add a swap file. 
When following the instructions at:
http://wiki.openmoko.org/wiki/SHR_User_Manual#SwapSpace
I get the error:
swapon: /swapfile: Invalid argument
and dmesg shows:
swapon: swapfile has holes

I've tried files on the sd card and also on the internal memory.
Any suggestions?

Thanks.
-Greg


___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community