Re: Swap support

Riley Williams
2002-04-22T18:18:20Z

Hi Harry.

>>> Yesterday I commited to the CVS some experimental swap support code,
>>> based on Alan's work on the subject. Of course this code is not
>>> included in the default configuration and is not for _actual_ use,
>>> since as I said is experimental. Apart from that if you set the swap
>>> partition in malloc.c you and enable swapping you can enjoy an 8086
>>> system use _virtual_ memory!

>> Great!
>>
>> I've been looking for it in the code, and found nothing about it's
>> configuration (setting the partition and the size, activating
>> it...)... can someone (Harry, Alan) give us a few words about how to
>> do so?

> I will focus on making it easily configurable at run time later
> along with documenting it a bit. Basicaly the code now is a 4 hour
> brain storm. To configure it you basicaly change this part of the
> code :

> holep = &swap_holes[0];
> holep->flags = HOLE_FREE;
> holep->page_base = 0;
> holep->extent = 128;
> holep->refcount = 0;
> holep->next = NULL;
>
> swap_dev = 0x0100;

> The extent is the size in kilobytes and the swap_dev is the block
> device to swap to. In the example 0x0100 is /dev/ram0 for example.

Would you mind if I tweaked the config system to allow this to be
configured therein, making the entire configuration dependent on the
CONFIG_EXPERIMENTAL config variable?

Also, does it use any particular format for the swap partition? I'm
presuming from the above that it operates at partition level rather
than at device level, so doesn't require a separate hard drive for
swap usage.

>> And by the way... can you write a technical description about how
>> it is done?

> It's on my TODO list...

I'll have a look as well, and see what I can come up with once I've
finished ANSI'fying the source tree.

>> The main problem with swap in minix was (is) that processes waiting
>> for IO (waiting for a message from FS) can not be swapped in,
>> because they would meet a deadlock when trying to swap out (for FS
>> is needed again to do the swapping out, but it is frozen sending the
>> message to the process, because FS is not reentrant/concurrent in
>> minix)... and obviously processes waiting for IO are those best
>> suited to be swapped in.

> As you might already noticed we don't use the FS layer, we only
> support swapping to a device at the moment. Once the thing works
> we can add swapping to file easily.

That's the best way to do it, IMHO.

> For the minix matter now - our FS is reentrant so we will have no
> problem...

That's one less thing to worry about.

Best wishes from Riley.