On Tue, Jul 04, 2023 at 06:22:06AM -0700, Linus Torvalds wrote: > On Tue, 4 Jul 2023 at 00:36, <gregkh@xxxxxxxxxxxxxxxxxxx> wrote: > > > > Subject: gup: avoid stack expansion warning for known-good case > > > > From: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> > > > > commit eee9c708cc89b4600c6e6cdda5bc2b8b4dad96cb upstream. > > This patch shouldn't be needed in stable. > > If you look a few lines up, you'll see that the exact same logic of > vma_lookup -> expand_stack is already there. > > The only reason it's there in mainline is that the interaction with > commit ca5e863233e8 ("mm/gup: remove vmas parameter from > get_user_pages_remote()") caused the vma lookup (and thus expand) to > be done *after* doing the GUP. > > So in mainline, this > > > + /* Avoid triggering the temporary warning in __get_user_pages */ > > + if (!vma_lookup(mm, addr) && !expand_stack(mm, addr)) > > + return 0; > > ends up being a "let's do an extra vma_lookup() -> expand_stack() > sequence early" because the "real one" is done later. > > But in the original patches (and the backports), it was always done > early, so this patch just duplicates what's already there. Ah, I missed that this was a "duplicate" check here, thanks for letting me know, I'll go drop this from all of the queues. greg k-h