Received: by 10.213.65.68 with SMTP id h4csp819911imn; Thu, 22 Mar 2018 09:14:23 -0700 (PDT) X-Google-Smtp-Source: AG47ELs0s/EHtUAXaYitnoqGvusI5abJmyaT36oxpuH0LS7dCD8b2Kp4kTeiZ5VDrl7sX9XDNjsK X-Received: by 10.99.126.72 with SMTP id o8mr18351834pgn.256.1521735262999; Thu, 22 Mar 2018 09:14:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521735262; cv=none; d=google.com; s=arc-20160816; b=ZbLy8uJ2cjPvB+FmHz8BXbAY7o+gZ/VBTUT8NzG23jEetXwJP6/fHx7aplpY6AjuD3 xVHKX0AhK6VWap9r5PRVUehTOeAGKyzm70SBlACp5ILwcf9j2+YluXQoArPALXyEGqT4 6po4wgoidv2cOKfxrAGyy/mpl4dfn6UjQwtkPleVprli/z4xoFX4FdrIBWLrndAAleoH JvLuuiXqIJR6E7f7SHYactzZ2PJBw5fFUlL4UvnO170BZHD5SVf+eCZ+qWbzpSbuYueb iDqz+OUZkdBlSd/27Wi88upoDg0Z5VuyHTpSOfuNa3Vh0B0s4zHGyn3hDKp1YS+E41Zi JaAw== 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=o1csonxzBZbK3m4l00xq4OXYHiuFp39biBMHihmNjTg=; b=cagTY2tOVw3ZutGkwCB73imTaGgzeoZw9dPIzZnGdfV3H5u84pyj1hf8W9TI0/Eg7Z +27kwcXWssxi3yAO/9cedDVms9NtaNYiQs7RKeUgfpBo8Vv66TaQ+a2IfW7rzR6V8YGU fZ51TTRzUGM1+po3tFQgr2EnElqC4GhSVPsL/1lBf1t2YcsNqbp7AhxF+2kh6kTNuZYE MuX9I7yOtQOTXVMOL2qlX1YfW8jCQfVebXPmId2Mc7F+yZuEQRFZCxE5MYkc7komzmRd xH6MFBHAVB2SHhIQorVhx3qaja+LpXiCiA3Dr+3WNts808/GteclQfcu3Tjxq0rESQeK Hxew== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b18si4043459pfl.100.2018.03.22.09.14.08; Thu, 22 Mar 2018 09:14:22 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751868AbeCVQMt (ORCPT + 99 others); Thu, 22 Mar 2018 12:12:49 -0400 Received: from mx2.suse.de ([195.135.220.15]:54906 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751667AbeCVQMs (ORCPT ); Thu, 22 Mar 2018 12:12:48 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id C29AAAFC8; Thu, 22 Mar 2018 16:12:46 +0000 (UTC) Date: Thu, 22 Mar 2018 17:12:46 +0100 From: Michal Hocko To: Yang Shi Cc: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH 1/8] mm: mmap: unmap large mapping by section Message-ID: <20180322161246.GG23100@dhcp22.suse.cz> References: <1521581486-99134-1-git-send-email-yang.shi@linux.alibaba.com> <1521581486-99134-2-git-send-email-yang.shi@linux.alibaba.com> <20180321131449.GN23100@dhcp22.suse.cz> <8e0ded7b-4be4-fa25-f40c-d3116a6db4db@linux.alibaba.com> <20180321212355.GR23100@dhcp22.suse.cz> <952dcae2-a73e-0726-3cc5-9b6a63b417b7@linux.alibaba.com> <20180322091008.GZ23100@dhcp22.suse.cz> <8b4407dd-78f6-2f6f-3f45-ddb8a2d805c8@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8b4407dd-78f6-2f6f-3f45-ddb8a2d805c8@linux.alibaba.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 22-03-18 09:06:14, Yang Shi wrote: > > > On 3/22/18 2:10 AM, Michal Hocko wrote: > > On Wed 21-03-18 15:36:12, Yang Shi wrote: > > > > > > On 3/21/18 2:23 PM, Michal Hocko wrote: [...] > > > > pages and that is quite easy to move out of the write lock. That would > > > > be an improvement already and it should be risk safe. If even that is > > > > not sufficient then using range locking should help a lot. There > > > > shouldn't be really any other address space operations within the range > > > > most of the time so this would be basically non-contended access. > > > It might depend on how the range is defined. Too big range may lead to > > > surprisingly more contention, but too small range may bring in too much > > > lock/unlock operations. > > The full vma will have to be range locked. So there is nothing small or large. > > It sounds not helpful to a single large vma case since just one range lock > for the vma, it sounds equal to mmap_sem. This is not how the range locking works. If we have a range lock per mm then exclusive ranges are not contending. So if you are unmapping one vma and want to create a new mapping or fault into a different range then you are basically lockless. -- Michal Hocko SUSE Labs