Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2475711imm; Thu, 2 Aug 2018 12:13:38 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc/0KMk4SHZt3+x8GZd/F967S7ZTGk068pBtqjOvemPwaYMIHrdmgWjPTeFy/KwGT12LirX X-Received: by 2002:a62:87ce:: with SMTP id i197-v6mr842941pfe.62.1533237217936; Thu, 02 Aug 2018 12:13:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533237217; cv=none; d=google.com; s=arc-20160816; b=u+tARMlGXM5A3xYnD898JmdzN8JR45zDf7C1QV+LtsVLs/g8dNMtGTK7urIcbdgCLs /GdGmPqCbCCkr5G+F0Tt0mUXJzESH84mOzEJfltIsSud9aBOzm5AAFvUhZCXf2Qn4bEU Px7laa0GeGORedUuj2L71Im3uokxVgq3b096y7zInOaSGwiR8yU0D/exZS87imqrJ5fa FsKibCSt/1KgQwXyjgCQIP0tUQnjc6j4ag5bNwDiLH/0XDbYdy+JcqwB2wS0cXHs37ye SPgbWalS2VxEUT6MAmCicTye6T1EeIHUnVEji8bHPizJhd/xgqOD1mlGb5vcV90aExA2 aXhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=JIPtmhgglsF+MzK+Y1Sy9nxL1qQY8Frwl5nOkaV1+cQ=; b=LAtXClfe8Cv7kCv4dP8wpohHo6hIbHZGBrA64pbDAq4sy+9BiaVDvbPcj7uzao0BvT ytTkw9pTZQHi9g5//j2JguSQe+s2iJbEXxnxl36M2ZEPV3fcCtEDd1QFmtqbU5w9bKFL iWkL/SNI5+esvGm0rym7QLFhFCQX2Zkz+MiPzvayj/sUeWezmBY15QDtA4Jd5zyAeLAO ejzFAeqjsAjXNKyRYtaYpZlihIzorTBrtCPkYHuCAvupiA8uDZtYL+oYt9mUccxkYM7h BF0/ND/2E0RK5nFc3CkrwkoGFWpcLgreflr/z/FTG9aM/jQaeKUdOoPE+8Guv3RsAaVO r1IA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hBtfAMby; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f35-v6si2027249plh.50.2018.08.02.12.13.23; Thu, 02 Aug 2018 12:13:37 -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=@linaro.org header.s=google header.b=hBtfAMby; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729676AbeHBVE4 (ORCPT + 99 others); Thu, 2 Aug 2018 17:04:56 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:41261 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726673AbeHBVE4 (ORCPT ); Thu, 2 Aug 2018 17:04:56 -0400 Received: by mail-wr1-f65.google.com with SMTP id j5-v6so3167700wrr.8 for ; Thu, 02 Aug 2018 12:12:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=JIPtmhgglsF+MzK+Y1Sy9nxL1qQY8Frwl5nOkaV1+cQ=; b=hBtfAMbyZ30z8skC8WtDOyVO6C5bF4fWSpzp28ruYACre6EF2ORqtGC5ROrdmM2ccg xKSoeyWAD/E+rUhVi/E0l57xzM9BZ/i4SwYa6Qdbd6ockBQEi63ydc4izNCLJtXWrQn+ FI+dOLk9BJU7baDN1Jb7VnAPCTq2t/Zcb0qxc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=JIPtmhgglsF+MzK+Y1Sy9nxL1qQY8Frwl5nOkaV1+cQ=; b=pH9xPsgKawoxwrzrIDKk1AfdqwcCIFi75X2vU1s81TSHXatDtwDUxk9LBRtWMOakAe sdWKgrRBvnDGQpt5XEwLGSsaYhBcmg1MoMm9tEyf5gWFy2LKLrpN34WvnpkasQ20iKbD Dxy5rYIDQbUhzEOcAz156keghhBHKkWYte7HNBCRdZDwHz+92m4KosM0t/pVckDkG3t8 BOV8H/G8E4CJUjZkMh3PRfeVLy3Pm4RsrJWB+qu+VrITzNCKFWmrMkHsMccP47N1+hUf Xi6qriGbfxr+703InLNRx3HY2PgQwwslEMtd/qWZj0SM57GFHM6eA00PekZ3YHAYb47T Ol5A== X-Gm-Message-State: AOUpUlGltzJsDcDpx7ycYlrWKMzvDEfC665ltWsHgexXk8MH+h9iI3IZ EJeA67k32cvjX+TDFQAI4iGtxqUwKl0Qnihizvo3Gg== X-Received: by 2002:adf:b243:: with SMTP id y3-v6mr530542wra.90.1533237146645; Thu, 02 Aug 2018 12:12:26 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a1c:c243:0:0:0:0:0 with HTTP; Thu, 2 Aug 2018 12:12:24 -0700 (PDT) In-Reply-To: References: <20180731170328.ocb5oikwhwtkyzrj@kshutemo-mobl1> <20180731174349.GA12944@agluck-desk> <20180801205848.6mgcfux4b63svj3n@kshutemo-mobl1> From: John Stultz Date: Thu, 2 Aug 2018 12:12:24 -0700 Message-ID: Subject: Re: Linux 4.18-rc7 To: Hugh Dickins Cc: "Kirill A. Shutemov" , Linus Torvalds , Tony Luck , Amit Pundir , 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 Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 1, 2018 at 2:55 PM, Hugh Dickins wrote: > On Wed, 1 Aug 2018, Kirill A. Shutemov wrote: >> On Wed, Aug 01, 2018 at 11:31:52AM -0700, Hugh Dickins wrote: >> > 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). >> >> Agreed. >> >> Acked-by: Kirill A. Shutemov > > Thanks. > >> >> > 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.) >> >> Hugh, do you see any reason why ashmem shouldn't have vm_ops == >> shmem_vm_ops? > > I cannot immediately think of an absolute reason why not, but I'm > not giving it much thought; and that might turn it into a stranger > beast than it already is. > >> >> I don't understand ashmem, but I feel uncomfortable that we have this >> sneaky way to create an anonymous VMA. It feels wrong to me. > > I agree it's odd, but in this respect it's no odder than /dev/zero: > that has exactly the same pattern of shmem_zero_setup() for VM_SHARED, > else vma_set_anonymous(): which made me comfortable with John's patch, > restoring the way it worked before. > > Admittedly, the subsequent vfs_fallocate() might generate surprises; > and the business of doing a shmem_file_setup() first, and then undoing > it with a shmem_zero_setup(), looks weird - from John's old XXX comment, Yes, it is weird. :) > I think it was a quick hack to piece together some functionality they > needed in a hurry, which never got revisited (they wanted a name for > the area? maybe memfd would be good for that now). So my XXX comment is to do with a change I made to ashmem in order for it to go into staging, compared with the original Android implementation. They still carry the patch to undo it here: https://android.googlesource.com/kernel/common.git/+/ebfc8d6476a66dc91a1b30cbfc18e67d4401af09%5E%21/ But it has more to do w/ in the shared mapping case, providing a cleaner way of setting the vma->vm_ops = &shmem_vm_ops without having to use shmem_zero_setup(), and doesn't change the behavior in the private mapping case. This discussion has spurred Joel and I to chat a bit about reviving the effort to "properly" upstream ashmem. We're still in discussion but I'm thinking we might just try to add the pin/unpin functionality to memfd. We'll see how the discussion evolves. thanks -john