[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] x86/shadow: remove pointless loops over all vCPU-s
commit b8c7758ce299d95e6791232809654a98472974a4 Author: Jan Beulich <jbeulich@xxxxxxxx> AuthorDate: Wed Dec 20 10:04:48 2017 +0100 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Wed Dec 20 10:04:48 2017 +0100 x86/shadow: remove pointless loops over all vCPU-s The vCPU count can be had more directly. Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> Acked-by: Tim Deegan <tim@xxxxxxx> --- xen/arch/x86/mm/shadow/common.c | 8 +------- xen/arch/x86/mm/shadow/multi.c | 8 +++----- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c index 3a33e0b..600df0c 100644 --- a/xen/arch/x86/mm/shadow/common.c +++ b/xen/arch/x86/mm/shadow/common.c @@ -1143,13 +1143,7 @@ const u8 sh_type_to_size[] = { * worth to make sure we never return zero. */ static unsigned int shadow_min_acceptable_pages(struct domain *d) { - u32 vcpu_count = 1; - struct vcpu *v; - - for_each_vcpu(d, v) - vcpu_count++; - - return (vcpu_count * 128); + return (d->max_vcpus + 1) * 128; } /* Dispatcher function: call the per-mode function that will unhook the diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c index 4408575..f7182e4 100644 --- a/xen/arch/x86/mm/shadow/multi.c +++ b/xen/arch/x86/mm/shadow/multi.c @@ -1476,16 +1476,14 @@ sh_make_shadow(struct vcpu *v, mfn_t gmfn, u32 shadow_type) * pinning l3es. This is not very quick but it doesn't happen * very often. */ struct page_info *sp, *t; - struct vcpu *v2; - int l4count = 0, vcpus = 0; + unsigned int l4count = 0; + page_list_for_each(sp, &d->arch.paging.shadow.pinned_shadows) { if ( sp->u.sh.type == SH_type_l4_64_shadow ) l4count++; } - for_each_vcpu ( d, v2 ) - vcpus++; - if ( l4count > 2 * vcpus ) + if ( l4count > 2 * d->max_vcpus ) { /* Unpin all the pinned l3 tables, and don't pin any more. */ page_list_for_each_safe(sp, t, &d->arch.paging.shadow.pinned_shadows) -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |