From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 181BAC43334 for ; Wed, 20 Jul 2022 17:22:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 326CD6B0071; Wed, 20 Jul 2022 13:22:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2D4B16B0073; Wed, 20 Jul 2022 13:22:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 19E196B0074; Wed, 20 Jul 2022 13:22:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 0B4666B0071 for ; Wed, 20 Jul 2022 13:22:57 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id DC6D61C5E69 for ; Wed, 20 Jul 2022 17:22:56 +0000 (UTC) X-FDA: 79708148352.09.5A77FCC Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) by imf25.hostedemail.com (Postfix) with ESMTP id 6DFD3A001A for ; Wed, 20 Jul 2022 17:22:56 +0000 (UTC) Received: by mail-pl1-f170.google.com with SMTP id k16so820531pls.8 for ; Wed, 20 Jul 2022 10:22:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=BBhPlyLX9QuH0wSZHYsTUETgbT5tjwC9x+oGlbQY83k=; b=KJUr+EFI8+Pvd/D2bWRai3FYB1DZ6yey5y/CAccsujI5fGwJThGtNnsksh2Cz5vYDr slbF3j8RqTAlwTXdMQIbw7OJJoYuFWxR/TJXBUvG97+t6TJQ06vI/ZtxDSxh5PL7gDVH W8WWzejk+uVluhs6ZRZ3SO4DWZtYN3Qtl+nW/4tqZQgHIsehAYDoEbuFh5OqnipLskjm 3809e/7Uf8ObUU0SKqQUeJxOdQ79C1E45ndARzU/9y1tduFFAJC+brYwXfETstxb5XgU rIsH2zkBBW2C8cSfPvouu5KuV3ZHShQB7aLx2bXi4eH1+2nOHuNOZm02X9mywNbumZ8u CRaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=BBhPlyLX9QuH0wSZHYsTUETgbT5tjwC9x+oGlbQY83k=; b=Z5wdTCYntcXnYiBD5cEPW4oE2OuF3UVojEdHNdLxKtfd4l6LDRkQyqNj+0UkLZTDuR T+trTcHOVU0EzxmBxdM3s33QohXHAxsfuZSCEjSUV9rsbP3Kyw6Omqn4EZWDUy2I3CWT nutZo29knF7qL1QbULFrqpK56LK1adwIFE2CWHlCznkTA6ZgIbgVARhqlkZ4A327QDzg lnj+y0Za0D8uX9guvYPkUCZjPXpstLsZ/qXu+Z0QEqtB5TGoLbKwgYRsFqUdTuRXMFw5 FXJe/4e2eF0DnoDY4YUl0JUB6F5zr/+XN44dDmG8rOxWiKimBX+bGg0a1wZ7qIHQSaOj ay/w== X-Gm-Message-State: AJIora+bWQmvlejqYZtZyKXSdsriHn90NfeFbcdfQNdBsE/D7HLEJVlN snBGUdcc0ESv3Zd5/r3Nent4eW5R3X7TGfE+1Bs= X-Google-Smtp-Source: AGRyM1vTKYGkp8o0HpFqJODdIfEw5DRZQmgwI/ESZctb4HSpYkltuRrU1MzaIeDjtSUfjKqZ/vorHmhSbGBjL6VOSJI= X-Received: by 2002:a17:902:9005:b0:16c:f62c:4376 with SMTP id a5-20020a170902900500b0016cf62c4376mr15238766plp.87.1658337775222; Wed, 20 Jul 2022 10:22:55 -0700 (PDT) MIME-Version: 1.0 References: <20220720111318.1831708-1-zokeefe@google.com> In-Reply-To: <20220720111318.1831708-1-zokeefe@google.com> From: Yang Shi Date: Wed, 20 Jul 2022 10:22:42 -0700 Message-ID: Subject: Re: [PATCH mm-unstable] Revert "mm/khugepaged: remove redundant transhuge_vma_suitable() check" To: "Zach O'Keefe" Cc: Andrew Morton , Linux MM , Hugh Dickins Content-Type: text/plain; charset="UTF-8" ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1658337776; a=rsa-sha256; cv=none; b=xaogtdV8Ts+Obwvlmr+m8onmHLmz0JC9ugAinS2SLtV8Kqd4lMA2XKs1viOcXtxkvq7R+n DGnQvQVZMlp7XYRwF0EGFuNL33oO+NRsyhp2V4WUWk2e+AnbgT19mL1/7r7qOTSTOi8n0v uaX7Pib4+E3R/OGepTTJ18BarrUHfYo= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=KJUr+EFI; spf=pass (imf25.hostedemail.com: domain of shy828301@gmail.com designates 209.85.214.170 as permitted sender) smtp.mailfrom=shy828301@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1658337776; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=BBhPlyLX9QuH0wSZHYsTUETgbT5tjwC9x+oGlbQY83k=; b=cm2UmluzX76CVLXbbYRg8jG4dw9qjbZIheNPCRb8ThwCGG/wjujuAszbO4YAgz3eUy9iPL f6sj7d8gBGbLXsrFmud+DJgfqQUi5PF7cyC/Ko3LF6qt8HhEF4SngucDmihu5jQrhDprGt xoIxnwkcczAgN2PAV8GKE/KE7Fv8+og= X-Rspamd-Queue-Id: 6DFD3A001A Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=KJUr+EFI; spf=pass (imf25.hostedemail.com: domain of shy828301@gmail.com designates 209.85.214.170 as permitted sender) smtp.mailfrom=shy828301@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspam-User: X-Rspamd-Server: rspam06 X-Stat-Signature: t19rwawzbmt77m33fwpruui37p196ibk X-HE-Tag: 1658337776-746982 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed, Jul 20, 2022 at 4:13 AM Zach O'Keefe wrote: > > A pmd should not cross a VMA boundary, which is normally enforced by > vma_adjust_trans_huge(), and assumed by e.g. __split_huge_pmd_locked(). > > In this regard, the transhuge_vma_suitable() check in > hugepage_vma_check() is not redundant with the transhuge_vma_suitable() > check previously in hugepage_vma_revalidate(). > > The former validates the VMA itself, and checks that *some* memory > in the VMA is suitable to collapse while the latter validates if > collapsing at a specific address is suitable. By removing the check on > the faulting address, we've inadvertently allowed collapse of a pmd that > can cross vma->vm_end. Revert this change. Aha, yeah, nice catch. Reviewed-by: Yang Shi > > Fixes: 143776e7512e ("mm/khugepaged: remove redundant transhuge_vma_suitable() check") > Signed-off-by: Zach O'Keefe > --- > Apologies, Andrew. I think you've put the series description into this > first patch (thank you). Do you mind moving it into the next patch in the > series, > "mm: khugepaged: don't carry huge page to the next loop for !CONFIG_NUMA"? > Note that the "mm: userspace hugepage collapse, v7" series doesn't actually > depend on this patch, it was just a cleanup (and thus perhaps I shouldn't have > included it in the series in the first place). > --- > mm/khugepaged.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/mm/khugepaged.c b/mm/khugepaged.c > index 2db6d0dd2981..69990dacde14 100644 > --- a/mm/khugepaged.c > +++ b/mm/khugepaged.c > @@ -855,6 +855,8 @@ static int hugepage_vma_revalidate(struct mm_struct *mm, unsigned long address, > if (!vma) > return SCAN_VMA_NULL; > > + if (!transhuge_vma_suitable(vma, address)) > + return SCAN_ADDRESS_RANGE; > if (!hugepage_vma_check(vma, vma->vm_flags, false, false, > cc->is_khugepaged)) > return SCAN_VMA_CHECK; > -- > 2.37.0.170.g444d1eabd0-goog >