diff options
author | Peng Zhang <zhangpeng.00@bytedance.com> | 2023-01-29 12:00:34 +0300 |
---|---|---|
committer | Mike Rapoport (IBM) <rppt@kernel.org> | 2023-01-31 16:51:56 +0300 |
commit | 2fe03412e2e1be3d5ab37b8351a37c3aec506556 (patch) | |
tree | 62276218dce64352cc252c0929e74723d341fb42 /mm/fadvise.c | |
parent | ad500fb2d11b3739dcbc17a31976828b9161ecf5 (diff) | |
download | linux-2fe03412e2e1be3d5ab37b8351a37c3aec506556.tar.xz |
memblock: Avoid useless checks in memblock_merge_regions().
memblock_merge_regions() is called after regions have been modified to
merge the neighboring compatible regions. That will check all regions
but most checks are useless.
Most of the time we only insert one or a few new regions, or modify one or
a few regions. At this time, we don't need to check all the regions. We
only need to check the changed regions, because other not related regions
cannot be merged.
Add two parameters to memblock_merge_regions() to indicate the lower and
upper boundary to scan.
Debug code that counts the number of total iterations in
memblock_merge_regions(), like for instance
void memblock_merge_regions(struct memblock_type *type)
{
static int iteration_count = 0;
static int max_nr_regions = 0;
max_nr_regions = max(max_nr_regions, (int)type->cnt);
...
while () {
iteration_count++;
...
}
pr_info("iteration_count: %d max_nr_regions %d", iteration_count,
max_nr_regions);
}
Produces the following numbers on a physical machine with 1T of memory:
before: [2.472243] iteration_count: 45410 max_nr_regions 178
after: [2.470869] iteration_count: 923 max_nr_regions 176
The actual startup speed seems to change little, but it does reduce the
scan overhead.
Signed-off-by: Peng Zhang <zhangpeng.00@bytedance.com>
Link: https://lore.kernel.org/r/20230129090034.12310-3-zhangpeng.00@bytedance.com
[rppt: massaged the changelog]
Signed-off-by: Mike Rapoport (IBM) <rppt@kernel.org>
Diffstat (limited to 'mm/fadvise.c')
0 files changed, 0 insertions, 0 deletions