[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [f-cpu] TLB design




----- Original Message -----
From: "Cedric BAIL" <cedric.bail@free.fr>
To: <f-cpu@seul.org>
Sent: Sunday, July 14, 2002 11:14 PM
Subject: Re: [f-cpu] TLB design


> > Present bit is absolutely necessary for HW tlb, it is to say that entry
> > is not a valid mapping and help us to raise an exception to fix it.
>
> For my point of view you valid page or not, normally you only have entry
> in the TLB that are corresponding to memory. So what is the difference
> between this two bits ?

Ok, it seems we don't have the same notion :
- HW TLB, like in IA32 (Intel,AMD) : we never access or change directly a
TLB entry, we just set an array of entries (valid or not) and let TLB to get
managed with
- SW TLB : if we access a page not in TLB, we are responsive to change TLB
so we can access this page.

As I already told it to you, i'm not sure that a valid bit is necessary for
SW TLB.

> > We use it to implement virtual memory swapping from/to mass storage.
>
> Ok, but that's not a clean method. The VM detect that's you need to swap,
> so she select a page to swap and remove them from the virtual address
space.
> Then they are transfered to the disk. When the task wake up, and access
> to this page you make a TLB miss, and you start to remove some other from
> the virtual address space to the disk and then you put the other to the
new
> free space and set entry in the TLB.

In HW TLB we usually use the invalid entry to store info about where the
page is stored in mass storage, so the exception can retrieve quickly some
info. Much more helpful than you think. I used to leave the invalid physical
address so i can transform it to an index and examine the associated info to
check if is active or inactive (that is content is in fact swapped on
external storage)...

> For me, you don't have enough entry into the TLB to say that some of them
> are mapped to disk, and on rescent computer the swap are not so much use
> (database program prefer to have their own save polici).

It is why i'm unsure about the necessity for this bit with a SW TLB.

> > > > - dirty bit (indicating that the page has been written to)
> > > Same question.
> >
> > This page was modified by someone so we could need to synchronise with
> > external storage, it is absolutely necessary for virtual memory and
> > file mapping.
>
> You mean Copy On Write technique ?

No, for COW, we just need to fix it as read-only. When writing on a
read-only page, we apply a COW if we know this page allows it.

When you mapped a file on memory and you modify this memory and you declared
the mapping so that any change of memory must be replicated in file, well
you could use this bit to tell us if you must update this page in file
before discarding this TLB entry for another one. Without this bit you are
unable to know if this page was modified and so to update the file. Your
mmap (unix) would be very unefficient because it would be forced to rewrite
all the memory in the file since it would be unable to know which pages have
been modified.

I think that kind of bit is not as expensive to have it.


*************************************************************
To unsubscribe, send an e-mail to majordomo@seul.org with
unsubscribe f-cpu       in the body. http://f-cpu.seul.org/