diff options
author | kfraser@localhost.localdomain <kfraser@localhost.localdomain> | 2006-09-20 17:58:10 +0100 |
---|---|---|
committer | kfraser@localhost.localdomain <kfraser@localhost.localdomain> | 2006-09-20 17:58:10 +0100 |
commit | 5c5f228d466095f2dcdd36c0be7600be7e62aa78 (patch) | |
tree | 272194cdc3d4d334b3313da98dcf9d35a86ca127 /xen/include/asm-x86/shadow.h | |
parent | 0c750561355f136f9991c72560c3e4edc1be956a (diff) | |
download | xen-5c5f228d466095f2dcdd36c0be7600be7e62aa78.tar.gz xen-5c5f228d466095f2dcdd36c0be7600be7e62aa78.tar.bz2 xen-5c5f228d466095f2dcdd36c0be7600be7e62aa78.zip |
[XEN] Clean up mark_dirty() usage in mm.c some more.
Add clarifying comments. Move mark_dirty() in alloc_page_type()
to end of the function (more correct).
Signed-off-by: Keir Fraser <keir@xensource.com>
Diffstat (limited to 'xen/include/asm-x86/shadow.h')
-rw-r--r-- | xen/include/asm-x86/shadow.h | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/xen/include/asm-x86/shadow.h b/xen/include/asm-x86/shadow.h index f15559ba0a..b7c536477a 100644 --- a/xen/include/asm-x86/shadow.h +++ b/xen/include/asm-x86/shadow.h @@ -325,12 +325,17 @@ void shadow_final_teardown(struct domain *d); void sh_do_mark_dirty(struct domain *d, mfn_t gmfn); static inline void mark_dirty(struct domain *d, unsigned long gmfn) { - if ( shadow_mode_log_dirty(d) ) - { + int caller_locked; + + if ( unlikely(d == NULL) || likely(!shadow_mode_log_dirty(d)) ) + return; + + caller_locked = shadow_lock_is_acquired(d); + if ( !caller_locked ) shadow_lock(d); - sh_do_mark_dirty(d, _mfn(gmfn)); + sh_do_mark_dirty(d, _mfn(gmfn)); + if ( !caller_locked ) shadow_unlock(d); - } } /* Internal version, for when the shadow lock is already held */ |