Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1182579imm; Wed, 1 Aug 2018 11:33:47 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdfyErynwlNJv89xIjN/w/QbHIBWuDbqllLCrYWBZBuiJEDU7dLsDUDX/h2PpYqOHYTT/Nb X-Received: by 2002:a63:951e:: with SMTP id p30-v6mr25674788pgd.318.1533148427358; Wed, 01 Aug 2018 11:33:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533148427; cv=none; d=google.com; s=arc-20160816; b=TB3H5WJishVY+pQZrjGPegdQaJmEbqISP+HO5AOFrfE7maIruegHwG2Q3dkgS/nV5N TzH+ZJPXXK5ONd7kVydtTgOWTtB+h6ANy6xoTvkYdq8lp9WQv1W7MKM7jDSRNNV7SGKs ZFn9nywDIJqRAEhRiNZ7lMxyAbhfCh+NplD/dxV4bTuszOdfduNTnjsZ7//2sEL6AiII jgOOI0SvvchoACMvTEJgNKArKbbqYxYELcxc3AT4xUsWoSg/T6JVXlvn9+538DTuiVKF 3kZevd7li3Kmo+hy0FhN7Dew9qV97jMN53KHRnJNn0bs0fxXUnW3/aFnMfX8CxfF4TuO LQxQ== 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=iVO74wCV0EWaGwHK362LJP9PGuz2nnGv1IDmpsU7ky0=; b=JeyN8J1kfuWEj2nZEjGP9p86vFSRSEo1d8/3vHVuH/tIRTzy8BHWbnyJsQ5NKIsRf5 s7T7npi5KqQQs8gkKnbAADduy+1SbvPqiB1i6UVgIuyjPthEaH/DzAkJZEYEc8kv4aSX vtCrrudOzB1IVleSWkAxY4QBmUzo2uZH2nUHJmovSUVnpQK8Jq4N7f4zLXwSf9O+Pzms dcce/J1B2+frCVzf0sVk6iIx983LGuj+D5GJiapP5D0RbTr/HTnL87xBi4voazvrUlh6 NMZguOeHLHxCzytN/N0LQ7RN59zM1D5du8Nt7Dn4L1maeAM3EvvTfpYfNP05f6N4HXG/ Qy9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="VdOH/ZmZ"; 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 r7-v6si16946199pga.77.2018.08.01.11.33.32; Wed, 01 Aug 2018 11:33:47 -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="VdOH/ZmZ"; 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 S1733084AbeHAUTF (ORCPT + 99 others); Wed, 1 Aug 2018 16:19:05 -0400 Received: from mail-pl0-f68.google.com ([209.85.160.68]:46054 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732623AbeHAUTE (ORCPT ); Wed, 1 Aug 2018 16:19:04 -0400 Received: by mail-pl0-f68.google.com with SMTP id j8-v6so9185801pll.12 for ; Wed, 01 Aug 2018 11:32:02 -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=iVO74wCV0EWaGwHK362LJP9PGuz2nnGv1IDmpsU7ky0=; b=VdOH/ZmZTfj5hOGhhlnrJJx6fcRM20urlTukUW4NLlSK/Ab0DZFA2LMk2HlSt5/DpK EHpabzHQ4arIwj3BNxAe676TxnQ3r6ggOdM73bxo7OI6b5I0ukJfzBRy2ScSngprE4Ge Rrtv9G3vw2foFlqbD8Jr8W993yEF4d1at4TOUAtRSTdcJ7FCmabdBEfUZnGQjgNo4fPO typS8p+TObZHNmdCEnV1WOTyL2+4pBvcz63Gg299TLazCOoxbv/M+dTafA7PCvRxHZ0K PUOY1y1/jBfD1N1eFnRhCZ4Qac3d4UEYELkmed0Ud6K8U6Win6cdBtQ9BUVZgkqDBIQ9 eyvg== 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=iVO74wCV0EWaGwHK362LJP9PGuz2nnGv1IDmpsU7ky0=; b=c5brmgy1Avaw2KMorE78wAJU/6fLyvMLNY1nl+JaQmHQi9e5wlgNDcX0D3vcD25wCS n8ombLJKj6V37tkeY00ZSrgQ2603dxYJ8BIDIp1mnoYZhMF+fdWpnRSvnzEo7vBH/GNp 0jLug1JOCnoG7cF/hTFKJbdeYWvG1OIksNvXN4PijUm/3E1gG2CrO6F3bQ1WHnFhK/Hx hUo7CTkndDMqt8l0PQl61vXNMmiV2u14cftnvDnIMwv1LNXGMOgQlPWoBBuRusZPs4Nb 0sinh8SHgQeVy2ITebQ2s9UGXcxYqMN3OZ2jADZ4NZ30x9zCkO3r/9I3D27KovnofMPq xtBQ== X-Gm-Message-State: AOUpUlEAJX4sPzW7KM8h/TI0uH/qBten3HsOptPx3b+qEIP0Xa400wXz cBoj4NF0Ine8UDkHBYJNj7Q+tw== X-Received: by 2002:a17:902:1121:: with SMTP id d30-v6mr26186445pla.247.1533148322061; Wed, 01 Aug 2018 11:32:02 -0700 (PDT) Received: from [100.112.75.99] ([104.133.8.99]) by smtp.gmail.com with ESMTPSA id 77-v6sm22281821pga.40.2018.08.01.11.32.00 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 01 Aug 2018 11:32:00 -0700 (PDT) Date: Wed, 1 Aug 2018 11:31:52 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@eggly.anvils To: Linus Torvalds cc: Tony Luck , "Kirill A. Shutemov" , Amit Pundir , John Stultz , Hugh Dickins , Matthew Wilcox , "Kirill A. Shutemov" , Andrew Morton , Dmitry Vyukov , Oleg Nesterov , Andrea Arcangeli , Greg Kroah-Hartman , linux-mm , Linux Kernel Mailing List , youling 257 , Joel Fernandes , Colin Cross Subject: Re: Linux 4.18-rc7 In-Reply-To: Message-ID: References: <20180730130134.yvn5tcmoavuxtwt5@kshutemo-mobl1> <20180731170328.ocb5oikwhwtkyzrj@kshutemo-mobl1> <20180731174349.GA12944@agluck-desk> 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 Wed, 1 Aug 2018, Linus Torvalds wrote: > > Anyway, the upshot of all this is that I think I know what the ia64 > problem was, and John sent the patch for the ashmem case, and I'm > going to hold off reverting that vma_is_anonymous() false-positives > commit after all. I'd better send deletion of zap_pmd_range()'s VM_BUG_ON_VMA(): below (but I've no proprietorial interest, if you prefer to do your own). John's patch is good, and originally I thought it was safe from that VM_BUG_ON_VMA(), because the /dev/ashmem fd exposed to the user is disconnected from the vm_file in the vma, and madvise(,,MADV_REMOVE) insists on VM_SHARED. But afterwards read John's earlier mail, drawing attention to the vfs_fallocate() in there: I may be wrong, and I don't know if Android has THP in the config anyway, but it looks to me like an unmap_mapping_range() from ashmem's vfs_fallocate() could hit precisely the VM_BUG_ON_VMA(), once it's vma_is_anonymous(). (I'm not familiar with ashmem, and I certainly don't understand the role of MAP_PRIVATE ashmem mappings - hole-punch's zap_pte_range() should end up leaving any anon pages in place; but the presence of the BUG is requiring us all to understand too much too quickly.) [PATCH] mm: delete historical BUG from zap_pmd_range() Delete the old VM_BUG_ON_VMA() from zap_pmd_range(), which asserted that mmap_sem must be held when splitting an "anonymous" vma there. Whether that's still strictly true nowadays is not entirely clear, but the danger of sometimes crashing on the BUG is now fairly clear. Signed-off-by: Hugh Dickins --- mm/memory.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) --- 4.18-rc7/mm/memory.c 2018-06-16 18:48:22.041173422 -0700 +++ linux/mm/memory.c 2018-08-01 11:01:21.397286507 -0700 @@ -1417,11 +1417,9 @@ static inline unsigned long zap_pmd_rang do { next = pmd_addr_end(addr, end); if (is_swap_pmd(*pmd) || pmd_trans_huge(*pmd) || pmd_devmap(*pmd)) { - if (next - addr != HPAGE_PMD_SIZE) { - VM_BUG_ON_VMA(vma_is_anonymous(vma) && - !rwsem_is_locked(&tlb->mm->mmap_sem), vma); + if (next - addr != HPAGE_PMD_SIZE) __split_huge_pmd(vma, pmd, addr, false, NULL); - } else if (zap_huge_pmd(tlb, vma, pmd, addr)) + else if (zap_huge_pmd(tlb, vma, pmd, addr)) goto next; /* fall through */ }