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 X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3FB4BC47404 for ; Wed, 9 Oct 2019 17:17:13 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D867E206BB for ; Wed, 9 Oct 2019 17:17:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="AOAkA+oy" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D867E206BB Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 3ED6A8E0008; Wed, 9 Oct 2019 13:17:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 39DB68E0003; Wed, 9 Oct 2019 13:17:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 28D3F8E0008; Wed, 9 Oct 2019 13:17:12 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0071.hostedemail.com [216.40.44.71]) by kanga.kvack.org (Postfix) with ESMTP id 022D68E0003 for ; Wed, 9 Oct 2019 13:17:11 -0400 (EDT) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with SMTP id 9EA28181AC9AE for ; Wed, 9 Oct 2019 17:17:11 +0000 (UTC) X-FDA: 76024901862.16.toy81_3eb876e9c6b17 X-HE-Tag: toy81_3eb876e9c6b17 X-Filterd-Recvd-Size: 5902 Received: from mail-lj1-f194.google.com (mail-lj1-f194.google.com [209.85.208.194]) by imf21.hostedemail.com (Postfix) with ESMTP for ; Wed, 9 Oct 2019 17:17:10 +0000 (UTC) Received: by mail-lj1-f194.google.com with SMTP id y23so3267682lje.9 for ; Wed, 09 Oct 2019 10:17:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=WYDrRYPHs0j7kH6nvfHacya6cMEOhB6fPC+Nemlqhfc=; b=AOAkA+oySTesOPMVYaXrzFKziTaxffb4NvaLlldPxDNma8iMLawniVil20T4VPFBT/ lJMODrpuJPMyGcX5A2MSdkt5UwkF3L8ZbQNgFABx5dhefmgUO+tHZ4ey9D0lN9erNqVg hnHobkTbmoNLfTwLN96hilGvYMpN12W8DR9gI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=WYDrRYPHs0j7kH6nvfHacya6cMEOhB6fPC+Nemlqhfc=; b=c9svsPjuUGBzVi1f8UYSa2ncYv3L4/Suz2s6IEWw7a6NCTMMn3a74Fla27qIEDLtUH PZi6a/z01GC7KIzFPSiarBGSjX+Jib9lrr+qC1wO78ZXKRTDC/jXpcqKheY234OerZK+ nCrD9uwTfmUurtHZpOcgDp7BsrMtEzIAdE2zaJx5ad7Yf8ZLO4siL+divVpMUC9WM5Qh 416qs4NFiyNZD0DgmczFEMYgkFAh5gEDzfNfHPVqSZHWad4HYb7ZgWlJtDQejE8Kydzm JQkoaAkc26zsZaExvO+odtKEb9fxZlyiTUiDCh1/hwQqGfTyN3LHSJ6BFeISScfUUgXm mzjg== X-Gm-Message-State: APjAAAX8yKK4h0alO9CkUbiDanMiFPwxG/QuXzdwfyaG4L+BZuq77HJb uPgT0jxhFrjkMGsXAGrnpNnuHi1xOLc= X-Google-Smtp-Source: APXvYqx5vCW6nLb/XEZQRi85yQJ3WfI43HZ42ZPjWXYxx9S839wXpZth1jeAdY9XkIWoYxeT9QCXjA== X-Received: by 2002:a2e:7a18:: with SMTP id v24mr3165039ljc.75.1570641428892; Wed, 09 Oct 2019 10:17:08 -0700 (PDT) Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com. [209.85.167.50]) by smtp.gmail.com with ESMTPSA id r6sm614844ljr.77.2019.10.09.10.17.06 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 09 Oct 2019 10:17:06 -0700 (PDT) Received: by mail-lf1-f50.google.com with SMTP id q12so2230663lfc.11 for ; Wed, 09 Oct 2019 10:17:06 -0700 (PDT) X-Received: by 2002:a19:6f0e:: with SMTP id k14mr2845221lfc.79.1570641426174; Wed, 09 Oct 2019 10:17:06 -0700 (PDT) MIME-Version: 1.0 References: <20191008091508.2682-1-thomas_os@shipmail.org> <20191008091508.2682-4-thomas_os@shipmail.org> <20191009152737.p42w7w456zklxz72@box> <03d85a6a-e24a-82f4-93b8-86584b463471@shipmail.org> In-Reply-To: <03d85a6a-e24a-82f4-93b8-86584b463471@shipmail.org> From: Linus Torvalds Date: Wed, 9 Oct 2019 10:16:49 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v4 3/9] mm: pagewalk: Don't split transhuge pmds when a pmd_entry is present To: =?UTF-8?Q?Thomas_Hellstr=C3=B6m_=28VMware=29?= Cc: "Kirill A. Shutemov" , Linux Kernel Mailing List , Linux-MM , Thomas Hellstrom , Matthew Wilcox , Will Deacon , Peter Zijlstra , Rik van Riel , Minchan Kim , Michal Hocko , Huang Ying , =?UTF-8?B?SsOpcsO0bWUgR2xpc3Nl?= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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, Oct 9, 2019 at 10:03 AM Thomas Hellstr=C3=B6m (VMware) wrote: > > Nope, it handles the hugepages by ignoring them, since they should be > read-only, but if pmd_entry() was called with something else than a > hugepage, then it requests the fallback, but never a split. But PAGE_WALK_FALLBACK _is_ a split. Oh, except you did this - split_huge_pmd(walk->vma, pmd, addr); + if (!ops->pmd_entry) + split_huge_pmd(walk->vma, pmd, addr); so it avoids the split. No, that's unacceptable. And makes no sense anyway. If it doesn't split the pmd, then it shouldn't walk the pte's - because they don't exist. And if it's not a hugepmd, then the split is a no-op, so the test makes no sense. I hadn't noticed that part of the patch. That simply can't be right. I don't think you've tested this, because you never actually have hugepages, do you? You didn't notice or realize that split_huge_pmd() just does that if (is_swap_pmd(*____pmd) || pmd_trans_huge(*____pmd) \ || pmd_devmap(*____pmd)) \ thing and doesn't do anythign at all if it's not huge. So no. That code makes no sense at all, and I didn't realize how senseless it was, becasue I stupidly missed that "make the split conditional" - which is insane and wrong - and I thought that you wanted PAGE_WALK_FALLBACK to split a pmd and fall back to per-pte entries, which is what the name implies. But that's not what you wanted at all. Just get rid of PAGE_WALK_FALLBACK entirely then, and make the rule be that a zero return value just means "split and do ptes". Which is what you want (see above why "split" simply is wrong, and isn't an issue for you anyway. That won't change any existing cases, since even if they do have a zero return value, they don't have a pte_entry() callback, so they won't do that "split and do ptes" anyway. Linus