From patchwork Wed Aug 15 18:49:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Shi X-Patchwork-Id: 10566749 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 85C6A109C for ; Wed, 15 Aug 2018 18:50:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 59E1D2AF00 for ; Wed, 15 Aug 2018 18:50:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 578FF2AF4F; Wed, 15 Aug 2018 18:50:29 +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 E31F02AF37 for ; Wed, 15 Aug 2018 18:50:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CDAB26B000D; Wed, 15 Aug 2018 14:50:23 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id C62636B0010; Wed, 15 Aug 2018 14:50:23 -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 AB6166B000D; Wed, 15 Aug 2018 14:50:23 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pl0-f72.google.com (mail-pl0-f72.google.com [209.85.160.72]) by kanga.kvack.org (Postfix) with ESMTP id 4FA066B000A for ; Wed, 15 Aug 2018 14:50:23 -0400 (EDT) Received: by mail-pl0-f72.google.com with SMTP id 33-v6so1124630plf.19 for ; Wed, 15 Aug 2018 11:50:23 -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=r4uNaHCCdvFcps3AE+6NmK5z1ocDktKQXStql8Qqpwg=; b=EZa7vdGVpAUBGRSSpiSbsI49jyzmoSvyZiDamu48a1mkMGJH4uyO+vshjKVmQ6AgBE lej7sad4PQTQNXgRQA7GPlGy5SegdO0EdbFfgY7F6HhczWdDKX5YF12GP3nOA/MGNAYH k/DpK3DO6J+aXSc9eMXRCAsf6uxCGDopFIU52j4QM1j0aQsmqUKc7IC6gRt7Sqa3QBFA FF7b1hst/qE3ckkVfeBcUX4O8KAZXAqDtYkp/P5BgpFEOkUqmYO0Qv5fMoPJDhQWaxVQ +vTwvjo3RbMvJr3Mp/BXqHNuUYoD87FTh6mVbpPUwPkRm+Q7rrq5qAuQyhnhgI4m9cNx x/9w== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of yang.shi@linux.alibaba.com designates 115.124.30.132 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: AOUpUlF7yFR5pBuvHFnrOq3aHSdwKFYmFoSqQT1JmJakBguE1LnG/+Co 7sPfXa3my3AHV4RMbXO1WkgYwqNk4a4CKm3WVeACfKjhSfCd5LciHQ1yumUS2Ff0ve7wCC89kAS 5EozGSpc5StiV0GwjbNhHB/4sKUwElnEXR79Rz4v3YQhFHALwJb6ruX+THSbmc17tpw== X-Received: by 2002:a63:66c7:: with SMTP id a190-v6mr26034185pgc.411.1534359023014; Wed, 15 Aug 2018 11:50:23 -0700 (PDT) X-Google-Smtp-Source: AA+uWPxb1v3r2nQsiDVLSXfheSGyPDoDSt1+xy6oCZGZytayhFzxMnuqG7rCrvvSU9GIxdp8yxPz X-Received: by 2002:a63:66c7:: with SMTP id a190-v6mr26034154pgc.411.1534359022340; Wed, 15 Aug 2018 11:50:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534359022; cv=none; d=google.com; s=arc-20160816; b=qjDYRddOgyilekAJtdYV1/SbHO4i0tmaORa7ixWpqoVBSVpzvgWjR4D+IuDbBnlVRC 0oYTzuH7SpYCmGt+9efVvTTq6/CKYCtpRHKZCpIV0Sr5k5GkBLNK2LW90veWXt8T6Itw SQcxw/BIWsu9YUKc2qTemOkmtCdJyj/awhA8PVfTUkGnd0NCHitVT5zH98XWxxCNZ14i JDsSxaYJrv6Xt3yunertPYiXdyYy9mBZHPvQcWmhBWoQtKxK3yPZdU23LSuJJJ82jlpj 2aYJyEzgDAsIYppR5xKnQAzJJlAKR45PSbvpNbultQFh8fDTwYBydqgfa6f1A3fbwDkj guzg== 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 :arc-authentication-results; bh=r4uNaHCCdvFcps3AE+6NmK5z1ocDktKQXStql8Qqpwg=; b=eNUVhZWBh2JqOrBbMwJLGojtCk/OAPVbKwXtRNL7iuFjNISrY9F1RcR3VU1VuwL1O7 zsh3MwxIlewTsdsfCbmtcty0slz3yjZIxAjMiAqCxW5veaWx/g2ZqWO2IIzf/xGznb9M SP7ioI2M7oJb05h3CL8lXTPyTVJI93i29i0+VOIcNrgJRCqN+at7f6CiiGuzgTSRlIvU 8qKqvzGJFMlMmpp7u+LXu8NWnOa2zEq6tkAoat82d32mIOaO079iFHpKX0hq3lp+adJS 0q0NZAeIegDyDaXXkX4t0s20KAR3eTAqc4N1asdOOvvB1wjsvTbR5DNF0VgIlM9s5n4j vKLg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of yang.shi@linux.alibaba.com designates 115.124.30.132 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-132.freemail.mail.aliyun.com (out30-132.freemail.mail.aliyun.com. [115.124.30.132]) by mx.google.com with ESMTPS id y16-v6si19909316plr.469.2018.08.15.11.50.21 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 Aug 2018 11:50:22 -0700 (PDT) Received-SPF: pass (google.com: domain of yang.shi@linux.alibaba.com designates 115.124.30.132 as permitted sender) client-ip=115.124.30.132; Authentication-Results: mx.google.com; spf=pass (google.com: domain of yang.shi@linux.alibaba.com designates 115.124.30.132 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=01201311R121e4;CH=green;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01f04452;MF=yang.shi@linux.alibaba.com;NM=1;PH=DS;RN=15;SR=0;TI=SMTPD_---0T6gJtNa_1534358999; Received: from e19h19392.et15sqa.tbsite.net(mailfrom:yang.shi@linux.alibaba.com fp:SMTPD_---0T6gJtNa_1534358999) by smtp.aliyun-inc.com(127.0.0.1); Thu, 16 Aug 2018 02:50:08 +0800 From: Yang Shi To: mhocko@kernel.org, willy@infradead.org, ldufour@linux.vnet.ibm.com, kirill@shutemov.name, vbabka@suse.cz, akpm@linux-foundation.org, peterz@infradead.org, mingo@redhat.com, acme@kernel.org, alexander.shishkin@linux.intel.com, jolsa@redhat.com, namhyung@kernel.org Cc: yang.shi@linux.alibaba.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [RFC v8 PATCH 4/5] mm: unmap VM_HUGETLB mappings with optimized path Date: Thu, 16 Aug 2018 02:49:49 +0800 Message-Id: <1534358990-85530-5-git-send-email-yang.shi@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1534358990-85530-1-git-send-email-yang.shi@linux.alibaba.com> References: <1534358990-85530-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 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mm/mmap.c b/mm/mmap.c index e92f680..3b9f734 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -2812,7 +2812,6 @@ static int do_munmap_zap_rlock(struct mm_struct *mm, unsigned long start, /* * Unmapping vmas, which have: - * VM_HUGETLB or * VM_PFNMAP or * uprobes * need get done with write mmap_sem held since they may update @@ -2821,7 +2820,7 @@ static int do_munmap_zap_rlock(struct mm_struct *mm, unsigned long start, for (vma = start_vma; vma && vma->vm_start < end; vma = vma->vm_next) { if ((vma->vm_file && has_uprobes(vma, vma->vm_start, vma->vm_end)) || - (vma->vm_flags & (VM_HUGETLB | VM_PFNMAP))) + (vma->vm_flags & VM_PFNMAP)) goto regular_path; }