lkml.org 
[lkml]   [2024]   [Mar]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/2] x86/boot/e820: not necessary to iterate whole overlap_list
Date
We are sure there is only one entry to be removed from overlap_list.

Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
---
arch/x86/kernel/e820.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c
index 6f1b379e3b38..ecbeb76ed08f 100644
--- a/arch/x86/kernel/e820.c
+++ b/arch/x86/kernel/e820.c
@@ -377,10 +377,11 @@ int __init e820__update_table(struct e820_table *table)
} else {
/* Remove entry from list (order independent, so swap with last): */
for (i = 0; i < overlap_entries; i++) {
- if (overlap_list[i] == change_point[chg_idx]->entry)
- overlap_list[i] = overlap_list[overlap_entries-1];
+ if (overlap_list[i] == change_point[chg_idx]->entry) {
+ overlap_list[i] = overlap_list[--overlap_entries];
+ break;
+ }
}
- overlap_entries--;
}
/*
* If there are overlapping entries, decide which
--
2.34.1

\
 
 \ /
  Last update: 2024-05-27 16:13    [W:0.023 / U:1.704 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site