diff options
author | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2012-03-30 14:16:49 -0400 |
---|---|---|
committer | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2012-04-06 17:03:04 -0400 |
commit | d5096850b47424fb0f1c6a75b8f7184f7169319a (patch) | |
tree | ec0106474b6a59a5c2e0e63957d0d2f319d4dd69 /arch/x86/xen/p2m.c | |
parent | cef4cca551d652b7f69c9d76337c5fae24e069dc (diff) |
xen/p2m: Collapse early_alloc_p2m_middle redundant checks.
At the start of the function we were checking for idx != 0
and bailing out. And later calling extend_brk if idx != 0.
That is unnecessary so remove that checks.
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Diffstat (limited to 'arch/x86/xen/p2m.c')
-rw-r--r-- | arch/x86/xen/p2m.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c index 8b3a3958d120..952edefcedb3 100644 --- a/arch/x86/xen/p2m.c +++ b/arch/x86/xen/p2m.c | |||
@@ -502,6 +502,8 @@ static bool alloc_p2m(unsigned long pfn) | |||
502 | static bool __init early_alloc_p2m_middle(unsigned long pfn, bool check_boundary) | 502 | static bool __init early_alloc_p2m_middle(unsigned long pfn, bool check_boundary) |
503 | { | 503 | { |
504 | unsigned topidx, mididx, idx; | 504 | unsigned topidx, mididx, idx; |
505 | unsigned long *p2m; | ||
506 | unsigned long *mid_mfn_p; | ||
505 | 507 | ||
506 | topidx = p2m_top_index(pfn); | 508 | topidx = p2m_top_index(pfn); |
507 | mididx = p2m_mid_index(pfn); | 509 | mididx = p2m_mid_index(pfn); |
@@ -522,24 +524,21 @@ static bool __init early_alloc_p2m_middle(unsigned long pfn, bool check_boundary | |||
522 | return false; | 524 | return false; |
523 | 525 | ||
524 | /* Boundary cross-over for the edges: */ | 526 | /* Boundary cross-over for the edges: */ |
525 | if (idx) { | 527 | p2m = extend_brk(PAGE_SIZE, PAGE_SIZE); |
526 | unsigned long *p2m = extend_brk(PAGE_SIZE, PAGE_SIZE); | ||
527 | unsigned long *mid_mfn_p; | ||
528 | 528 | ||
529 | p2m_init(p2m); | 529 | p2m_init(p2m); |
530 | 530 | ||
531 | p2m_top[topidx][mididx] = p2m; | 531 | p2m_top[topidx][mididx] = p2m; |
532 | 532 | ||
533 | /* For save/restore we need to MFN of the P2M saved */ | 533 | /* For save/restore we need to MFN of the P2M saved */ |
534 | 534 | ||
535 | mid_mfn_p = p2m_top_mfn_p[topidx]; | 535 | mid_mfn_p = p2m_top_mfn_p[topidx]; |
536 | WARN(mid_mfn_p[mididx] != virt_to_mfn(p2m_missing), | 536 | WARN(mid_mfn_p[mididx] != virt_to_mfn(p2m_missing), |
537 | "P2M_TOP_P[%d][%d] != MFN of p2m_missing!\n", | 537 | "P2M_TOP_P[%d][%d] != MFN of p2m_missing!\n", |
538 | topidx, mididx); | 538 | topidx, mididx); |
539 | mid_mfn_p[mididx] = virt_to_mfn(p2m); | 539 | mid_mfn_p[mididx] = virt_to_mfn(p2m); |
540 | 540 | ||
541 | } | 541 | return true; |
542 | return idx != 0; | ||
543 | } | 542 | } |
544 | 543 | ||
545 | static bool __init early_alloc_p2m(unsigned long pfn) | 544 | static bool __init early_alloc_p2m(unsigned long pfn) |