From patchwork Wed Sep 19 17:03:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Shi X-Patchwork-Id: 10606113 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 3914D6CB for ; Wed, 19 Sep 2018 17:05:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 255FC2BB51 for ; Wed, 19 Sep 2018 17:05:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 19B2A2BBD5; Wed, 19 Sep 2018 17:05:26 +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 A7D762BB51 for ; Wed, 19 Sep 2018 17:05:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DCFE98E0006; Wed, 19 Sep 2018 13:05:24 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id DA6398E0001; Wed, 19 Sep 2018 13:05:24 -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 CBD308E0006; Wed, 19 Sep 2018 13:05:24 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pl1-f199.google.com (mail-pl1-f199.google.com [209.85.214.199]) by kanga.kvack.org (Postfix) with ESMTP id 8F9568E0001 for ; Wed, 19 Sep 2018 13:05:24 -0400 (EDT) Received: by mail-pl1-f199.google.com with SMTP id c5-v6so2795429plo.2 for ; Wed, 19 Sep 2018 10:05:24 -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=2u/MD29Te+7XiVvlLdtEOudsBEpoda7U6+oRUts+HsE=; b=f/QIszqCdoTxNz37dR18Fv+q30SMh4rEM39+tZpZ2N2w+nz4jrGLRRdcH8Z/P9t78U a41d9P1amrotYr4fMq71xHp5FnyBGHDyw6mYK4QiMnOU96t504oF4ZPw6xMQEcHlqhAi Wsqg0TYTOPur9mwNecpsErQVOG4ogf1FwUAte58Pq3+IZ9Qs2eQU7buLqmMz6R4JPH9+ UGPvcfAAaEoQ3jBCoF8jlX9/gX3rb3kWenbCt1j6JUkq3yf2yWbDF7PfyaZGajbX4biD hjKEwsMhneNiqb1rXM4EFk9UW/1TSg9yoBYWwCbRxb44sebdY6bZgvok7glNsLMOfUJ1 aT4Q== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of yang.shi@linux.alibaba.com designates 47.88.44.36 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: APzg51BAOVx4b68Xdibt8mmhp3peJ0B1YcagLfwRL5TOu41qTPzMrCal 7wdJPqrsJXzjoYnsyf39U5GxNUnzr8lfZF7BuoWyz4l39ZwYKbVmhb4xoQ/ac3TyF5xqa5wYcF2 eXY2Conbx/R8dp6eR4mym0EksWx6/5dIUoAqTrc8lD7wM/6BV5RPpfUD7DF+gUFQAKw== X-Received: by 2002:a65:608b:: with SMTP id t11-v6mr33757871pgu.259.1537376724247; Wed, 19 Sep 2018 10:05:24 -0700 (PDT) X-Google-Smtp-Source: ANB0Vda5Ht+1oMys2f/tK9O/VNjDGQcT6oRp7kiYBgOdwUGsE+ZTowl7bOCdO6mQB4gCc5OYIzm/ X-Received: by 2002:a65:608b:: with SMTP id t11-v6mr33757812pgu.259.1537376723173; Wed, 19 Sep 2018 10:05:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537376723; cv=none; d=google.com; s=arc-20160816; b=gHkCSbTUTvjVR1s/NCxyrV4BXxNd43LoPfMMorom9/zw1IKF5QK1u0cwggu2Oc2ijY ALp+zDsZORs6HeyzXwVM8XuH4MQpp7Uw/ABvxoWC1B15nGKczQgOV62hKxMBKpq8E/2M lt+uHTulw1j+BuQZ2xMOmx2f1Lzh+uUYKt2vfPuti20Odr96o8NAuo5DcTxjzCs2hiJN HdBsQ/s/+DxkD8RK6qkhfWniW4m7fCKTDSe8CdizHnspO/ZAN0XZtOSXB7qy8/s9vPng pW9Ek3NiKuevIq2YScAMidqch7P9IADFScIWyY/vWgFxZjm7RIUdrINgKkGHZ7gok88C vBEg== 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=2u/MD29Te+7XiVvlLdtEOudsBEpoda7U6+oRUts+HsE=; b=YgTawc2Tb551CA9VBpao4+SBhMTLJXAzqUuJRsNYzX+zOgJyJy0jzT5g6BYx/ZyKmO kg/oA5ddgr70BHy+eUzSBDrE5VpKwulk30f3yzgqmg8h3mHSTDESZLsFWA2BXKu1qPtt HPDAEMcvWZB7cthNnxQtX+s8s2ZD8dUaagYbDw7BRmE+QPdfFCHdyXK3Mla/oecq2Pkb NQjpB9oaN+FHy5f+r40RR94FXP6Jk/ks6CJqECAVNAF9DCXhZbzmBVoiW8uucZp5FMYT etHdTBso12yzJDdhZex+sWBWRgSZoPDZT72++2B1Md4Z8JeYdHhHnKN2V5i1eV+TAPlJ NE5g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of yang.shi@linux.alibaba.com designates 47.88.44.36 as permitted sender) smtp.mailfrom=yang.shi@linux.alibaba.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from out4436.biz.mail.alibaba.com (out4436.biz.mail.alibaba.com. [47.88.44.36]) by mx.google.com with ESMTPS id 59-v6si20957573plp.87.2018.09.19.10.05.21 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Sep 2018 10:05:23 -0700 (PDT) Received-SPF: pass (google.com: domain of yang.shi@linux.alibaba.com designates 47.88.44.36 as permitted sender) client-ip=47.88.44.36; Authentication-Results: mx.google.com; spf=pass (google.com: domain of yang.shi@linux.alibaba.com designates 47.88.44.36 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=01201311R141e4;CH=green;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01f04446;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 3/3] mm: unmap VM_PFNMAP mappings with optimized path Date: Thu, 20 Sep 2018 01:03:41 +0800 Message-Id: <1537376621-51150-4-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_PFNMAP 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 | 9 --------- 1 file changed, 9 deletions(-) diff --git a/mm/mmap.c b/mm/mmap.c index 490340e..847a17d 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -2771,15 +2771,6 @@ static int __do_munmap(struct mm_struct *mm, unsigned long start, size_t len, munlock_vma_pages_all(tmp); } - /* - * Unmapping vmas, which have VM_HUGETLB or VM_PFNMAP, - * need get done with write mmap_sem held since they may - * update vm_flags. - */ - if (downgrade && - (tmp->vm_flags & VM_PFNMAP)) - downgrade = false; - tmp = tmp->vm_next; } }