managing linked, cow, and shared tables
Posted: Mon Jul 06, 2009 8:09 pm
I have a scheme for the mm to manage how it keeps track of linked, shared, and cow page tables, and I want to see your opinion on it.
In memory, we keep two lists, one for pages that are referenced, meaning being linked to, shared with, or cow. This is to make sure that if we free that directory, but other directories still need those pages, then we can keep those tables around until they arnt needed.
We also have another list, this one of pages that reference other pages, and how they reference them. So if a table is linked to another table, its type is linked, its address is stored, and the address of the page is references is stored.
When cloning directores, we first search to see if the table we are copying is in the first type of list, and if so, increment the appropriate reference counter, but if not, we add it. Then we add the new table to the second list, and set it up as appropriate.
This system plans to solve the problem of freeing tables that other directories might be linked to, or marked as cow from. If a directory is freed, but some of its tables are in the first type of list, those tables are left alone, but marked as able to free. If a table is freed that references another table, it makes sure to decrement the counter, so it can be freed when the time comes.
What do you guys think? Its a little inefficient, because you have to traverse two lists every time you free a directory, but it does solve a lot of problems and I cant see an easier way to do it.
In memory, we keep two lists, one for pages that are referenced, meaning being linked to, shared with, or cow. This is to make sure that if we free that directory, but other directories still need those pages, then we can keep those tables around until they arnt needed.
We also have another list, this one of pages that reference other pages, and how they reference them. So if a table is linked to another table, its type is linked, its address is stored, and the address of the page is references is stored.
When cloning directores, we first search to see if the table we are copying is in the first type of list, and if so, increment the appropriate reference counter, but if not, we add it. Then we add the new table to the second list, and set it up as appropriate.
This system plans to solve the problem of freeing tables that other directories might be linked to, or marked as cow from. If a directory is freed, but some of its tables are in the first type of list, those tables are left alone, but marked as able to free. If a table is freed that references another table, it makes sure to decrement the counter, so it can be freed when the time comes.
What do you guys think? Its a little inefficient, because you have to traverse two lists every time you free a directory, but it does solve a lot of problems and I cant see an easier way to do it.