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 4B558C433EF for ; Wed, 20 Jul 2022 18:43:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 58D286B0071; Wed, 20 Jul 2022 14:43:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 53CEC6B0073; Wed, 20 Jul 2022 14:43:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3DD796B0074; Wed, 20 Jul 2022 14:43:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 2C3C46B0071 for ; Wed, 20 Jul 2022 14:43:28 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id D0491C0561 for ; Wed, 20 Jul 2022 18:43:27 +0000 (UTC) X-FDA: 79708351254.28.5EE4969 Received: from mail-oa1-f49.google.com (mail-oa1-f49.google.com [209.85.160.49]) by imf12.hostedemail.com (Postfix) with ESMTP id 5DDE840098 for ; Wed, 20 Jul 2022 18:43:27 +0000 (UTC) Received: by mail-oa1-f49.google.com with SMTP id 586e51a60fabf-10d9213b77aso1526408fac.5 for ; Wed, 20 Jul 2022 11:43:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=hqTeRIGIkA1P1YaL39OwGHdP4zy4kA2HY0vqI0UakzU=; b=lmHZ2Tsxf3n2axmQxOz0/ceDOxYb/7ZcjDZ/tsH2cj+SlIFYzAJI7gsvIqlJZG4WiB mLenEOjBEF1jN6nrKlmNvGqVrhB6UxaS7nelpfUl5vPmPpm/H6sCiIKGZZJeELoIt6Ot 3gFNF628iCruzaocTGCTnQt6L1ku2oGgJ1YJkuRVysErzEzineUpIrR/4eikIAwAC0/I 5FXsXm4EnDFZWisSAT+yQwWxzREBzDhbrFDBm7VXXcszuRA6Q27SOC5WrdGxjweU9/DC Dytc4YBOjZbJiWBVSgCd2TDJEa5s0XTKe8WURn1kCs3meFtPJIzuX4/LPpR3b19bP1T2 DIrw== 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=hqTeRIGIkA1P1YaL39OwGHdP4zy4kA2HY0vqI0UakzU=; b=L5rIg38Aq/6StKlJiAny6wCPtqR/EC8RpLbGG6Ujfz7ATwt3uh/K9W3uVc5fvvV0lt lKHysxQEXOj6GBdrLjjex8egJ1WyYMuFjz7sCxNA8gkTRk1B7t2UjjDq4uW1yUS6M80b Ry/9IbC9DZ/IQ++DCgVSRdV5OU79JGxa8RQyyN0IT2ky7LiIMxilTRwTk0p90/ZOlho9 9qEMNkVmJvpnEsSzWCrG4TKyYw/bDBi7K2D54OeTtXFp/tGry3cWPbpPw6d9dv2tTp6Y kqU5sLtQaZOj/WTmGbcoHbmEtQcUn0TpcFZLV/MhKzBpxPcFFtCJ5sY+oBHnZ6uSyNUy fUSg== X-Gm-Message-State: AJIora9llx0gcLgdi9iXmFOdt8M5+yohkuF9bbTnYG7wExmgpcFyT6hW pHLTNJtpmzUJfFhZPgDAbzixkTBwWyIU4k3Yd/GQXg== X-Google-Smtp-Source: AGRyM1vU2y/ChX9WZkKrLIiMiGOypwktULCli/zPPsB9A9r/41CqvmMYznwIjAXUDSPWx/5w9b3hf/xR7lZ97mpLFiw= X-Received: by 2002:a05:6870:4308:b0:10b:8cbe:c945 with SMTP id w8-20020a056870430800b0010b8cbec945mr3260772oah.220.1658342606368; Wed, 20 Jul 2022 11:43:26 -0700 (PDT) MIME-Version: 1.0 References: <20220720111318.1831708-1-zokeefe@google.com> In-Reply-To: From: "Zach O'Keefe" Date: Wed, 20 Jul 2022 11:42:50 -0700 Message-ID: Subject: Re: [PATCH mm-unstable] Revert "mm/khugepaged: remove redundant transhuge_vma_suitable() check" To: Yang Shi Cc: Andrew Morton , Linux MM , Hugh Dickins Content-Type: text/plain; charset="UTF-8" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1658342607; 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=hqTeRIGIkA1P1YaL39OwGHdP4zy4kA2HY0vqI0UakzU=; b=oxA01WPKCVqfj+ItJ+8VqLb37Q05Nbzf89pYuBrx5FCQoLOmshXPQ2HPCGZCutkWsydSWa 0lcSjCFAeRbL/XFws+X0LcpIl38AMUB98fUDbB7I0Ey5ZtBvNAWEcZ2ghg3LLivMQgEXbu URQiA3W2KMDqUmqv0vOTIBp9VZYSDRY= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1658342607; a=rsa-sha256; cv=none; b=q/phCW24Dq5hUYy3Y1p6KiNX8h2LhmnckpmR+ceTM5gwr+av91ohDPycMWGu0xWm0De1Jn IGLRDn1Z2wB+lLLr+ipN8UmRysnuFK9a5VmF+o7fBPpXj2Vf01bhEpziEalzikZSJc5KfX vzCQQy0ERD45uyHpyVvTwe781xgA9fM= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=lmHZ2Tsx; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf12.hostedemail.com: domain of zokeefe@google.com designates 209.85.160.49 as permitted sender) smtp.mailfrom=zokeefe@google.com X-Rspamd-Queue-Id: 5DDE840098 Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=lmHZ2Tsx; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf12.hostedemail.com: domain of zokeefe@google.com designates 209.85.160.49 as permitted sender) smtp.mailfrom=zokeefe@google.com X-Rspamd-Server: rspam12 X-Rspam-User: X-Stat-Signature: 467e9kc358esopcx4zhp5nujabxtnym1 X-HE-Tag: 1658342607-810347 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 10:22 AM Yang Shi wrote: > > 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 > Thanks Yang. Also, hughd found it :) In hindsight, I think it's actually customary to add a "Reported-by: Hugh Dickins " - but since the previous patch will just be dropped and never see the light of day, I guess the value there is diminished. Anyways - credit goes to Hugh :) Thanks, Zach > > > > 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 > >