summaryrefslogtreecommitdiff
path: root/viengoos/object.h
diff options
context:
space:
mode:
authorneal <neal>2008-02-16 14:15:36 +0000
committerneal <neal>2008-02-16 14:15:36 +0000
commitb15d17d7d9b95e3e5ba2a800fea8bb81bcf43777 (patch)
tree779e89a7db7ecaf8abbb6194ccd10acf39a3d818 /viengoos/object.h
parente36e1d5f65c6bbd89a8b7d42ba8f5765f77b551a (diff)
2008-02-16 Neal H. Walfield <neal@gnu.org>
* object.h (struct object_desc): Add fields mapped, shared and floating. (object_desc_unmap): Only unmap a page if DESC->MAPPED is true. (object_desc_flush): Call object_desc_unmap rather than copying the code. * object.c (object_find_soft): If ODESC->FLOATING is true, claim the object. Set ODESC->FLOATING to false. (folio_object_alloc): After clearing the page, flush it and then ODESC->DIRTY to false. Set ODESC->SHARED to false. * ager.c (SAMPLES): Rename from this... (FREQ): ... to this. Update users. (ager_loop): Don't just flush the whole address space; every FREQ iterations, unmap shared objects, set DESC->MAPPED to false, and DESC->FLOATING to true. * server.c (server_loop): When mapping a page, record it.
Diffstat (limited to 'viengoos/object.h')
-rw-r--r--viengoos/object.h52
1 files changed, 33 insertions, 19 deletions
diff --git a/viengoos/object.h b/viengoos/object.h
index fdd711c..6a3713e 100644
--- a/viengoos/object.h
+++ b/viengoos/object.h
@@ -123,14 +123,22 @@ struct object_desc
{
/* The version and OID of the object. */
oid_t oid;
- l4_word_t version : CAP_VERSION_BITS;
- l4_word_t type : CAP_TYPE_BITS;
+ uintptr_t version : CAP_VERSION_BITS;
+ uintptr_t type : CAP_TYPE_BITS;
/* Whether the page is dirty. */
- l4_word_t dirty: 1;
+ uintptr_t dirty: 1;
/* Whether the object has been selected for eviction. */
- l4_word_t eviction_candidate : 1;
+ uintptr_t eviction_candidate : 1;
+
+ /* Whether the object has been mapped to a process. */
+ uintptr_t mapped : 1;
+ /* Whether the object has been used by multiple activities. */
+ uintptr_t shared : 1;
+ /* The object is shared. The next one to access the object should
+ claim it. */
+ uintptr_t floating : 1;
/* Whether the object is live. */
bool live;
@@ -311,14 +319,22 @@ object_type (struct object *object)
static inline void
object_desc_unmap (struct object_desc *desc)
{
+ assert (desc->live);
+
+ if (desc->mapped)
+ {
#ifndef _L4_TEST_ENVIRONMENT
- struct object *object = object_desc_to_object (desc);
+ struct object *object = object_desc_to_object (desc);
- l4_fpage_t flush = l4_fpage ((l4_word_t) object, PAGESIZE);
- l4_fpage_t unmap = l4_fpage_add_rights (flush, L4_FPAGE_FULLY_ACCESSIBLE);
+ l4_fpage_t flush = l4_fpage ((l4_word_t) object, PAGESIZE);
+ l4_fpage_t unmap = l4_fpage_add_rights (flush,
+ L4_FPAGE_FULLY_ACCESSIBLE);
- desc->dirty |= !!l4_was_written (l4_unmap_fpage (unmap));
+ desc->dirty |= !!l4_was_written (l4_unmap_fpage (unmap));
#endif
+
+ desc->mapped = false;
+ }
}
/* Unmaps the object corresponding to DESC from all clients and also
@@ -326,20 +342,18 @@ object_desc_unmap (struct object_desc *desc)
static inline void
object_desc_flush (struct object_desc *desc)
{
-#ifndef _L4_TEST_ENVIRONMENT
- assert (desc->live);
-
- struct object *object = object_desc_to_object (desc);
-
- l4_fpage_t flush = l4_fpage ((l4_word_t) object, PAGESIZE);
- l4_fpage_t unmap = l4_fpage_add_rights (flush, L4_FPAGE_FULLY_ACCESSIBLE);
-
- desc->dirty |= !!l4_was_written (l4_unmap_fpage (unmap));
+ object_desc_unmap (desc);
if (! desc->dirty)
- /* We may have dirty it. */
- desc->dirty |= !!l4_was_written (l4_flush (flush));
+ /* We only need to see if we dirtied it. */
+ {
+#ifndef _L4_TEST_ENVIRONMENT
+ struct object *object = object_desc_to_object (desc);
+ l4_fpage_t flush = l4_fpage ((l4_word_t) object, PAGESIZE);
+
+ desc->dirty |= !!l4_was_written (l4_flush (flush));
#endif
+ }
}
/* Transfer ownership of DESC to the activity ACTIVITY. If ACTIVITY