Subject: Re: [PATCH v2 1/5] powerpc/64s/hash: Fix 128TB-512TB virtual address boundary case allocation

From: Nicholas Piggin <[email-masked]>
Date: Mon, 13 Nov 2017 18:36:01 +1100

On Mon, 13 Nov 2017 10:29:19 +0530
"Aneesh Kumar K.V" <[email-masked]> wrote:

> Nicholas Piggin <[email-masked]> writes:
> 
> > When allocating VA space with a hint that crosses 128TB, the SLB addr_limit
> > variable is not expanded if addr is not > 128TB, but the slice allocation
> > looks at task_size, which is 512TB. This results in slice_check_fit()
> > incorrectly succeeding because the slice_count truncates off bit 128 of the
> > requested mask, so the comparison to the available mask succeeds.
> >
> > Fix this by using mm->context.addr_limit instead of mm->task_size for
> > testing allocation limits. This causes such allocations to fail.
> >  
> 
> Also note that this change the rule from > 128TB to >-128TB to select
> the larger address space. I guess that is correct because without '>=' we
> won't be able to allocate anything starting from 128TB (except MAP_FIXED).

Oh yes, thanks. That should at least be in the changelog. Probably
split into its own patch really.

Thanks,
Nick