From 78c04c770ebc968dcdd6188f3b229aa4165c1284 Mon Sep 17 00:00:00 2001 From: "Neal H. Walfield" Date: Tue, 11 Nov 2008 11:18:10 +0100 Subject: Profile the anonymous pager's fault handler. 2008-11-11 Neal H. Walfield * anonymous.c: Include . (fault): Profile. --- libhurd-mm/ChangeLog | 5 +++++ libhurd-mm/anonymous.c | 23 ++++++++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) (limited to 'libhurd-mm') 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 + + * anonymous.c: Include . + (fault): Profile. + 2008-11-06 Neal H. Walfield * 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 +#include + #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; -- cgit v1.2.3