linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: "Kirill A. Shutemov" <kirill@shutemov.name>
Cc: Joel Fernandes <joel@joelfernandes.org>,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linux-MM <linux-mm@kvack.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Naresh Kamboju <naresh.kamboju@linaro.org>,
	William Kucharski <william.kucharski@oracle.com>
Subject: Re: [PATCHv2] mm: Fix warning in move_normal_pmd()
Date: Wed, 15 Jul 2020 16:04:47 -0700	[thread overview]
Message-ID: <CAHk-=wh3jD4dwXWWFors9OnYp-YCzYN2bCGs9HDxrtZ=TiFyDQ@mail.gmail.com> (raw)
In-Reply-To: <CAHk-=wgp-ZJ+J250DMaJFBDU2hnhUUqXcUnVnZZ1iFQEK6O-jg@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 747 bytes --]

On Wed, Jul 15, 2020 at 3:57 PM Linus Torvalds
<torvalds@linux-foundation.org> wrote:
>
> But now I've screwed it up twice, and have a splitting headache, so
> rather than stare at this cross-eyed, I'll take a break and hope that
> somebody more competent than me looks at the code.

I lied. I had a couple of pending pulls, so I couldn't go lie down
anyway, so I tried to take another look.

It *might* be as simple as this incremetal thing on top, but then I
think that code will no longer trigger on the stack movement case at
all, since there we don't work with the whole vma.

So if we want that to work, we'd have to fix that up too.

And this might be broken anyway. My track record isn't looking so hot right now.

                  Linus

[-- Attachment #2: patch.incremental --]
[-- Type: application/octet-stream, Size: 708 bytes --]

diff --git a/mm/mremap.c b/mm/mremap.c
index 614b4fffed1d..6c3df022ff64 100644
--- a/mm/mremap.c
+++ b/mm/mremap.c
@@ -243,6 +243,9 @@ static inline void try_to_align_start(unsigned long *len,
 	struct vm_area_struct *old, unsigned long *old_addr,
 	struct vm_area_struct *new, unsigned long *new_addr)
 {
+	if (*old_addr > old->vm_start)
+		return;
+
 	if (ADDR_BEFORE_PREV(*old_addr & PMD_MASK, old))
 		return;
 
@@ -270,6 +273,9 @@ static inline void try_to_align_end(unsigned long *len,
 	struct vm_area_struct *old, unsigned long *old_addr,
 	struct vm_area_struct *new, unsigned long *new_addr)
 {
+	if (*old_addr < old->vm_end)
+		return;
+
 	if (ADDR_AFTER_NEXT(*old_addr + *len, old))
 		return;
 

  reply	other threads:[~2020-07-15 23:05 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-15 13:50 [PATCHv2] mm: Fix warning in move_normal_pmd() Kirill A. Shutemov
2020-07-15 18:36 ` Linus Torvalds
2020-07-15 20:54   ` Joel Fernandes
2020-07-15 21:13     ` Kirill A. Shutemov
2020-07-15 21:31     ` Linus Torvalds
2020-07-15 21:43       ` Linus Torvalds
2020-07-15 22:22         ` Kirill A. Shutemov
2020-07-15 22:36           ` Linus Torvalds
2020-07-15 22:57           ` Linus Torvalds
2020-07-15 23:04             ` Linus Torvalds [this message]
2020-07-15 23:18               ` Linus Torvalds
2020-07-16  6:37                 ` Naresh Kamboju
2020-07-16  7:23                   ` Naresh Kamboju
2020-07-16  8:46                     ` Kirill A. Shutemov
2020-07-16  8:32                 ` Naresh Kamboju
2020-07-16 13:16                 ` Kirill A. Shutemov
2020-07-16 17:54                   ` Linus Torvalds
2020-07-16 18:47                     ` Joel Fernandes
2020-07-15 20:55   ` Kirill A. Shutemov
2020-07-15 21:35     ` Linus Torvalds
2020-07-15 21:51       ` 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='CAHk-=wh3jD4dwXWWFors9OnYp-YCzYN2bCGs9HDxrtZ=TiFyDQ@mail.gmail.com' \
    --to=torvalds@linux-foundation.org \
    --cc=akpm@linux-foundation.org \
    --cc=joel@joelfernandes.org \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=kirill@shutemov.name \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=naresh.kamboju@linaro.org \
    --cc=william.kucharski@oracle.com \
    /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).