From patchwork Tue Sep 11 20:58:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Shi X-Patchwork-Id: 10596317 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B838B112B for ; Tue, 11 Sep 2018 20:58:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A8F6A29DCA for ; Tue, 11 Sep 2018 20:58:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9D19429DD2; Tue, 11 Sep 2018 20:58:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3E06629DCA for ; Tue, 11 Sep 2018 20:58:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 11BC28E0007; Tue, 11 Sep 2018 16:58:46 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 0DAFA8E0008; Tue, 11 Sep 2018 16:58:46 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EAE3B8E0007; Tue, 11 Sep 2018 16:58:45 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf1-f197.google.com (mail-pf1-f197.google.com [209.85.210.197]) by kanga.kvack.org (Postfix) with ESMTP id A9B788E0001 for ; Tue, 11 Sep 2018 16:58:45 -0400 (EDT) Received: by mail-pf1-f197.google.com with SMTP id v9-v6so13446710pff.4 for ; Tue, 11 Sep 2018 13:58:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references; bh=BKnBaTX8iefsbR3W8x30Vgm3fDP89JaoPoxTGit5Fvo=; b=pKhCYQ2lJ2vdLKX+uKnPR59Og6TE5f5RIoNFn/cebTs1zNG5uNr12TcniCh7GvRu6v tvq6KtL00kx6G2d+fZ7PT6lCk5uYiKL0ebf7GBDw2fHj2jrNpHV/r1mUopJ5ZZntXgcf w/NiGjRr+aWn84p+mYAVTWmo2ihvWIoRn5+NRKOTpQy90ydkEZPJ+X2g+4X0ktF5snvc mjEWNMN+TykeEQYGjjac5Ein0Ar+RA6Nj+CSnQa/BAnvK8qXUrqq0XgvREz38c+5d8/b 9Pmh/WLT+DVSf0NmmC109WhVcem0a3CtqHp/3jJBbbG+Ab+fQB9QWOWT/2qG3AlAMD3d Lggw== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of yang.shi@linux.alibaba.com designates 115.124.30.131 as permitted sender) smtp.mailfrom=yang.shi@linux.alibaba.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alibaba.com X-Gm-Message-State: APzg51CLNEkhziPP2EYh7iQjc3ubRvbNS0AcEckSzI39uZvpDic/IcsQ 9GzVP/SBUjF2eW0D7e2ASJH/wjvkvjJiwCJ9JJZi2adMg6+yk7UgMkHE4DJ55ytrJva9S30E2zf vwfxsv7fzQs9bTv456VtiTsvOJ/laqAqI3YpG7K2eBvHZ7ntOioS51yvv8GNRpOfXgQ== X-Received: by 2002:a63:28c7:: with SMTP id o190-v6mr30199634pgo.84.1536699525363; Tue, 11 Sep 2018 13:58:45 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbTTb+SFYXU6OJW/bn7vNF6ftWYjGUyG/8iyZ6dn5S70oyDI8slzHeZ0w4Ke+agwKJyz+mE X-Received: by 2002:a63:28c7:: with SMTP id o190-v6mr30199598pgo.84.1536699524506; Tue, 11 Sep 2018 13:58:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536699524; cv=none; d=google.com; s=arc-20160816; b=dipMsI8qGPs7I9BaIaqM4arGKxsRSh0IgozMDa5NZrbAac8za/6lrES/u6GqLlhrxb 5LfFwaPg7XVPUGYFuxQUV0qJZuvP1miQoztL54ffBjKzBMe2x5eu36uhJ5N/O0ezdSlR Cm3utAWMFOBEqQcekEfw4mUhH4vWfa3cheCaD84onRTXtPuGH0syQHPWt/7l47Mu39Ub cT2f1aaXSxhUlarMg2qeSZJRmCtLvQl+X/DBfwx01U+m19CzY0jKNw8EiUX0tFLFhewK t+V0KIi0GCbGfzNW+t3IybmS5u1Ox5tFnViEpreM6PKAll6A2vttYfHG3AoTnYCl35WP vZlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from; bh=BKnBaTX8iefsbR3W8x30Vgm3fDP89JaoPoxTGit5Fvo=; b=bGC+FFiQqJqHrsyOKWoSzWONBBYiGa3hlkcmVIdkkag3J/BZdMDa8zOnbkvYGCC5IS ZAR4QIqjKh+oDZ8l4T/ocC37PeJ5m1pp5ZXRjwwUrU+q6+JdQ1f5bMTHBPYdHzyRw0zr fKxs0CLG3zmC+3T4MbF5Ex8ea5PGzdUyKqPG20lZEBCj+gpHiHAuJkq/lsZaW0DCDpXJ LOkko7YT5k2bUI2X0QwFST7d5Kkfri+9yggJZgcnOhTvCOqBOZIrVC9KcyWA3AbxlIc5 OBMLh9CUJtKDqB+vW5T0RO+xUosNLXUYpA/bUncwCG0mWm5ZhajhoxN56J/SJNbJXRNI zi5w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of yang.shi@linux.alibaba.com designates 115.124.30.131 as permitted sender) smtp.mailfrom=yang.shi@linux.alibaba.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from out30-131.freemail.mail.aliyun.com (out30-131.freemail.mail.aliyun.com. [115.124.30.131]) by mx.google.com with ESMTPS id ca2-v6si22871796plb.305.2018.09.11.13.58.43 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Sep 2018 13:58:44 -0700 (PDT) Received-SPF: pass (google.com: domain of yang.shi@linux.alibaba.com designates 115.124.30.131 as permitted sender) client-ip=115.124.30.131; Authentication-Results: mx.google.com; spf=pass (google.com: domain of yang.shi@linux.alibaba.com designates 115.124.30.131 as permitted sender) smtp.mailfrom=yang.shi@linux.alibaba.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alibaba.com X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R181e4;CH=green;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e01451;MF=yang.shi@linux.alibaba.com;NM=1;PH=DS;RN=11;SR=0;TI=SMTPD_---0T8Sg6Yy_1536699501; Received: from e19h19392.et15sqa.tbsite.net(mailfrom:yang.shi@linux.alibaba.com fp:SMTPD_---0T8Sg6Yy_1536699501) by smtp.aliyun-inc.com(127.0.0.1); Wed, 12 Sep 2018 04:58:30 +0800 From: Yang Shi To: mhocko@kernel.org, willy@infradead.org, ldufour@linux.vnet.ibm.com, vbabka@suse.cz, akpm@linux-foundation.org, dave.hansen@intel.com, oleg@redhat.com, srikar@linux.vnet.ibm.com Cc: yang.shi@linux.alibaba.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [RFC v9 PATCH 3/4] mm: unmap VM_HUGETLB mappings with optimized path Date: Wed, 12 Sep 2018 04:58:12 +0800 Message-Id: <1536699493-69195-4-git-send-email-yang.shi@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1536699493-69195-1-git-send-email-yang.shi@linux.alibaba.com> References: <1536699493-69195-1-git-send-email-yang.shi@linux.alibaba.com> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP When unmapping VM_HUGETLB mappings, vm flags need to be updated. Since the vmas have been detached, so it sounds safe to update vm flags with read mmap_sem. Cc: Michal Hocko Cc: Vlastimil Babka Signed-off-by: Yang Shi --- mm/mmap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/mmap.c b/mm/mmap.c index 937d2f2..086f8b5 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -2812,12 +2812,12 @@ static int do_munmap_zap_rlock(struct mm_struct *mm, unsigned long start, } /* - * Unmapping vmas, which have VM_HUGETLB or VM_PFNMAP + * Unmapping vmas, which have VM_PFNMAP * need get done with write mmap_sem held since they may update * vm_flags. Deal with such mappings with regular do_munmap() call. */ for (vma = start_vma; vma && vma->vm_start < end; vma = vma->vm_next) { - if (vma->vm_flags & (VM_HUGETLB | VM_PFNMAP)) + if (vma->vm_flags & VM_PFNMAP) goto regular_path; }