Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp402940imu; Thu, 8 Nov 2018 09:50:27 -0800 (PST) X-Google-Smtp-Source: AJdET5eRfn8tOuiI5TOp5z3azHoZpPzy16Ild/Mm+NMSXF7ZDtoOCa1A6jDdsNMvRqj/ENk96Ku6 X-Received: by 2002:a62:4251:: with SMTP id p78-v6mr5507876pfa.72.1541699426938; Thu, 08 Nov 2018 09:50:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541699426; cv=none; d=google.com; s=arc-20160816; b=CG83wNlbO9WVdeZ5yqAyi5lOhLHkZqdUgL4JJgr+si70nk+Z8RuvN25aRPn6chsMBM 7H5a93M39OqE62/YCX/ekeFq1jTbYc75PlTXmdmLi7L/UNWUVMPxaw/tbYbLf+E/069C N7+C5Cv6Hf4vqq1Ukgn9IW6AmrvLwS+KVFOtlrIGih7BrYl7+FchOzTCFACMGDy2ZzAV Y+KTiWoZbTahNJJO8+OdTka4Rs/zdgqyNYlLHRlRvQq85F/q8vZHvwwg5f+ddOAw9HXT r8xFmVmTPPobwmXmgS1PhgemcnFTPt7TeUjz+W9++bnFq7y6NIihZL6QnR4ZqPMGaGzy HXDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=Sn9YD/aRXB7ZOxgLD7MkEPfRLE73zuHoCyAc48NEeaM=; b=zLbdmyAqVlmpxRYgcHACGdDq0uM/QzTk7Jisafw/YxgJOLV/DgLWQ4yH2BwRLwxrDM ZX3ywFZhQ/XJG9DwpaAjiL3Lerb3n+TWj+3gGP3m8bL4m+WX2EWwaFlvBXbUq8WB8RQ1 90MNMlZpiN/p0c7e/aNyLL64xuQ58NOraGjAZI0sSlgZ391idXNg6g+aXnUnRZ1JiZuH NowAUTgJy0RVWEXR8B0iZmA17l7u2QpYxb/an1tn2t5nrn3vB1d7+O42wZ2z86hT2Xp4 eaO1NcZrxeGs2O9yLnNsaQhY/B5/higF6M5qLvhGjEPOpsdTR2F8lUJTP1LujkJ/uu+h 50Vw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=S1iwhRh3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 22si3675537pgl.107.2018.11.08.09.50.10; Thu, 08 Nov 2018 09:50:26 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=S1iwhRh3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727080AbeKIDZi (ORCPT + 99 others); Thu, 8 Nov 2018 22:25:38 -0500 Received: from mail-pl1-f196.google.com ([209.85.214.196]:44663 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726585AbeKIDZi (ORCPT ); Thu, 8 Nov 2018 22:25:38 -0500 Received: by mail-pl1-f196.google.com with SMTP id s5-v6so9856037plq.11 for ; Thu, 08 Nov 2018 09:49:03 -0800 (PST) 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-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Sn9YD/aRXB7ZOxgLD7MkEPfRLE73zuHoCyAc48NEeaM=; b=o1rpmIA7wOprAZM1Anh3TGxUfHBmeWa71lTE9a08SY8fSfgGIkxzBCriRL9XisRy4N o9xuAea4cKaLjMYNgWGEIuxfXReVf5sjM7gVXeX8EqTD3/+MYNtj/o7cQryAf5sjwB+I vTKNPHGy6qkoUk7KofWCuHOTCRgkkX5ygnJKFQ8m3AXx0hWx0iJLK2IvWOyv/6xMHK52 B1HLxRNRoweUjRDGjyebUg++aEgilT5ovbWCvLtUQ3RI1e2THiOMu5l+eXtuMLEV/bpA aq+hQBBzPZ6R1OqdAbJOeIdbkrUOhUahpOJ/CKvG/KnayW6Ok/pWEPFLvUDWg7EpBiK5 Mwxw== X-Gm-Message-State: AGRZ1gKc///kKGgI2yfKAANDFy8A01u6nDQ5Mvmj0eiwjpUJJ2Nndp81 KWoP1Li6Dj1udXr5vT4gCKU= 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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 */ -- 2.17.0