linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
To: Nicholas Piggin <npiggin@gmail.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>,
	benh@kernel.crashing.org, paulus@samba.org,
	linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH] powerpc/64s/slice: Use addr limit when computing slice mask
Date: Sat, 11 Nov 2017 19:16:39 +0530	[thread overview]
Message-ID: <87k1yxrkqo.fsf@linux.vnet.ibm.com> (raw)
In-Reply-To: <20171111200951.648f37c6@roar.ozlabs.ibm.com>

Nicholas Piggin <npiggin@gmail.com> writes:

> On Fri, 10 Nov 2017 22:59:57 +0530
> "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com> wrote:
>
>> Michael Ellerman <mpe@ellerman.id.au> writes:
>> 
>> > "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com> writes:
>> >  
>> >> While computing slice mask for the free area we need make sure we only search
>> >> in the addr limit applicable for this mmap. We update the slb_addr_limit
>> >> after we request for a mmap above 128TB. But the following mmap request
>> >> with hint addr below 128TB should still limit its search to below 128TB. ie.
>> >> we should not use slb_addr_limit to compute slice mask in this case. Instead,
>> >> we should derive high addr limit based on the mmap hint addr value.
>> >>
>> >> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
>> >> ---
>> >>  arch/powerpc/mm/slice.c | 34 ++++++++++++++++++++++------------
>> >>  1 file changed, 22 insertions(+), 12 deletions(-)  
>> >
>> > How does this relate to the fixes Nick has sent?  
>> 
>> This patch is on top of the patch series sent by Nick. Without this
>> patch we will allocate memory across the 128TB range if hint_addr <
>> 128TB but hint_addr + len is more. Inorder to recreate this issue we
>> will have to map stack below. Hence one won't hit the error in general
>> case.
>
> I couldn't get it to trigger this case after that series -- hash
> get_unmapped_area should be excluding that case up front before
> getting into the slice allocator. Do you have an strace to reproduce
> it?

That is correct. This change in slice_get_unmapped_area prevents the
issue I mentioned above. I did have that hunk reverted to check the error
mask creation. 

-		if (addr > mm->task_size - len ||
+		if (addr > high_limit - len ||
 		    !slice_area_is_free(mm, addr, len))
 			addr = 0;
 	}


>
> Either way I do think it would be good to tighten up all the slice
> bitmap limits, including all the other places that hardcodes the
> max bitmap size.
>


-aneesh

  reply	other threads:[~2017-11-11 13:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-10  4:55 [PATCH] powerpc/64s/slice: Use addr limit when computing slice mask Aneesh Kumar K.V
2017-11-10  9:44 ` Michael Ellerman
2017-11-10 17:29   ` Aneesh Kumar K.V
2017-11-11  9:09     ` Nicholas Piggin
2017-11-11 13:46       ` Aneesh Kumar K.V [this message]
2017-11-24  9:46 ` Michael Ellerman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87k1yxrkqo.fsf@linux.vnet.ibm.com \
    --to=aneesh.kumar@linux.vnet.ibm.com \
    --cc=benh@kernel.crashing.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=npiggin@gmail.com \
    --cc=paulus@samba.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).