Re: another error with md malloc based fs

2007-03-23 Thread Michael Schuh

Hi Oliver,
Hi @list,

yes that's exatly what i have in my mind,
after the explainings from Chuck.

thanks very much

cheers

michael


2007/3/23, Oliver Fromme <[EMAIL PROTECTED]>:


Michael Schuh wrote:
> Chuck Swiger wrote:
> > Michael Schuh wrote:
> > > i can't understand how malloc can eat all available
> > > memory, i have 2Gigs of it ;-)
> > > so it seems to me i know what i doing, if
> > > i have 1,6 Gigs free Memory, and i say ok get me 750Megs from
> > > my 1,6 Gigs of free Memory, what was faulty on that
> >
> > The two choices involve a swap-based RAMdisk, which can use all of
> > the available physical RAM it needs to, since this memory is
> > swappable, or a kernel-memory-based RAMdisk, which uses wired-down
> > memory from within the kernel.
>
> Ok, so that is it harder to understand for me in the first time,
> if i understand it now right the swap or file based memory backend
> is also in the ram, but it get another way managed from kernels vm.
> the malloc based ramdisk get's not reallly managed by the kvm,
> but it underlays under the paging and swapping, and also
> ba the "thread-killer" there shot's thread down it it get's to much
> work for the system
>
> i hope i understand this right, it is important for me...

Let me try to explain it with a little different words.
The following is a bit simplified, but it should give
you an idea about the advantages and disadvantages of
each md disk type.

First of all, _both_ "malloc" and "swap"-backed md disks
are RAM disks.  You don't have to worry that a swap-backed
md disk will be created on your swap partiton.  It's not.
It will reside in RAM, just like a "malloc" md disk.

However, the difference is that a malloc md disk uses
memory from the KVM area (kernel virtual memory), which
is hardwired into the RAM.  It cannot be paged, and it
is taken from the kernel's own memory pool, which is
usually much smaller than your total available RAM.
It's taken from the same pool of RAM that's used for
network buffers, driver data and similar things.

On the other hand, "swap-backed" md disks use regular
memory, so to speak, just like a normal user process.
That also means that they are pageable, which means
that they can be paged to swap if necessary (if the
systems runs low on RAM).  That's what "swap-backed"
means.  Because of that, they don't have a size limit
(well, they shouldn't be bigger than your RAM + swap,
of course).  If there is enough RAM, then they will
stay completely in RAM and will _not_ touch your swap
at all.

For typical RAM disks, such as for /tmp, you should use
a swap-backed md disk (it should be the default).  The
"malloc" type should be used only for rather small,
special uses.

I hope it's now a little clearer.

Best regards
   Oliver

--
Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing b. M.
Handelsregister: Registergericht Muenchen, HRA 74606,  Geschäftsfuehrung:
secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht Mün-
chen, HRB 125758,  Geschäftsführer: Maik Bachmann, Olaf Erb, Ralf Gebhart

FreeBSD-Dienstleistungen, -Produkte und mehr:  http://www.secnetix.de/bsd

"[...]  one observation we can make here is that Python makes
an excellent pseudocoding language, with the wonderful attribute
that it can actually be executed."  --  Bruce Eckel





--
=== michael-schuh.net ===
Michael Schuh
Preußenstr. 13
66111 Saarbrücken
phone: 0681/8319664
mobil:   0177/9738644
@: [EMAIL PROTECTED]

=== Ust-ID: DE251072318 ===
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: another error with md malloc based fs

2007-03-23 Thread Oliver Fromme
Kevin Oberman wrote:
 > I thought the warning in the man page was adequate (until 7.0 changes
 > the default to swap backed), but, at least in Michael's case, I guess I
 > was wrong. I guess the man page need to somehow make it clear that the
 > memory used by malloc backed mds is a very limited resource.

I think it's not necessarily only the language barrier,
but the fact that not everyone is familiar with technical
terms and details.  I guess that many people don't know
what "swap-backed" means exactly.  I also think that the
name "malloc" is badly chosen in that context ...  even
a (userland) programmer might confuse it with malloc(3),
which is quite a different thing.

Best regards
   Oliver

-- 
Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing b. M.
Handelsregister: Registergericht Muenchen, HRA 74606,  Geschäftsfuehrung:
secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht Mün-
chen, HRB 125758,  Geschäftsführer: Maik Bachmann, Olaf Erb, Ralf Gebhart

FreeBSD-Dienstleistungen, -Produkte und mehr:  http://www.secnetix.de/bsd

"If Java had true garbage collection, most programs
would delete themselves upon execution."
-- Robert Sewell
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: another error with md malloc based fs

2007-03-23 Thread Kevin Oberman
Oliver,

Thanks for this excellent article. I was trying to write about the same
thing, but keep it simple enough to improve the chances of it crossing
the language barrier weel enough to be useful. I believe you did a really
good job of this and saved me several minutes of tying to do the same.

I thought the warning in the man page was adequate (until 7.0 changes
the default to swap backed), but, at least in Michael's case, I guess I
was wrong. I guess the man page need to somehow make it clear that the
memory used by malloc backed mds is a very limited resource.
-- 
R. Kevin Oberman, Network Engineer
Energy Sciences Network (ESnet)
Ernest O. Lawrence Berkeley National Laboratory (Berkeley Lab)
E-mail: [EMAIL PROTECTED]   Phone: +1 510 486-8634
Key fingerprint:059B 2DDF 031C 9BA3 14A4  EADA 927D EBB3 987B 3751


pgpND9BHTEswl.pgp
Description: PGP signature


Re: another error with md malloc based fs

2007-03-23 Thread Oliver Fromme
Michael Schuh wrote:
 > Chuck Swiger wrote:
 > > Michael Schuh wrote:
 > > > i can't understand how malloc can eat all available
 > > > memory, i have 2Gigs of it ;-)
 > > > so it seems to me i know what i doing, if
 > > > i have 1,6 Gigs free Memory, and i say ok get me 750Megs from
 > > > my 1,6 Gigs of free Memory, what was faulty on that
 > > 
 > > The two choices involve a swap-based RAMdisk, which can use all of
 > > the available physical RAM it needs to, since this memory is
 > > swappable, or a kernel-memory-based RAMdisk, which uses wired-down
 > > memory from within the kernel.
 > 
 > Ok, so that is it harder to understand for me in the first time,
 > if i understand it now right the swap or file based memory backend
 > is also in the ram, but it get another way managed from kernels vm.
 > the malloc based ramdisk get's not reallly managed by the kvm,
 > but it underlays under the paging and swapping, and also
 > ba the "thread-killer" there shot's thread down it it get's to much
 > work for the system
 > 
 > i hope i understand this right, it is important for me...

Let me try to explain it with a little different words.
The following is a bit simplified, but it should give
you an idea about the advantages and disadvantages of
each md disk type.

First of all, _both_ "malloc" and "swap"-backed md disks
are RAM disks.  You don't have to worry that a swap-backed
md disk will be created on your swap partiton.  It's not.
It will reside in RAM, just like a "malloc" md disk.

However, the difference is that a malloc md disk uses
memory from the KVM area (kernel virtual memory), which
is hardwired into the RAM.  It cannot be paged, and it
is taken from the kernel's own memory pool, which is
usually much smaller than your total available RAM.
It's taken from the same pool of RAM that's used for
network buffers, driver data and similar things.

On the other hand, "swap-backed" md disks use regular
memory, so to speak, just like a normal user process.
That also means that they are pageable, which means
that they can be paged to swap if necessary (if the
systems runs low on RAM).  That's what "swap-backed"
means.  Because of that, they don't have a size limit
(well, they shouldn't be bigger than your RAM + swap,
of course).  If there is enough RAM, then they will
stay completely in RAM and will _not_ touch your swap
at all.

For typical RAM disks, such as for /tmp, you should use
a swap-backed md disk (it should be the default).  The
"malloc" type should be used only for rather small,
special uses.

I hope it's now a little clearer.

Best regards
   Oliver

-- 
Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing b. M.
Handelsregister: Registergericht Muenchen, HRA 74606,  Geschäftsfuehrung:
secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht Mün-
chen, HRB 125758,  Geschäftsführer: Maik Bachmann, Olaf Erb, Ralf Gebhart

FreeBSD-Dienstleistungen, -Produkte und mehr:  http://www.secnetix.de/bsd

"[...]  one observation we can make here is that Python makes
an excellent pseudocoding language, with the wonderful attribute
that it can actually be executed."  --  Bruce Eckel
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: another error with md malloc based fs

2007-03-22 Thread M.Hirsch

Michael Schuh schrieb:

hi Chuck,
hi @list

me again, behind the scenes,
i would take over my Server by an hoster from
Linux to FreeBSD on the running system,
while the hoster takes money for pressing 2 buttons and
put a disk in my Server...so
i create now a mfs based system that can bootet from disk and resides
fully in ram. I have tryed out Colin's depenguinator,
but it fails...some times
now i would do the steps by hand

thanks

cheers

michael


Hi Michael!

Some months ago I modified the depenguinator and made it work again. But 
sorry, I didn't yet get to write down all the steps involved (I am not a 
good writer). But I recently found another much more comfortable way 
using QEMU which I documented.
Does your provider offer a linux rescue system? If yes, you can try 
this: http://www.vrdevelopers.de/content/view/45/40/1/5/lang,en/


I'll try to follow up with the modified depenguinator asap, but don't 
hold your breath...


HTH,
Manuel
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: another error with md malloc based fs

2007-03-22 Thread Michael Schuh

hi Chuck,
hi @list

me again, behind the scenes,
i would take over my Server by an hoster from
Linux to FreeBSD on the running system,
while the hoster takes money for pressing 2 buttons and
put a disk in my Server...so
i create now a mfs based system that can bootet from disk and resides
fully in ram. I have tryed out Colin's depenguinator,
but it fails...some times
now i would do the steps by hand

thanks

cheers

michael
2007/3/23, Chuck Swiger <[EMAIL PROTECTED]>:


On Mar 22, 2007, at 4:17 PM, Michael Schuh wrote:
> i can't understand how malloc can eat all available
> memory, i have 2Gigs of it ;-)
> so it seems to me i know what i doing, if
> i have 1,6 Gigs free Memory, and i say ok get me 750Megs from
> my 1,6 Gigs of free Memory, what was faulty on that

The two choices involve a swap-based RAMdisk, which can use all of
the available physical RAM it needs to, since this memory is
swappable, or a kernel-memory-based RAMdisk, which uses wired-down
memory from within the kernel.

You shouldn't or can't create huge kernel-based RAMdisks without
expanding the amount of KVM available to the kernel...it's not
reasonable to wire down hundreds of MB or RAM in almost all situations.

> i hope it gave another way to use such ram-disk without using
> swap or other harddisk based backendotoh my ram is not fully
> useful
> for me and i must, after twelve years of using freebsd, looking
> back to
> linux, and that i never would, only for using ramdisks

If you wanted to create a 10MB RAMdisk, using kernel-based memory
would be fine.

For things which are much larger than that, the kernel's global VM
management is using techniques like page-fault frequency heuristics
and will do a better job of keeping active stuff cached in RAM
(regardless of whether the stuff is part of a running process or part
of your RAMdisk filesystem), if you let the kernel manage the
situation than if you try to configure hundreds of MB which can only
be used for a RAMdisk.

Anyway, if you want to use Linux instead, nobody here is going to try
to persuade you to do otherwise.  Have fun,

--
-Chuck





--
=== michael-schuh.net ===
Michael Schuh
Preußenstr. 13
66111 Saarbrücken
phone: 0681/8319664
mobil:   0177/9738644
@: [EMAIL PROTECTED]

=== Ust-ID: DE251072318 ===
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: another error with md malloc based fs

2007-03-22 Thread Michael Schuh

Hi Chuck,


2007/3/23, Chuck Swiger <[EMAIL PROTECTED]>:


On Mar 22, 2007, at 4:17 PM, Michael Schuh wrote:
> i can't understand how malloc can eat all available
> memory, i have 2Gigs of it ;-)
> so it seems to me i know what i doing, if
> i have 1,6 Gigs free Memory, and i say ok get me 750Megs from
> my 1,6 Gigs of free Memory, what was faulty on that

The two choices involve a swap-based RAMdisk, which can use all of
the available physical RAM it needs to, since this memory is
swappable, or a kernel-memory-based RAMdisk, which uses wired-down
memory from within the kernel.



Ok, so that is it harder to understand for me in the first time,
if i understand it now right the swap or file based memory backend
is also in the ram, but it get another way managed from kernels vm.
the malloc based ramdisk get's not reallly managed by the kvm,
but it underlays under the paging and swapping, and also
ba the "thread-killer" there shot's thread down it it get's to much
work for the system

i hope i understand this right, it is important for me...

You shouldn't or can't create huge kernel-based RAMdisks without

expanding the amount of KVM available to the kernel...it's not
reasonable to wire down hundreds of MB or RAM in almost all situations.

> i hope it gave another way to use such ram-disk without using
> swap or other harddisk based backendotoh my ram is not fully
> useful
> for me and i must, after twelve years of using freebsd, looking
> back to
> linux, and that i never would, only for using ramdisks

If you wanted to create a 10MB RAMdisk, using kernel-based memory
would be fine.

For things which are much larger than that, the kernel's global VM
management is using techniques like page-fault frequency heuristics
and will do a better job of keeping active stuff cached in RAM
(regardless of whether the stuff is part of a running process or part
of your RAMdisk filesystem), if you let the kernel manage the
situation than if you try to configure hundreds of MB which can only
be used for a RAMdisk.

Anyway, if you want to use Linux instead, nobody here is going to try
to persuade you to do otherwise.  Have fun,



nop, i don't runaway, i don't disappear to run over to "dead rats" :-D
i will stick to FreeBSD, than i believe it gave no better OS for me :-D
i have many fun with my "lovely" BSD.
at this time it gave only one situation in that i use linux and i hope this
changes i the near future (VMWare:-(   )

thanks for helping to see things a little bit more clear

regards

michael


--
-Chuck





--
=== michael-schuh.net ===
Michael Schuh
Preußenstr. 13
66111 Saarbrücken
phone: 0681/8319664
mobil:   0177/9738644
@: [EMAIL PROTECTED]

=== Ust-ID: DE251072318 ===
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: another error with md malloc based fs

2007-03-22 Thread Chuck Swiger

On Mar 22, 2007, at 4:17 PM, Michael Schuh wrote:

i can't understand how malloc can eat all available
memory, i have 2Gigs of it ;-)
so it seems to me i know what i doing, if
i have 1,6 Gigs free Memory, and i say ok get me 750Megs from
my 1,6 Gigs of free Memory, what was faulty on that


The two choices involve a swap-based RAMdisk, which can use all of  
the available physical RAM it needs to, since this memory is  
swappable, or a kernel-memory-based RAMdisk, which uses wired-down  
memory from within the kernel.


You shouldn't or can't create huge kernel-based RAMdisks without  
expanding the amount of KVM available to the kernel...it's not  
reasonable to wire down hundreds of MB or RAM in almost all situations.



i hope it gave another way to use such ram-disk without using
swap or other harddisk based backendotoh my ram is not fully  
useful
for me and i must, after twelve years of using freebsd, looking  
back to

linux, and that i never would, only for using ramdisks


If you wanted to create a 10MB RAMdisk, using kernel-based memory  
would be fine.


For things which are much larger than that, the kernel's global VM  
management is using techniques like page-fault frequency heuristics  
and will do a better job of keeping active stuff cached in RAM  
(regardless of whether the stuff is part of a running process or part  
of your RAMdisk filesystem), if you let the kernel manage the  
situation than if you try to configure hundreds of MB which can only  
be used for a RAMdisk.


Anyway, if you want to use Linux instead, nobody here is going to try  
to persuade you to do otherwise.  Have fun,


--
-Chuck

___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: another error with md malloc based fs

2007-03-22 Thread Michael Schuh

Hi,

ok i don't know this joke, kbut i know the word's

you have two options option a and option b.

i can't understand how malloc can eat all available
memory, i have 2Gigs of it ;-)
so it seems to me i know what i doing, if
i have 1,6 Gigs free Memory, and i say ok get me 750Megs from
my 1,6 Gigs of free Memory, what was faulty on that

that would imply for me i can't use my 2 Gigs of ram...
and

it also implies that you can put as many ram as you
can find, and you can never use that ram, while a programm
says:" hey guy you are not knowing what you doing..
YOU would use 750Megs of you 24Gigs Ram, no,
you are dumb, you don't use this"


i would use my 2 Gigs of ram, in that way i like :-D
i would a very fast temporary filesystem in my ram.
not more, not less.

and the other question is i have a OS that say's i am a release,
and the documentation say you can do this,
who say don't do this?

i have read the thread abaut malloc, but the errors described
are not the samei have enough ram.
(so show it to me :-D errare humanum est, is it?)

i hope it gave another way to use such ram-disk without using
swap or other harddisk based backendotoh my ram is not fully useful
for me and i must, after twelve years of using freebsd, looking back to
linux,
and that i never would, only for using ramdisks


thanks

regards

michael
2007/3/23, Kevin Oberman <[EMAIL PROTECTED]>:


> Date: Thu, 22 Mar 2007 23:04:16 +0100
> From: "Michael Schuh" <[EMAIL PROTECTED]>
> Sender: [EMAIL PROTECTED]
>
> Hi,
> first i have 2GB of RAM, there are be 1,6G free
> so it should enough toi make the following:
>
> # mdconfig -a -t mallo -s 750m -u 0
> # bsdlabel -w /dev/md0
> # bsdlabel -e /dev/md0 (create "a" slice to use all free respective
first 16
> blocks)
> # newfs -O2 -U /dev/md0a
> mount /dev/md0a /mnt
> # cd to_a_place/with/650MB_of_data/
> # tar -cf - |( cd /mnt/; tar -xf -)
> after ~256MB transferred i get following errors, and the system crashes
> horridble  first it doesnt react of anything, then it does silently
> reboot
> without a shutdown...leaves all unclean
>
> extract from all.log
> Mar 22 22:08:14 flying-dutchman kernel:
> g_vfs_done():md0a[WRITE(offset=686899200
> , length=131072)]error = 28
> Mar 22 22:08:14 flying-dutchman kernel:
> g_vfs_done():md0a[WRITE(offset=687030272
> , length=131072)]error = 28
> Mar 22 22:08:14 flying-dutchman kernel:
> g_vfs_done():md0a[WRITE(offset=687161344
> , length=131072)]error = 28
> Mar 22 22:08:14 flying-dutchman kernel:
> g_vfs_done():md0a[WRITE(offset=687292416
> , length=131072)]error = 28
>
>
> Any impressions, suggestions or limitations for md with malloc?
> This errors occures also if i request to reserve the space by
creation
>
> thanks
>
> regards
>
> michael
>
> --
> === michael-schuh.net ===
> Michael Schuh
> Preußenstr. 13
> 66111 Saarbrücken
> phone: 0681/8319664
> mobil:   0177/9738644
> @: [EMAIL PROTECTED]

Old, old joke:
Patient: Doctor! It hurts when I do this!
Doctor: Don't do that.

This is a well known issue with malloc backed md disks. Use swap backed
ones. They will be the default in V7. They have all of the advantages of
malloc backed mds without the possibility of eating all available memory
and crashing the system.

malloc backed md disks are very dangerous and should only be used in
special circumstances and with great care.
--
R. Kevin Oberman, Network Engineer
Energy Sciences Network (ESnet)
Ernest O. Lawrence Berkeley National Laboratory (Berkeley Lab)
E-mail: [EMAIL PROTECTED]  Phone: +1 510 486-8634
Key fingerprint:059B 2DDF 031C 9BA3 14A4  EADA 927D EBB3 987B 3751





--
=== michael-schuh.net ===
Michael Schuh
Preußenstr. 13
66111 Saarbrücken
phone: 0681/8319664
mobil:   0177/9738644
@: [EMAIL PROTECTED]

=== Ust-ID: DE251072318 ===
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: another error with md malloc based fs

2007-03-22 Thread Kevin Oberman
> Date: Thu, 22 Mar 2007 23:04:16 +0100
> From: "Michael Schuh" <[EMAIL PROTECTED]>
> Sender: [EMAIL PROTECTED]
> 
> Hi,
> first i have 2GB of RAM, there are be 1,6G free
> so it should enough toi make the following:
> 
> # mdconfig -a -t mallo -s 750m -u 0
> # bsdlabel -w /dev/md0
> # bsdlabel -e /dev/md0 (create "a" slice to use all free respective first 16
> blocks)
> # newfs -O2 -U /dev/md0a
> mount /dev/md0a /mnt
> # cd to_a_place/with/650MB_of_data/
> # tar -cf - |( cd /mnt/; tar -xf -)
> after ~256MB transferred i get following errors, and the system crashes
> horridble  first it doesnt react of anything, then it does silently
> reboot
> without a shutdown...leaves all unclean
> 
> extract from all.log
> Mar 22 22:08:14 flying-dutchman kernel:
> g_vfs_done():md0a[WRITE(offset=686899200
> , length=131072)]error = 28
> Mar 22 22:08:14 flying-dutchman kernel:
> g_vfs_done():md0a[WRITE(offset=687030272
> , length=131072)]error = 28
> Mar 22 22:08:14 flying-dutchman kernel:
> g_vfs_done():md0a[WRITE(offset=687161344
> , length=131072)]error = 28
> Mar 22 22:08:14 flying-dutchman kernel:
> g_vfs_done():md0a[WRITE(offset=687292416
> , length=131072)]error = 28
> 
> 
> Any impressions, suggestions or limitations for md with malloc?
> This errors occures also if i request to reserve the space by creation
> 
> thanks
> 
> regards
> 
> michael
> 
> -- 
> === michael-schuh.net ===
> Michael Schuh
> Preußenstr. 13
> 66111 Saarbrücken
> phone: 0681/8319664
> mobil:   0177/9738644
> @: [EMAIL PROTECTED]

Old, old joke:
Patient: Doctor! It hurts when I do this!
Doctor: Don't do that.

This is a well known issue with malloc backed md disks. Use swap backed
ones. They will be the default in V7. They have all of the advantages of
malloc backed mds without the possibility of eating all available memory
and crashing the system.

malloc backed md disks are very dangerous and should only be used in
special circumstances and with great care.
-- 
R. Kevin Oberman, Network Engineer
Energy Sciences Network (ESnet)
Ernest O. Lawrence Berkeley National Laboratory (Berkeley Lab)
E-mail: [EMAIL PROTECTED]   Phone: +1 510 486-8634
Key fingerprint:059B 2DDF 031C 9BA3 14A4  EADA 927D EBB3 987B 3751


pgpAVKp241epy.pgp
Description: PGP signature