Workaround added for duplicate page faults from cloned threads.

It is possible that in a mult-threaded address space write-faults
(or faults in general) on the same address can occur. This is because
threads may become runnable during the handling of the first fault.

This causes duplicate faults on the same private page in the same address space.
On the case of write faulted private page, this causes a spurious page allocation
Currently this case is detected and handled, but in the future we need
a generic way of detecting duplicate faults (of any kind) and cease duplicate
IPC at a very early stage. This is not done yet as it requires knowledge of the
PTEs of physical pages in the pager (like reverse mapping in Linux).
This commit is contained in:
Bahadir Balban
2009-05-01 14:44:41 +03:00
parent cada0f8f18
commit b1b3b59561

View File

@@ -550,11 +550,23 @@ struct page *copy_on_write(struct fault_data *fault)
global_add_vm_object(shadow);
} else {
/* We ought to copy the missing RW page to top shadow */
dprintf("No new shadows. Going to add to "
"topmost r/w shadow object\n");
/* No new shadows, the topmost r/w vmo is the copier object */
shadow_link = vmo_link;
/*
* FIXME: Here we check for the case that a cloned thread is
* doing a duplicate write request on an existing RW shadow
* page. If so, we return the existing writable page in the top
* shadow. We should find a generic way to detect duplicate
* requests and cease IPC at an earlier stage.
*/
page = shadow_link->obj->pager->ops.page_in(shadow_link->obj,
file_offset);
if (!IS_ERR(page))
return page;
/*
* We start page search on read-only objects. If the first
* one was writable, go to next which must be read-only.