linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Maxime Coquelin <mcoquelin.stm32@gmail.com>
To: Joonsoo Kim <js1304@gmail.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>,
	Linux Memory Management List <linux-mm@kvack.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [Regression]: mm: nommu: Memory leak introduced with commit "mm/nommu: use alloc_pages_exact() rather than its own implementation"
Date: Mon, 16 Feb 2015 12:45:24 +0100	[thread overview]
Message-ID: <CALszF6DaFo7Xnehtt7vom32ydenhEFhx-YjH4BtLxLL6QwMmvA@mail.gmail.com> (raw)
In-Reply-To: <CAAmzW4PrXpv_znYUekFb=K70JqFXDWFmdhLa7jzx-7Ky7c7X5A@mail.gmail.com>

Hello Joonsoo,

2015-02-16 5:43 GMT+01:00 Joonsoo Kim <js1304@gmail.com>:
>
> Hello,
>
> Sorry for my mistake.
> Problem happens because when we allocate memory through
> __get_free_pages(), refcount of each pages is not 1 except
> head page. Below modification will fix your problem. Could you
> test it, please?

I just tested it, and confirm it fixes the regression.

You can add my:
Tested-by: Maxime Coquelin <mcoquelin.stm32@gmail.com>

Thanks for the quick fix!
Maxime

>
> Thanks.
>
> ------------>8-------------
> diff --git a/mm/nommu.c b/mm/nommu.c
> index 28bd8c4..ff6c1e2 100644
> --- a/mm/nommu.c
> +++ b/mm/nommu.c
> @@ -1189,11 +1189,9 @@ static int do_mmap_private(struct vm_area_struct *vma,
>         if (sysctl_nr_trim_pages && total - point >= sysctl_nr_trim_pages) {
>                 total = point;
>                 kdebug("try to alloc exact %lu pages", total);
> -               base = alloc_pages_exact(len, GFP_KERNEL);
> -       } else {
> -               base = (void *)__get_free_pages(GFP_KERNEL, order);
>         }
>
> +       base = alloc_pages_exact(total << PAGE_SHIFT, GFP_KERNEL);
>         if (!base)
>                 goto enomem;

      reply	other threads:[~2015-02-16 11:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-15 14:21 [Regression]: mm: nommu: Memory leak introduced with commit "mm/nommu: use alloc_pages_exact() rather than its own implementation" Maxime Coquelin
2015-02-16  4:43 ` Joonsoo Kim
2015-02-16 11:45   ` Maxime Coquelin [this message]

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=CALszF6DaFo7Xnehtt7vom32ydenhEFhx-YjH4BtLxLL6QwMmvA@mail.gmail.com \
    --to=mcoquelin.stm32@gmail.com \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=js1304@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.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).