All of lore.kernel.org
 help / color / mirror / Atom feed
From: Naresh Kamboju <naresh.kamboju@linaro.org>
To: "Kirill A. Shutemov" <kirill@shutemov.name>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Joel Fernandes <joel@joelfernandes.org>,
	linux- stable <stable@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>,
	linux-mm <linux-mm@kvack.org>, Arnd Bergmann <arnd@arndb.de>,
	Andrew Morton <akpm@linux-foundation.org>,
	Roman Gushchin <guro@fb.com>, Michal Hocko <mhocko@kernel.org>,
	lkft-triage@lists.linaro.org, Chris Down <chris@chrisdown.name>,
	Michel Lespinasse <walken@google.com>,
	Fan Yang <Fan_Yang@sjtu.edu.cn>,
	Brian Geffon <bgeffon@google.com>,
	Anshuman Khandual <anshuman.khandual@arm.com>,
	Will Deacon <will@kernel.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	pugaowei@gmail.com, Jerome Glisse <jglisse@redhat.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Mel Gorman <mgorman@techsingularity.net>,
	Hugh Dickins <hughd@google.com>,
	Al Viro <viro@zeniv.linux.org.uk>, Tejun Heo <tj@kernel.org>,
	Sasha Levin <sashal@kernel.org>
Subject: Re: WARNING: at mm/mremap.c:211 move_page_tables in i386
Date: Tue, 14 Jul 2020 16:57:26 +0530	[thread overview]
Message-ID: <CA+G9fYsqdHR=ty2hKj44zQ=SrHuWwu-eN0odp72AGCiNkFVUog@mail.gmail.com> (raw)
In-Reply-To: <20200714073306.kq4zikkphqje2yzb@box>

On Tue, 14 Jul 2020 at 13:03, Kirill A. Shutemov <kirill@shutemov.name> wrote:
>
> On Sun, Jul 12, 2020 at 03:58:06PM -0700, Linus Torvalds wrote:
> > Anybody else have any opinions?
>
> Maybe we just shouldn't allow move_normal_pmd() if ranges overlap?
>
> Other option: pass 'overlaps' down to move_normal_pmd() and only WARN() if
> see establised PMD without overlaps being true.
>
> Untested patch:

This patch applied on top of Linus mainline tree and tested on i386.
The reported warning did not happen while testing LTP mm [1].


>
> diff --git a/mm/mremap.c b/mm/mremap.c
> index 5dd572d57ca9..e33fcee541fe 100644
> --- a/mm/mremap.c
> +++ b/mm/mremap.c
> @@ -245,6 +245,18 @@ unsigned long move_page_tables(struct vm_area_struct *vma,
>         unsigned long extent, next, old_end;
>         struct mmu_notifier_range range;
>         pmd_t *old_pmd, *new_pmd;
> +       bool overlaps;
> +
> +       /*
> +        * shift_arg_pages() can call move_page_tables() on overlapping ranges.
> +        * In this case we cannot use move_normal_pmd() because destination pmd
> +        * might be established page table: move_ptes() doesn't free page
> +        * table.
> +        */
> +       if (old_addr > new_addr)
> +               overlaps = old_addr - new_addr < len;
> +       else
> +               overlaps = new_addr - old_addr < len;
>
>         old_end = old_addr + len;
>         flush_cache_range(vma, old_addr, old_end);
> @@ -282,7 +294,7 @@ unsigned long move_page_tables(struct vm_area_struct *vma,
>                         split_huge_pmd(vma, old_pmd, old_addr);
>                         if (pmd_trans_unstable(old_pmd))
>                                 continue;
> -               } else if (extent == PMD_SIZE) {
> +               } else if (!overlaps && extent == PMD_SIZE) {
>  #ifdef CONFIG_HAVE_MOVE_PMD
>                         /*
>                          * If the extent is PMD-sized, try to speed the move by
> --
>  Kirill A. Shutemov

ref:
https://lkft.validation.linaro.org/scheduler/job/1561734#L1598

- Naresh

  reply	other threads:[~2020-07-14 11:27 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-09  5:28 WARNING: at mm/mremap.c:211 move_page_tables in i386 Naresh Kamboju
2020-07-09  5:28 ` Naresh Kamboju
2020-07-09  8:25 ` Arnd Bergmann
2020-07-10  4:17   ` Naresh Kamboju
2020-07-09 19:12 ` Linus Torvalds
2020-07-09 19:12   ` Linus Torvalds
2020-07-10  4:28   ` Naresh Kamboju
2020-07-10  4:28     ` Naresh Kamboju
2020-07-10  5:22     ` Linus Torvalds
2020-07-10  5:22       ` Linus Torvalds
2020-07-10 17:48       ` Naresh Kamboju
2020-07-10 17:48         ` Naresh Kamboju
2020-07-10 20:05         ` Linus Torvalds
2020-07-10 20:05           ` Linus Torvalds
2020-07-11 17:27           ` Naresh Kamboju
2020-07-11 17:27             ` Naresh Kamboju
2020-07-11 18:12             ` Linus Torvalds
2020-07-11 18:12               ` Linus Torvalds
2020-07-11 18:21               ` Linus Torvalds
2020-07-11 18:21                 ` Linus Torvalds
2020-07-11 23:33               ` Joel Fernandes
2020-07-12 17:30               ` Matthew Wilcox
2020-07-12 20:38                 ` Linus Torvalds
2020-07-12 20:38                   ` Linus Torvalds
2020-07-12 21:50       ` Joel Fernandes
2020-07-12 22:58         ` Linus Torvalds
2020-07-12 22:58           ` Linus Torvalds
2020-07-13  2:53           ` Joel Fernandes
2020-07-13  3:51             ` Linus Torvalds
2020-07-13  3:51               ` Linus Torvalds
2020-07-13 12:12               ` Joel Fernandes
2020-07-14  7:33           ` Kirill A. Shutemov
2020-07-14 11:27             ` Naresh Kamboju [this message]
2020-07-14 11:27               ` Naresh Kamboju
2020-07-14 16:08             ` Joel Fernandes
2020-07-14 16:10               ` Linus Torvalds
2020-07-14 16:10                 ` Linus Torvalds
2020-07-14 18:12                 ` Joel Fernandes
2020-07-14 18:12                   ` Joel Fernandes
2020-07-14 18:49                   ` Linus Torvalds
2020-07-14 18:49                     ` Linus Torvalds

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='CA+G9fYsqdHR=ty2hKj44zQ=SrHuWwu-eN0odp72AGCiNkFVUog@mail.gmail.com' \
    --to=naresh.kamboju@linaro.org \
    --cc=Fan_Yang@sjtu.edu.cn \
    --cc=akpm@linux-foundation.org \
    --cc=anshuman.khandual@arm.com \
    --cc=arnd@arndb.de \
    --cc=bgeffon@google.com \
    --cc=catalin.marinas@arm.com \
    --cc=chris@chrisdown.name \
    --cc=gregkh@linuxfoundation.org \
    --cc=guro@fb.com \
    --cc=hughd@google.com \
    --cc=jglisse@redhat.com \
    --cc=joel@joelfernandes.org \
    --cc=kirill@shutemov.name \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lkft-triage@lists.linaro.org \
    --cc=mgorman@techsingularity.net \
    --cc=mhocko@kernel.org \
    --cc=pugaowei@gmail.com \
    --cc=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=tj@kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=walken@google.com \
    --cc=will@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.