Skip to content

Commit

Permalink
Merge tag 'memblock-v5.15-rc1' of git://git.kernel.org/pub/scm/linux/…
Browse files Browse the repository at this point in the history
…kernel/git/rppt/memblock

Pull memblock updates from Mike Rapoport:
 "Robustness and debug improvements:

   - add check for memory add/cap ordering

   - add missing debug code to memblock_add_node()"

* tag 'memblock-v5.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rppt/memblock:
  memblock: Check memory add/cap ordering
  memblock: Add missing debug code to memblock_add_node()
  • Loading branch information
Linus Torvalds committed Sep 2, 2021
2 parents 4a3bb42 + e888fa7 commit 612b23f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions mm/memblock.c
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,11 @@ static int __init_memblock memblock_add_range(struct memblock_type *type,
int __init_memblock memblock_add_node(phys_addr_t base, phys_addr_t size,
int nid)
{
phys_addr_t end = base + size - 1;

memblock_dbg("%s: [%pa-%pa] nid=%d %pS\n", __func__,
&base, &end, nid, (void *)_RET_IP_);

return memblock_add_range(&memblock.memory, base, size, nid, 0);
}

Expand Down Expand Up @@ -1680,6 +1685,11 @@ void __init memblock_cap_memory_range(phys_addr_t base, phys_addr_t size)
if (!size)
return;

if (memblock.memory.cnt <= 1) {
pr_warn("%s: No memory registered yet\n", __func__);
return;
}

ret = memblock_isolate_range(&memblock.memory, base, size,
&start_rgn, &end_rgn);
if (ret)
Expand Down

0 comments on commit 612b23f

Please sign in to comment.