From patchwork Wed Sep 19 17:03:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Shi X-Patchwork-Id: 10606107 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 D5EC86CB for ; Wed, 19 Sep 2018 17:04:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C316D2B9F7 for ; Wed, 19 Sep 2018 17:04:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B72272BB1E; Wed, 19 Sep 2018 17:04:13 +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 AD4852B9F7 for ; Wed, 19 Sep 2018 17:04:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 82BD88E0003; Wed, 19 Sep 2018 13:04:11 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 801C78E0001; Wed, 19 Sep 2018 13:04:11 -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 717558E0003; Wed, 19 Sep 2018 13:04:11 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pg1-f198.google.com (mail-pg1-f198.google.com [209.85.215.198]) by kanga.kvack.org (Postfix) with ESMTP id 577178E0001 for ; Wed, 19 Sep 2018 13:04:11 -0400 (EDT) Received: by mail-pg1-f198.google.com with SMTP id d132-v6so2639189pgc.22 for ; Wed, 19 Sep 2018 10:04:11 -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=xdnos7vRlVVKJr+Ky5LsaNLAjZ61PdbGqKs7xXS0Qa8=; b=E5UlpizN6LstGVwaBWFK+xUP9D/4UKiTUZC32viHOfZg+02FZkyausYiL/2KtwFuOW V62sNOj3m4QJvNpFK8Kb109uiEiiApUxn+ugAKMk0bo05hSo/DP2uTGKt1NVn2gsTv1Q HMST52soYdikETFS66sqlYw16qcFfiJtMuHQdP19TtcT6YvlwJiw6FmmtlpRu3tlU1O/ FKTYbPMj/+R62PwFBVS2dXpxd6uPehc45AR9ms2hntl7IJrH1AcxHei7Cp1P19DqkZUY 3a7xw8mpj6nMmY/WQGtan3pNmxxz7M6SIeNDMPVaubD3ML05z9AaIe9QgbiXtZzqgHb3 jU7w== 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: APzg51BkNWatw8PnNA7ipWSqSr8BRgxU+iNrVJ9+9eACjjszfqtSH0Se 7YvWTfW7F318+nGqilZT+gSexWaZcU1mW5QRsiJP5PESD4aGIS5iLgJxHSlU5TI05RpXsif/RgP z+ltTruTOKC+9SGqqRTJNONN0iKmMYN8BQc9Fae4hFXhvvNV1/Kyyx67SeW4YIgm9yw== X-Received: by 2002:a63:e647:: with SMTP id p7-v6mr31980783pgj.218.1537376651047; Wed, 19 Sep 2018 10:04:11 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbRUkzM/s0cCBbMO660AvFfwrdyNuaYAjbAfZDmmfOBzoV8qWulOFx9UrMvFugufJE9vSm5 X-Received: by 2002:a63:e647:: with SMTP id p7-v6mr31980724pgj.218.1537376649806; Wed, 19 Sep 2018 10:04:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537376649; cv=none; d=google.com; s=arc-20160816; b=cF3sN5/HTTFx/WKT+J2pk1tUWtlX5SdF1UOWQyXyL55L+vbGVTSxV2fphJkO8o4brn a5VOGNi11gEJh6pcSH2tbZVrRBt0xkykQ0dQYBivkVQ6lGQ9KH55W2RolCxpJYz0HzaI X8c27mFouo72v9DSWle2vcGAaaGTjlI93XpFLRVcv86ZVzrTHaEfxFld7aq9d4soe3r2 buwfh1nqCDUOuaP+sIxSNLLyqHDIZev1z7XLjU1BLcE0Ul3ZrXr8Pw36efyKbpR54jaW FPfP+ro44dbU4bHyPnSkOXIoi+/NiDe+AbYSpFEILaBLkqVRD5Wg44M2tDVS9lt/n4jY IaoA== 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=xdnos7vRlVVKJr+Ky5LsaNLAjZ61PdbGqKs7xXS0Qa8=; b=BA6tf+tQtIdwh6/BtjnnnvXGaiShtvqBh3POBMSj+RfaVl0fQxSef/rDIC8/DakWNI jSAjpZXJbqZpPg1ERtmAI43PmBCDgq1P0yqE0YTZcHOvte2hy3ioY17/46f8L5hErd2E iTIOJXjbggGHPRRwsadggOgQb4Yy0U+lMIbQ3IDnDt+YlHt6/nenJGX3keU9U4DG+SAQ yk4c9ka5XXCynTeuV3kbET2hHKJbFIVrHeT5Pv79uiQAd1zPCPGkUdSzOEQAJENgYYZF jpD4B85k99uCjMl2MR6XrGDUn8Cca21+eKsjh676doLGwvP2JFCzTDPP+S4C2njO29jV Fsvw== 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 x3-v6si21452649pgo.542.2018.09.19.10.04.08 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Sep 2018 10:04:09 -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=01201311R121e4;CH=green;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e07488;MF=yang.shi@linux.alibaba.com;NM=1;PH=DS;RN=12;SR=0;TI=SMTPD_---0T91h4Va_1537376628; Received: from e19h19392.et15sqa.tbsite.net(mailfrom:yang.shi@linux.alibaba.com fp:SMTPD_---0T91h4Va_1537376628) by smtp.aliyun-inc.com(127.0.0.1); Thu, 20 Sep 2018 01:03:55 +0800 From: Yang Shi To: mhocko@kernel.org, willy@infradead.org, ldufour@linux.vnet.ibm.com, vbabka@suse.cz, kirill@shutemov.name, akpm@linux-foundation.org Cc: dave.hansen@intel.com, oleg@redhat.com, srikar@linux.vnet.ibm.com, yang.shi@linux.alibaba.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [v11 PATCH 2/3] mm: unmap VM_HUGETLB mappings with optimized path Date: Thu, 20 Sep 2018 01:03:40 +0800 Message-Id: <1537376621-51150-3-git-send-email-yang.shi@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1537376621-51150-1-git-send-email-yang.shi@linux.alibaba.com> References: <1537376621-51150-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 Reviewed-by: Matthew Wilcox Signed-off-by: Yang Shi Acked-by: Vlastimil Babka --- mm/mmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/mmap.c b/mm/mmap.c index 982dd00..490340e 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -2777,7 +2777,7 @@ static int __do_munmap(struct mm_struct *mm, unsigned long start, size_t len, * update vm_flags. */ if (downgrade && - (tmp->vm_flags & (VM_HUGETLB | VM_PFNMAP))) + (tmp->vm_flags & VM_PFNMAP)) downgrade = false; tmp = tmp->vm_next;