From patchwork Thu Nov 8 17:48:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 10674733 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 C87681709 for ; Thu, 8 Nov 2018 17:49:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B751528E56 for ; Thu, 8 Nov 2018 17:49:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A43DB2DE63; Thu, 8 Nov 2018 17:49:06 +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=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE 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 37DB428E56 for ; Thu, 8 Nov 2018 17:49:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 27F0D6B0621; Thu, 8 Nov 2018 12:49:05 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 254A16B0623; Thu, 8 Nov 2018 12:49:05 -0500 (EST) 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 143D16B0624; Thu, 8 Nov 2018 12:49:05 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pl1-f200.google.com (mail-pl1-f200.google.com [209.85.214.200]) by kanga.kvack.org (Postfix) with ESMTP id C8CD56B0621 for ; Thu, 8 Nov 2018 12:49:04 -0500 (EST) Received: by mail-pl1-f200.google.com with SMTP id c15-v6so19342806pls.15 for ; Thu, 08 Nov 2018 09:49:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id; bh=Sn9YD/aRXB7ZOxgLD7MkEPfRLE73zuHoCyAc48NEeaM=; b=cn188kBPd+HpqWGQRjRQbLZMNt653VSZM5QrWD6626beWY22m8RLVJEKpU9pOWdhIi J+oCc6siHgSorhd4/UIAaZ1oIqEbyqYdudNLm0VcwJi5r6PT10/3lOfvxWRmP4GcfZQj WPJg5dXhKGMjMSXZ08C+40e7wx9vFY9325GaewokEN6Hd/32VNCvB3mUXhdrH6Pi5+mK JzaRlfplE/FK5XeerDuzNx6HEbfsdWEyH5heJ+ToLK5AHfI7Cqdqr02h/XxplVMcPNzW TLv7xv7P2haLXKdjnLzMVAgyZyaqS8ZTtJKq8u5UmPKGyxXTx28goHY+3yC9rq5AYo2e hsbw== X-Gm-Message-State: AGRZ1gKHJ/HRJUGnNBGIOaLaAe4A49XzGNnJXEj0Z25i8DOwUmhbB6lG ktSqmOpz0sdr+WEtXG07NN2WDY81D9zf4d2kS3TSgsMvsadSm4jrNOKq7Fd9eyWdh0d5JW9LWP+ Eu6U4vc7NyTzSEqNfTRN5chNWNAr+RZnfDIXNFzGZffU5R72eFKpegG1uAHoNjB4ZVQkX7Y0jOe B5QmcVCrD5mOHGNK3uR3+gp2cCzcDpc2wtI4KS0uR4G5WTDCOIt6iWgbfYuBE255utzahqOopJR sELynJTtQj3xj8p5Zdld75ENmLjtybbtu54uVVkfUGgxebmxgyJWOwFo+p+LGlVAf5xg6IA9rzK /jQw5RXsDKw6JwAjdt+AL0xrQqqoj/1n9jF7g2UT+oS85CDOfLfcvO0QYQOj8pofSERhNCAKl/P 1 X-Received: by 2002:a17:902:28a8:: with SMTP id f37-v6mr5510851plb.264.1541699344506; Thu, 08 Nov 2018 09:49:04 -0800 (PST) X-Received: by 2002:a17:902:28a8:: with SMTP id f37-v6mr5510825plb.264.1541699343781; Thu, 08 Nov 2018 09:49:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541699343; cv=none; d=google.com; s=arc-20160816; b=kOeNSgso8Vpfr493h2h2r225z/tG6uo66EfK/RtPwe+iNmbYujBrvQunPkp1RMO8O2 Wb79hGAsVhYi8V7BRuc1hYpEVOtFzv+jSO3jdNZfb6Knjq2o1WewzN9usQPoGwT5H5pp 81jri8WcJUrma4JNPGe4sNEz0O0KhzwepX5vrfp8hhjfjOCBo97rc/14xCFbCE1R3grY qczPRqqs/WUVZ5fglvbbeZppo3OnBbysT2ssocX0TNsKGcrlFRwvVePkvVKSLxJOeR5X vb/s0jcM8GU/71EL7i7yV6Pe6H27x1ytbvFTJjwZbEUAGxW4zwUCvBRElfO618ThYsZ6 3d3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from:dkim-signature; bh=Sn9YD/aRXB7ZOxgLD7MkEPfRLE73zuHoCyAc48NEeaM=; b=JEpL3aqrfq7Qi59Y79XMEfgfba8xv7eu+5qM3+RQe/sn5U9buOOG0fTPHDSgKDBg+Z vRIvHnZaSIHWS2+I3u2O6etJ8hkbV933BTfpu0sHDsV5HIl5QJtFLg0yWLI7ywadH/R5 MXJVjwcGKtfm0ISQfX2N28EzMESwol+T7XR9GUqZnNeCrWcdGFkpyYbboj/JiKZrCxfi b23LpSHJMWuTnjpGI2OMHHUMEiDlN08o4Yik5iLwbLKrHa9UP3iU37mh+8Mij73NGXOA n9DbXt2FQT8zvjO5eCBDVr1T3bkFBipsuJ06Ngk3da4q/WR+t/Le3pNC0sVIziR5AD0c WxSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=S1iwhRh3; spf=pass (google.com: domain of tiny.windzz@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=tiny.windzz@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id j12-v6sor5820328plk.37.2018.11.08.09.49.03 for (Google Transport Security); Thu, 08 Nov 2018 09:49:03 -0800 (PST) Received-SPF: pass (google.com: domain of tiny.windzz@gmail.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=S1iwhRh3; spf=pass (google.com: domain of tiny.windzz@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=tiny.windzz@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=Sn9YD/aRXB7ZOxgLD7MkEPfRLE73zuHoCyAc48NEeaM=; b=S1iwhRh3GA2OJBeh8ULgOYmY3ziu0fZbT+IvyAG+n/Og6XkyJFiuxAYwOcS7iztOHi VX2UpesY0Po+gdIEnpfDnYbCm58QSZfaZhckq8EoKKAYpWG7YsSbivMmRPJit6MX4yio C2IxvCVIcT7MoyXwYWsRPSctoklK4ApC2LUWk0lQP1/4DXvh29iPDjH/pgqXm7HNFJO4 OURgU8BMt7PhDT0pKAFp7jUD+RgBsc4VVLjBsCrZG53nX2bQ+pu7EKc77jyznjqM31eD CM1Z2QT4Za6tPDnpSDuoJljRi1mTGxcmijaSJENgypBQ0s/5ewL0FzOBDE8vNQjwk01+ tllw== X-Google-Smtp-Source: AJdET5dJmlK+GjpqS8KMHmM0rBjA6Qv6qck1aOqI1Y2F0g5TNX4NAikIiroDnZ6BMWR94Dl21SkEfA== X-Received: by 2002:a17:902:6185:: with SMTP id u5-v6mr5378942plj.41.1541699343081; Thu, 08 Nov 2018 09:49:03 -0800 (PST) Received: from localhost (68.168.130.77.16clouds.com. [68.168.130.77]) by smtp.gmail.com with ESMTPSA id x63-v6sm5387946pfk.14.2018.11.08.09.49.01 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 08 Nov 2018 09:49:02 -0800 (PST) From: Yangtao Li To: akpm@linux-foundation.org, mhocko@suse.com, rientjes@google.com, dan.j.williams@intel.com, linux@dominikbrodowski.net, dave.hansen@linux.intel.com, dwmw@amazon.co.uk, mhocko@kernel.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Yangtao Li Subject: [PATCH] mm: mmap: remove verify_mm_writelocked() Date: Thu, 8 Nov 2018 12:48:56 -0500 Message-Id: <20181108174856.10811-1-tiny.windzz@gmail.com> X-Mailer: git-send-email 2.17.0 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 We should get rid of this function. It no longer serves its purpose.This is a historical artifact from 2005 where do_brk was called outside of the core mm.We do have a proper abstraction in vm_brk_flags and that one does the locking properly.So there is no need to use this function. Signed-off-by: Yangtao Li Acked-by: Michal Hocko Acked-by: David Rientjes --- mm/mmap.c | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/mm/mmap.c b/mm/mmap.c index f7cd9cb966c0..1cee506494d2 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -2910,16 +2910,6 @@ SYSCALL_DEFINE5(remap_file_pages, unsigned long, start, unsigned long, size, return ret; } -static inline void verify_mm_writelocked(struct mm_struct *mm) -{ -#ifdef CONFIG_DEBUG_VM - if (unlikely(down_read_trylock(&mm->mmap_sem))) { - WARN_ON(1); - up_read(&mm->mmap_sem); - } -#endif -} - /* * this is really a simplified "do_mmap". it only handles * anonymous maps. eventually we may be able to do some @@ -2946,12 +2936,6 @@ static int do_brk_flags(unsigned long addr, unsigned long len, unsigned long fla if (error) return error; - /* - * mm->mmap_sem is required to protect against another thread - * changing the mappings in case we sleep. - */ - verify_mm_writelocked(mm); - /* * Clear old maps. this also does some error checking for us */