From patchwork Fri Sep 14 20:34:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Shi X-Patchwork-Id: 10601213 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 C6C45933 for ; Fri, 14 Sep 2018 20:35:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AE9582A6C1 for ; Fri, 14 Sep 2018 20:35:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A2A702BA53; Fri, 14 Sep 2018 20:35:34 +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 E4D882A6C1 for ; Fri, 14 Sep 2018 20:35:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E4CEE8E0004; Fri, 14 Sep 2018 16:35:32 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id DFC318E0001; Fri, 14 Sep 2018 16:35:32 -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 CEC2A8E0004; Fri, 14 Sep 2018 16:35:32 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pl1-f198.google.com (mail-pl1-f198.google.com [209.85.214.198]) by kanga.kvack.org (Postfix) with ESMTP id 9E8FC8E0001 for ; Fri, 14 Sep 2018 16:35:32 -0400 (EDT) Received: by mail-pl1-f198.google.com with SMTP id b6-v6so4831765pls.16 for ; Fri, 14 Sep 2018 13:35:32 -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=bUqtduUu3Gd8GjNLNmNtoVSTPH2DemyZc+Wdmdk61AM=; b=QOB/jfgBZExmFV9xITKFYHsy4K2T7fhSA/Blh+hw/G4mm84WiwPC4Ja/YeANB4ZKep w/xbWWL1lBHC46nOnWN29inuXvPP09D9QS7UdPi8x0grSMe6xHL9Euso9FKrautuzSST CXlzg4Z11e8wPdh8xQzrglARjlaSZkdItwII2aJ8mhAWFQa1My3V0vY4xozgPrr8kTc+ 2HoA8V9HzE1Uz0GFrbIrefjEIE+7S5xwwn1AjaX7v0ZxNgQyKo8xTKhj1Z+x21O5temL pgfSehgDFCnxTkSKQsGMlB5M98xcrGURMvb5xi1bSNBKyfThlfaBtK+5JOYYs6vHSX/R 2FQQ== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of yang.shi@linux.alibaba.com designates 115.124.30.133 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: APzg51CACh/JYrGD4iyHWOrVly/crDnR6knqrwG7IiY0P7BuPnSzIB59 iTDi966POR+qmqwVHWkz8wRHVQ3eIFxZSc90pg8zUVOqgD2eSDTEO31GVTS5taMxTBh3Qsk2c1Z /MWFGxGBG3QEYBs7AbxpDbizOvp9DTUH60w2Es4E6qq92DU2BdoXaaJuKdNFjttVpRg== X-Received: by 2002:a63:f44d:: with SMTP id p13-v6mr13743132pgk.257.1536957332300; Fri, 14 Sep 2018 13:35:32 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaS+moQ4uxqFu3CCFA0s8l3UMlCJWGb/4cgFf30zkmsxpruf4NUDbWh2RXdlw5oWA2xxEon X-Received: by 2002:a63:f44d:: with SMTP id p13-v6mr13743090pgk.257.1536957331042; Fri, 14 Sep 2018 13:35:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536957331; cv=none; d=google.com; s=arc-20160816; b=e7lQzC1+wdC1yHD60U1NapG+DZqRVqGAkuMl9MD0eDAqC9GLTUdWnQqGvV1NmWvZ2F O2uFeluLaBwUwKL7/4BFKLjj2LpcP5WeMWuapNVM5McNX3eOQW+zEb/HkvVdwTxU3uqN 0u9R4InVcD3harmYkZYEg3Eyju8merckAqfXyW7y4aZl63X2N2OBozeH0vAQFd3+/rcH FDp2UCcO8+kV8wHPbxK/CL5Gmg63p72z3zZ+8LVoTr6uoUHgwAqtZUN5yjUiMAV4s8Ud GPaW5BZOs1KAE5tPjR11yDr4VKh/NxVMzA2vJFk23QEDu48qQdj74DRThdaaHFveZi3o lU2Q== 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=bUqtduUu3Gd8GjNLNmNtoVSTPH2DemyZc+Wdmdk61AM=; b=JBPlHqhoFK5FtXa1fIFALhQpJMVnuEyFsuc7U9uJr4d0dmuJ96KrGlgCwSkXgAMgbS /tgR4SJKrENi2FDPyDiQHQknO7ETtqs+RuY0H3YUNMQpvdBnvf+ZVk7h1/DzvMDmDs/e PoSoOclwQwntIcJM7zgMe5RCKwLO8tI6v84yy8/WtLXpaGokx4zXSvYm45iKuHLthPg7 EmRo7jysp9VZAAQub1Cy9/uWnTCbOFJ7yUsmTbASsALXPUsWiysO0Qnv8m3e5QJI26qv Tg4UM3FotpXjje3sQ5Wz31s6VBsbdfxjfQ95o1sfabSJhC6ssFz1awr+ekpRZuE/Bqm8 SPTA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of yang.shi@linux.alibaba.com designates 115.124.30.133 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-133.freemail.mail.aliyun.com (out30-133.freemail.mail.aliyun.com. [115.124.30.133]) by mx.google.com with ESMTPS id a9-v6si8184601pgj.224.2018.09.14.13.35.30 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Sep 2018 13:35:31 -0700 (PDT) Received-SPF: pass (google.com: domain of yang.shi@linux.alibaba.com designates 115.124.30.133 as permitted sender) client-ip=115.124.30.133; Authentication-Results: mx.google.com; spf=pass (google.com: domain of yang.shi@linux.alibaba.com designates 115.124.30.133 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=01201311R131e4;CH=green;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e07402;MF=yang.shi@linux.alibaba.com;NM=1;PH=DS;RN=12;SR=0;TI=SMTPD_---0T8i4EXv_1536957308; Received: from e19h19392.et15sqa.tbsite.net(mailfrom:yang.shi@linux.alibaba.com fp:SMTPD_---0T8i4EXv_1536957308) by smtp.aliyun-inc.com(127.0.0.1); Sat, 15 Sep 2018 04:35:15 +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: [RFC v10 PATCH 2/3] mm: unmap VM_HUGETLB mappings with optimized path Date: Sat, 15 Sep 2018 04:34:58 +0800 Message-Id: <1536957299-43536-3-git-send-email-yang.shi@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1536957299-43536-1-git-send-email-yang.shi@linux.alibaba.com> References: <1536957299-43536-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 Reviewed-by: Matthew Wilcox --- mm/mmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/mmap.c b/mm/mmap.c index 2879b19..991e066 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;