[patch 06/24] lmb: add lmb_alloc_nid()
Paul Mackerras
paulus at samba.org
Tue Apr 1 15:15:46 EST 2008
akpm at linux-foundation.org writes:
> From: David Miller <davem at davemloft.net>
>
> A variant of lmb_alloc() that tries to allocate memory on a specified NUMA
> node 'nid' but falls back to normal lmb_alloc() if that fails.
...
> +static u64 __init lmb_alloc_nid_unreserved(u64 start, u64 end,
> + u64 size, u64 align)
> +{
> + u64 base;
> + long j;
> +
> + base = lmb_align_down((end - size), align);
> + while (start <= base &&
> + ((j = lmb_overlaps_region(&lmb.reserved, base, size)) >= 0))
> + base = lmb_align_down(lmb.reserved.region[j].base - size,
> + align);
How do we know that lmb.reserved.region[j].base is >= size at this
point? If it isn't, then base could end up as some extremely large
unsigned value, which would be a Bad Thing.
Paul.
More information about the Linuxppc-dev
mailing list