From patchwork Fri Sep 14 20:34:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Shi X-Patchwork-Id: 10601215 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 D1E0A13AD for ; Fri, 14 Sep 2018 20:35:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B3B522A6C1 for ; Fri, 14 Sep 2018 20:35:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A7C7A2BA53; Fri, 14 Sep 2018 20:35:36 +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 5190E2A6C1 for ; Fri, 14 Sep 2018 20:35:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2DA9B8E0003; Fri, 14 Sep 2018 16:35:33 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 28B158E0001; Fri, 14 Sep 2018 16:35:33 -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 135F78E0005; Fri, 14 Sep 2018 16:35:33 -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 C695B8E0003 for ; Fri, 14 Sep 2018 16:35:32 -0400 (EDT) Received: by mail-pl1-f198.google.com with SMTP id b6-v6so4831769pls.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=md78xmCAKo3IDwBaEhlInV8jFl8Cij6aMMzrkrh08fU=; b=HCWBkRpI2QZO1BPWyZKLHzizD9r+vY0SagnGO3z+Bn3jE5l6njhJ22L/a0cQmP+1ED fGG8TtKAHJi9ZP7IornUVQ5TkrEDDY7pTQGAqH9pVkC5mp2WHMojZEL6OZi0llv5znZe AvBG5YZMMRJWxLFnd6he7X8idDYd/hdEqJwSMKTmYHVvxOQXJjJfqKm42HS1GNLiOlwt 0/yayxqS1HPgkROxNC0YudPG6G33BBBLmhmJm0VR1hZEXa4CiqObancdZDYbY6NgeT4O upMt78IJfc5jX684wcumLQejrIMlTh/i2sB7hqKSPGL1B4yW9bM1G9i9pCqYClm9MdxR Qhog== 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: APzg51Cr1r+NKOh86McCwernA3Ms3f9vF/J4264Y3JMdN/qou6PHWEko RGyp4taKuIBDwv3optoqzZiMamj3CkWixNrO1fW3tV9AYGbH/n547jc6Y6Thj94G/V3dDJim6qd T/E4+zDaAD2jPm4fiXpDZfWxCclahpm2mNTdLlS7m40M181jF/zYQHb9/a161N0xfcg== X-Received: by 2002:aa7:831b:: with SMTP id t27-v6mr14236011pfm.81.1536957332494; Fri, 14 Sep 2018 13:35:32 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYjLw6hRQ0qG+oAdDOhirJribY/55jrxGohljuLj8E14AZ4xm7sD4pw1MB6/ZYl64CC3GQP X-Received: by 2002:aa7:831b:: with SMTP id t27-v6mr14235957pfm.81.1536957331283; 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=mbgIdqZIW0AGYNQTvy0yI0s7OywShdokIlZP/KFZIMvYtvmZyiL4PjDPifOBO6PSHp 4hYrYf2rg88KGOklrsUnVkSFzrE38XLImGEvswNX5BcBF7zNSj0y9Jp5dblDFMPChwgo Q3PE7nGLByI9E6cUc5IQpIwzXPX91jtNJ7ZV45T/ukI8x4a17eEmLvFEAPFpYk5bE5xN aW7Iyb/c2wkyzVkxBqFtlJlsrJxb2PItJ4FHguOZ3UYREYqSf9m6IMaIsSxT4GYfYGio z5a707Qe1lqdr8VeGYBVFv3P0I94ZI6xcg0M506CzsSmyaNf6jo6IqjjAlfcDtOBzjle T3KA== 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=md78xmCAKo3IDwBaEhlInV8jFl8Cij6aMMzrkrh08fU=; b=Jxkq+LT05IxwAbYWlsT1wViiuSMH+quo3bM5mjZvUbdqfrVDr/xVEBxapeKun4iQnk PgARGOoW5v3diOQoTbj8Pwi9iOUr41rO85BiqNVQG20aIhhXt96iJbs6IxtRgki3kZma vNmMnrqL8tColgWAQMVAINpelVADq6kdDrGwcGBSAqs2byhdXFgzHSa73MU/UISpKxAO Z4xIATlPw+pX+8jP8EjFKiMNxtPvmsr4+w/nayLv9WouZWdyB1/2Bg5xTVxI9Ix3ML0f B1QzhvvbcKT6P0yF6BOqEUzOdoHK/0ZhREHhFZZX//DVcgCMrdj+I9dR6ZjVuHLV1l0H hsnQ== 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 y5-v6si6912247pll.89.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=01201311R121e4;CH=green;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01f04427;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:16 +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 3/3] mm: unmap VM_PFNMAP mappings with optimized path Date: Sat, 15 Sep 2018 04:34:59 +0800 Message-Id: <1536957299-43536-4-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_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 Signed-off-by: Yang Shi Reviewed-by: Matthew Wilcox --- mm/mmap.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/mm/mmap.c b/mm/mmap.c index 991e066..04c1d3b 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; } }