summaryrefslogtreecommitdiff
path: root/libhurd-mm
diff options
context:
space:
mode:
authorNeal H. Walfield <neal@gnu.org>2008-11-11 11:18:10 +0100
committerNeal H. Walfield <neal@gnu.org>2008-11-11 11:18:10 +0100
commit78c04c770ebc968dcdd6188f3b229aa4165c1284 (patch)
tree3ae46fb8965774ea6b88edf3bdf722d2aecd3af2 /libhurd-mm
parent3b8e2223afaacdee097c4eaf216c44dfcd54f655 (diff)
Profile the anonymous pager's fault handler.
2008-11-11 Neal H. Walfield <neal@gnu.org> * anonymous.c: Include <profile.h>. (fault): Profile.
Diffstat (limited to 'libhurd-mm')
-rw-r--r--libhurd-mm/ChangeLog5
-rw-r--r--libhurd-mm/anonymous.c23
2 files changed, 27 insertions, 1 deletions
diff --git a/libhurd-mm/ChangeLog b/libhurd-mm/ChangeLog
index de72215..5dffdea 100644
--- a/libhurd-mm/ChangeLog
+++ b/libhurd-mm/ChangeLog
@@ -1,3 +1,8 @@
+2008-11-11 Neal H. Walfield <neal@gnu.org>
+
+ * anonymous.c: Include <profile.h>.
+ (fault): Profile.
+
2008-11-06 Neal H. Walfield <neal@gnu.org>
* anonymous.c (fault): Handle the case where COUNT > 0. Don't
diff --git a/libhurd-mm/anonymous.c b/libhurd-mm/anonymous.c
index bbd33ff..2185613 100644
--- a/libhurd-mm/anonymous.c
+++ b/libhurd-mm/anonymous.c
@@ -30,6 +30,8 @@
#include <hurd/rm.h>
+#include <profile.h>
+
#include "anonymous.h"
#include "pager.h"
#include "storage.h"
@@ -133,12 +135,15 @@ fault (struct pager *pager, uintptr_t offset, int count, bool read_only,
uintptr_t fault_addr, uintptr_t ip, struct exception_info info)
{
struct anonymous_pager *anon = (struct anonymous_pager *) pager;
+ bool r;
debug (5, "Fault at " ADDR_FMT " + %x",
ADDR_PRINTF (anon->map_area), fault_addr);
ss_mutex_lock (&anon->lock);
+ profile_region ("anonymous_fault");
+
/* Determine if we have been invoked recursively. This can only
happen if there is a fill function as we do not access a pager's
pages. */
@@ -194,7 +199,9 @@ fault (struct pager *pager, uintptr_t offset, int count, bool read_only,
uintptr_t o = offset + i * PAGESIZE;
struct storage_desc *storage_desc;
+ profile_region ("anonymous_fault(storage_desc_lookup)");
storage_desc = hurd_btree_storage_desc_find (storage_descs, &o);
+ profile_region_end ();
if (storage_desc && info.discarded)
{
@@ -206,9 +213,11 @@ fault (struct pager *pager, uintptr_t offset, int count, bool read_only,
assert (anon->policy.discardable);
error_t err;
+ profile_region ("anonymous_fault(discarded_clear)");
err = rm_object_discarded_clear (ADDR_VOID,
storage_desc->storage);
assertx (err == 0, "%d", err);
+ profile_region_end ();
debug (5, "Clearing discarded bit for %p / " ADDR_FMT,
(void *) fault_addr + i * PAGESIZE,
@@ -222,6 +231,8 @@ fault (struct pager *pager, uintptr_t offset, int count, bool read_only,
storage_desc = storage_desc_alloc ();
storage_desc->offset = o;
+ profile_region ("anonymous_fault(storage alloc)");
+
struct storage storage
= storage_alloc (anon->activity,
cap_page, STORAGE_UNKNOWN, anon->policy,
@@ -230,6 +241,8 @@ fault (struct pager *pager, uintptr_t offset, int count, bool read_only,
panic ("Out of memory.");
storage_desc->storage = storage.addr;
+ profile_region_end ();
+
struct storage_desc *conflict;
conflict = hurd_btree_storage_desc_insert (storage_descs,
storage_desc);
@@ -246,6 +259,8 @@ fault (struct pager *pager, uintptr_t offset, int count, bool read_only,
ADDR_PRINTF (storage_desc->storage),
(void *) fault_addr + i * PAGESIZE);
+ profile_region ("anonymous_fault(install)");
+
/* We generate a fake shadow cap for the storage as we know
its contents (It is a page that is in a folio with the
policy ANON->POLICY.) */
@@ -267,6 +282,8 @@ fault (struct pager *pager, uintptr_t offset, int count, bool read_only,
CAP_PROPERTIES_VOID);
assert (ret);
}));
+
+ profile_region_end ();
}
if (! recursive || ! (anon->flags & ANONYMOUS_NO_RECURSIVE))
@@ -275,7 +292,7 @@ fault (struct pager *pager, uintptr_t offset, int count, bool read_only,
}
}
- bool r = true;
+ r = true;
if (anon->fill)
{
@@ -289,7 +306,9 @@ fault (struct pager *pager, uintptr_t offset, int count, bool read_only,
pages[i] = (void *) fault_addr + i * PAGESIZE;
}
+ profile_region ("anonymous_fault(user fill)");
r = anon->fill (anon, offset, count, pages, info);
+ profile_region_end ();
}
if (! recursive)
@@ -311,6 +330,8 @@ fault (struct pager *pager, uintptr_t offset, int count, bool read_only,
ss_mutex_unlock (&anon->lock);
+ profile_region_end ();
+
debug (5, "Fault at %x resolved", fault_addr);
return r;