Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp4032153imm; Mon, 6 Aug 2018 15:27:37 -0700 (PDT) X-Google-Smtp-Source: AAOMgpepnVKL/lq7CUgTwED9KKWtkA+IlsI9BRIh97TSsP4SP3jRPUxrbAJrqZCy2HQYi2BbYG+V X-Received: by 2002:a62:e813:: with SMTP id c19-v6mr18822553pfi.124.1533594457864; Mon, 06 Aug 2018 15:27:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533594457; cv=none; d=google.com; s=arc-20160816; b=t0W/00+2tqIZ994KB3NxgFSPSaohAo/MyzakcPiECuHqI40/raI3ngJ/BmAW9O+QPC PMNpY1x4YNlt8lI7Opr3rLNFwb33R9FTn2j99Hz1wxsTmjEQwY0nyGnBfeBX486ssB07 EemCUzSvECFg8Y9fVj3jml0clsyRTrGNkNe8ziqE+/pOm7vUd20asQcI4D5AZq0zqLkA UKxFzYkkVrmisdtKyxyJYzRxUVdpZKSYFAwz0YIY+PnaP7ZUZMXyXAt6F/jFWHKzqVH9 5RYM0q3jKQDQQqckEwzGy1/GAPYSwn3euFpDofT3MDapJlOv52u/w+biRr5a20zhCPb0 q3Pw== 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=de6n4oevVKwaPcR6S1sA2YOT7boURGI4pEZFcMBuzVg=; b=d/qX8GnmSIwAb0H3F+NEfQhaJVctMWi/mGpyOK16XTlEk7b+83yvO2419fQCGw+HmL 0vOR4e90Ze9tHjq8UvmC6N/DeQ91XcGDjVjuARerZwpGe7pQRS0BVw00qKxM/TNjPsek Sz8KS9xH55ahtOoejMES3zWG0/JKLgaMyS6cTie41T1GVshwudBpqIrofQmk2qBvltqX AzG6njZX1MHwwVIqaOpXPphANVsUtdjuVbo4ueWCgsLRgebn6ruCH4459G9dCsik7HY5 eUbMi7yHeAXN6kjLDtz30xOZfavkCuoXS9rWcKHcKFMC2r+/s+ply1OY7FCAeIVur5SP ZxJw== 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 o19-v6si14140568pgl.212.2018.08.06.15.27.11; Mon, 06 Aug 2018 15:27: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; 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 S1731300AbeHFXDY (ORCPT + 99 others); Mon, 6 Aug 2018 19:03:24 -0400 Received: from mx2.suse.de ([195.135.220.15]:43270 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727665AbeHFXDY (ORCPT ); Mon, 6 Aug 2018 19:03:24 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id A94FBAD8B; Mon, 6 Aug 2018 20:52:33 +0000 (UTC) Date: Mon, 6 Aug 2018 22:52:32 +0200 From: Michal Hocko To: Yang Shi Cc: willy@infradead.org, ldufour@linux.vnet.ibm.com, kirill@shutemov.name, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [RFC v6 PATCH 2/2] mm: mmap: zap pages with read mmap_sem in munmap Message-ID: <20180806205232.GN10003@dhcp22.suse.cz> References: <1532628614-111702-1-git-send-email-yang.shi@linux.alibaba.com> <1532628614-111702-3-git-send-email-yang.shi@linux.alibaba.com> <20180803090759.GI27245@dhcp22.suse.cz> <20180806094005.GG19540@dhcp22.suse.cz> <76c0fc2b-fca7-9f22-214a-920ee2537898@linux.alibaba.com> <20180806204119.GL10003@dhcp22.suse.cz> <28de768b-c740-37b3-ea5a-8e2cb07d2bdc@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <28de768b-c740-37b3-ea5a-8e2cb07d2bdc@linux.alibaba.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 06-08-18 13:48:35, Yang Shi wrote: > > > On 8/6/18 1:41 PM, Michal Hocko wrote: > > On Mon 06-08-18 09:46:30, Yang Shi wrote: > > > > > > On 8/6/18 2:40 AM, Michal Hocko wrote: > > > > On Fri 03-08-18 14:01:58, Yang Shi wrote: > > > > > On 8/3/18 2:07 AM, Michal Hocko wrote: > > > > > > On Fri 27-07-18 02:10:14, Yang Shi wrote: > > [...] > > > > > > > If the vma has VM_LOCKED | VM_HUGETLB | VM_PFNMAP or uprobe, they are > > > > > > > considered as special mappings. They will be dealt with before zapping > > > > > > > pages with write mmap_sem held. Basically, just update vm_flags. > > > > > > Well, I think it would be safer to simply fallback to the current > > > > > > implementation with these mappings and deal with them on top. This would > > > > > > make potential issues easier to bisect and partial reverts as well. > > > > > Do you mean just call do_munmap()? It sounds ok. Although we may waste some > > > > > cycles to repeat what has done, it sounds not too bad since those special > > > > > mappings should be not very common. > > > > VM_HUGETLB is quite spread. Especially for DB workloads. > > > Wait a minute. In this way, it sounds we go back to my old implementation > > > with special handling for those mappings with write mmap_sem held, right? > > Yes, I would really start simple and add further enhacements on top. > > If updating vm_flags with read lock is safe in this case, we don't have to > do this. The only reason for this special handling is about vm_flags update. Yes, maybe you are right that this is safe. I would still argue to have it in a separate patch for easier review, bisectability etc... -- Michal Hocko SUSE Labs