Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp3654867imm; Mon, 25 Jun 2018 02:17:16 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKGTF6uHhFsRIZFjWkdDHP5dTWfrWdHw9r6dFdEoo0IemnIT9YwX1e1Uw8ZAd6MSH+uogau X-Received: by 2002:a17:902:e10a:: with SMTP id cc10-v6mr2547267plb.100.1529918236161; Mon, 25 Jun 2018 02:17:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529918236; cv=none; d=google.com; s=arc-20160816; b=WwiHDib9USdoihmXQtGQOvsP2RXWifzV/iNThH7sBwx9T6RbDdbFwd1hcsqdvQThVA 1IvJVo1ifAU8AkFOk/RBrxvn/+X5U3M6UVEGGJ7bJO7pMUMCfzecWHeg7aI12o/sNFX4 3GkA6nJhxlHryWcQwzPr0x8RV7bAYWjCSeWamm860tR8x1yXMlV+y4c17IViYLUtRSDT YJRB5ulJ2oL5lxkMCf8supw2XXYvVQ/aK3cYVN/wK9MebXDt28QNDoR+8tMVZ3LL0UiV cqYsywTFUX42sstssQNTyJrzW540O1rKZrMQSPaX/B3OJ7fNfxKzBTb4dm3Dit0a4u7x +vQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=FYvQpio64y9Y2kNGOfJLTLJDeYxr0uAO79AQVCdnMVk=; b=rxhjrSoANndUIgkQr7Obix0xEySaBJcuLZVoLI7gJvm7KPTSbouUORVfFKEThE+k8d UIqqvXyGY7/R5nYWFBg6lF3dJEsZ8aGjoYO96Rd5mNH/KmlJ0O8e50/SAtC/QEOQ/j+C yZR4bdAwcWZ1snkS0OYdduF02NsSlBcGBjHgIjyL/WzgAJ5txfjRwQCegpdPzv2fwKU4 aIyfASfKjL3bT/WYIdbZQ6XcK3fRM85QwOhu8clO5P7qqLUFayoY5IBP9NuAV3UrkMuD WoT83F3AfOBBxMtAO+h2jOXOYComncBvJ6p0MDPS3f14EXWr80PeyNJbRVMOO1N4xsNF AMPA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e9-v6si865899plk.130.2018.06.25.02.17.01; Mon, 25 Jun 2018 02:17:16 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755023AbeFYJPB (ORCPT + 99 others); Mon, 25 Jun 2018 05:15:01 -0400 Received: from mx2.suse.de ([195.135.220.15]:56455 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755008AbeFYJO6 (ORCPT ); Mon, 25 Jun 2018 05:14:58 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext-too.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 24B59AB43; Mon, 25 Jun 2018 09:14:57 +0000 (UTC) Date: Mon, 25 Jun 2018 11:14:55 +0200 From: Michal Hocko To: Yang Shi Cc: Nadav Amit , Matthew Wilcox , ldufour@linux.vnet.ibm.com, Andrew Morton , Peter Zijlstra , Ingo Molnar , acme@kernel.org, alexander.shishkin@linux.intel.com, jolsa@redhat.com, namhyung@kernel.org, "open list:MEMORY MANAGEMENT" , linux-kernel@vger.kernel.org Subject: Re: [RFC v2 PATCH 2/2] mm: mmap: zap pages with read mmap_sem for large mapping Message-ID: <20180625091455.GH28965@dhcp22.suse.cz> References: <1529364856-49589-1-git-send-email-yang.shi@linux.alibaba.com> <1529364856-49589-3-git-send-email-yang.shi@linux.alibaba.com> <3DDF2672-FCC4-4387-9624-92F33C309CAE@gmail.com> <158a4e4c-d290-77c4-a595-71332ede392b@linux.alibaba.com> <20180620071817.GJ13685@dhcp22.suse.cz> <94bdfcf0-68ea-404c-a60f-362f677884b6@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <94bdfcf0-68ea-404c-a60f-362f677884b6@linux.alibaba.com> User-Agent: Mutt/1.9.5 (2018-04-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 22-06-18 18:01:08, Yang Shi wrote: > Yes, this is true but I guess what Yang Shi meant was that an userspace > > > access racing with munmap is not well defined. You never know whether > > > you get your data, #PTF or SEGV because it depends on timing. The user > > > visible change might be that you lose content and get zero page instead > > > if you hit the race window while we are unmapping which was not possible > > > before. But whouldn't such an access pattern be buggy anyway? You need > > > some form of external synchronization AFAICS. > > > > > > But maybe some userspace depends on "getting right data or get SEGV" > > > semantic. If we have to preserve that then we can come up with a VM_DEAD > > > flag set before we tear it down and force the SEGV on the #PF path. > > > Something similar we already do for MMF_UNSTABLE. > > > > Set VM_DEAD with read mmap_sem held? It should be ok since this is the > > only place to set this flag for this unique special case. > > BTW, it looks the vm flags have used up in 32 bit. If we really need > VM_DEAD, it should be for both 32-bit and 64-bit. Do we really need any special handling for 32b? Who is going to create GB mappings for all this to be worth doing? -- Michal Hocko SUSE Labs