Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp4438643imm; Mon, 30 Jul 2018 14:54:45 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeVNU3u1NKdXsfkxurFddTfJkh5rEh9rsHQBP9BfD6RuwjLb92zrEXTHMrOOR6WcceO5WFh X-Received: by 2002:a63:788b:: with SMTP id t133-v6mr17897643pgc.329.1532987685773; Mon, 30 Jul 2018 14:54:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532987685; cv=none; d=google.com; s=arc-20160816; b=S9p9wRJNMqyelB2BORuJeamLtcLIj+zgnZ2gkQHMlhuRQi69IheL8LURUjWifouC0Y hotM0I1NG0tSKK1wXeqStKHgOESSvihfeX/51e2Ho9OU5NV40Gt7VN6I3ZKNXQ2QwBaQ NFDB9BFNRo0LQ2Bai3bUlIh6XzMOFYN/STCNqWQDSOhTwAl662lFllAlRyutRc+lsSmU xmTzUrEc0AO2qbGhj2XsnoHTEX0OF18QPAw8YXpjbd1YmYW2qMLMWL4H+0DVJ22pfQdG /t0cWtzuo+ZS80c9wavzbdjg3Z7ULiGUddEWmCNs7z3k3kry8IWEyCfrZLqiQnqSoTau Mz+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=nUmipr2/F4g8kEJwlOipcRl8v+DJmY7MY9xxF+LecJs=; b=CAhHLzXAcf22+yvksr4iIL+vFAs4mbN94TooifW52i2u4v4HKdjgfkdAP9vC1CsKPb VTrivMfacBGfttzzimRWKwfDjPFWvcG8HuT3VzPcoF3pHserN+68PDjT/nKIpcJ0SyUk BqhqJs1AruVTedcEWTqQLnRn3xniPXd1eAJcrENenbfRAPO0lxCKE3AjTvqFWuurCqGe xr/Pz/2jFK8RekcYZmBo//UMHAna1ctqgQ7mXvkhKmGvNQXo4tSq7a1SiF6sVQKSdGJM BqulIvJVPRU3+lNjDG4GROPYSw0EsdjsT9r9Kb5+i3zF8O0A1Git2I+p5sOEcPAj4wrc 7KKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=p6tsJbxL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j20-v6si11699568pgb.92.2018.07.30.14.54.31; Mon, 30 Jul 2018 14:54:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=p6tsJbxL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731803AbeG3Xaa (ORCPT + 99 others); Mon, 30 Jul 2018 19:30:30 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:42225 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731418AbeG3Xaa (ORCPT ); Mon, 30 Jul 2018 19:30:30 -0400 Received: by mail-pf1-f193.google.com with SMTP id l9-v6so5114408pff.9 for ; Mon, 30 Jul 2018 14:53:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=nUmipr2/F4g8kEJwlOipcRl8v+DJmY7MY9xxF+LecJs=; b=p6tsJbxLJ4Z31oHQ4h3sXGlrMLnjUXsZl9vOL6DIPeAkverp4mDX5vu2sNUSSighVc sZDZ4cdzAexNiD4Lzql/7DGI0G0hYnYcY+h4w33KMlG/cKEpdB5UsWbseqVdqHTOexuj wPXRV7zC3FWjrTz3F8vvrJZxDFaKAem7bXGG7b32PEsBB/EKr3q2QRmbKK3LGoxr2Vw1 lNz7wsp+YEjs4Iphakhb5V0OEE5pN4NI/ia+Xd/1DmNyUgQnzlqaVeorlFfYYHuf5wqT d1SwGKiW4QM6NcW65B9QXQtrRBI9ffVOccdMZovV1DQJ5ysl43w2IS2gQP2u6bK2/cg8 snfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=nUmipr2/F4g8kEJwlOipcRl8v+DJmY7MY9xxF+LecJs=; b=a2PgUw8w3hBtWcPlqmOrhziWw2FafFfvrqGHXumYSKpI9+izzWpvqCq482Mu1kGSzW IeDBOkWyFY4AUSSrArW3Rc9R6+eAw403ZOaRrRG/Xb7qZM9nw775MBbxRtT8GtUbSdgN idThhlDNn8ykFM0n/J4yyK9TAHieLLZW12gLu3m54cBsK+FO5Oc5Ajd4DeIHJ+yYqIVm z7VOBbCKvy2zZGZJAPaaLjF5/KpLIICZ1WploHibYEgVHA9N3MYC1B8IKQm/bRN5Sqd/ i62zjGVI86vZBbhvN2CiKH44/1KwmHXJyCGtgiVaJK1kao2ePYjGZ6TEz5ULvl0r/tmt jezw== X-Gm-Message-State: AOUpUlExdzHnS9ls0kKEC8OEXKxNVOYoruZ1prl8sbP1in0xk+aISHuo ikf8Sc0Tu/vxzt0P6KAmBEN4bA== X-Received: by 2002:a63:4b5a:: with SMTP id k26-v6mr17335150pgl.384.1532987610371; Mon, 30 Jul 2018 14:53:30 -0700 (PDT) Received: from [100.112.64.65] ([104.133.8.97]) by smtp.gmail.com with ESMTPSA id p66-v6sm22198861pfd.65.2018.07.30.14.53.28 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 30 Jul 2018 14:53:28 -0700 (PDT) Date: Mon, 30 Jul 2018 14:53:21 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@eggly.anvils To: Linus Torvalds cc: "Kirill A. Shutemov" , Hugh Dickins , Matthew Wilcox , Amit Pundir , "Kirill A. Shutemov" , Andrew Morton , Dmitry Vyukov , Oleg Nesterov , Andrea Arcangeli , Greg Kroah-Hartman , John Stultz , linux-mm , Linux Kernel Mailing List , youling257@gmail.com Subject: Re: Linux 4.18-rc7 In-Reply-To: Message-ID: References: <20180730130134.yvn5tcmoavuxtwt5@kshutemo-mobl1> User-Agent: Alpine 2.11 (LSU 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 30 Jul 2018, Linus Torvalds wrote: > On Mon, Jul 30, 2018 at 6:01 AM Kirill A. Shutemov wrote: > > > > I think I missed vma_set_anonymous() somewhere, but I fail to see where. > > Honestly, by now we just need to revert that commit. > > It's not even clear that it was a good idea to begin with. The rest of > the commits were cleanups, this one was driven by a incorrect > VM_BUG_ON() that triggered, and that checked "vma_is_anonymous(vma)" > without any explanations of wht it should matter. > > I think the biggest problem with vma_is_anonymous() may be its name, > not what it does. > > What the code historically *did* (and what vma_is_anonymous() checks) > is not "is this anonymous", but rather "does this have any special > operations associated with it". > > The two are similar. But people have grown opinions about exactly what > "anonymous" means. If we had named it just "no_vm_ops()", we wouldn't > have random crazy checks for "vma_is_anonymous()" in places where it > makes no sense. > > So what I think we want a real explanation for is why people who use > "vma_is_anonymous()" care. Instead of trying to change its very > historical meaning, we should look at the users, and perhaps change > its name. You make a very good point on the naming. Especially confusing when layered on top of "we call shmem 'file' here, but 'anon' there". I have no problem with reverting -rc7's vma_is_anonymous() series. > > In this case, for example, I think the *real* problem was described by > commit 684283988f70 ("huge pagecache: mmap_sem is unlocked when > truncation splits pmd"), and the problem is that an existing check > that required that mmap_sem was held was changed to say "only for > anonymous mappings". > > But the fact is, you can truncate mappings that don't have any ops just *fine*. > > So maybe that original BUG() was entirely bogus to begin with, and it > shouldn't exist at all? > > Or maybe the code should test "do I have a vm_file" instead of testing > "do I have vm_ops"? > > What's the problem with just doing split_huge_pmd() there when it's a > pmd_trans_huge or pmd_devmap pmd? Why is that VM_BUG_ON_VMA() there in > the first place? Why are allegedly "anonymous" mappings so special > here for locking? > > Adding a few more people to the cc, they were involved the last that > time VM_BUG_ON_VMA() was modified. > > New people: see commit bfd40eaff5ab ("mm: fix vma_is_anonymous() > false-positives") for details. Right now I think it's getting > reverted, but the oops explanation in the commit is about that > > kernel BUG at mm/memory.c:1422! > > which was/is debatable and seems to make no sense (and definitely is > still triggerable despite that commit 684283988f70 ("huge pagecache: > mmap_sem is unlocked when truncation splits pmd") that limited it a > bit - but I think it didn't limit it enough. I'm all for deleting that VM_BUG_ON_VMA() in zap_pmd_range(), it was just a compromise with those who wanted to keep something there; I don't think we even need a WARN_ON_ONCE() now. It's historical: back in the day when only (hugetlbfs which never gets there, and) anon THP used huge pmds for userspace, it did half- document an obscure assumption underlying __split_huge_pmd(), and IIRC was added in response to a trinity bug catch in that area. (It remains quite interesting how exit_mmap() does not come that way, and most syscalls split the vma beforehand in vma_adjust(): it's mostly about madvise(,,MADV_DONTNEED), perhaps others now, which zap ptes without prior splitting.) Once DAX and huge tmpfs came in, the BUG had to be scrapped or weakened because truncation and hole-punching can come that way without mmap_sem. And perhaps other drivers since are taking advantage of huge pmds now, with other assumptions. But I have not yet taken a look to see where the -rc7 changes actually go wrong: I'll spend a little while looking, but don't expect to find it - certainly don't wait on me, I'll only speak up if I find something. Hugh