Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp408248imu; Thu, 8 Nov 2018 09:55:20 -0800 (PST) X-Google-Smtp-Source: AJdET5cdL0ABihL4SJMutGCRThl19tyAeY9AkA1PbyowpuCGlU30Q7W6W8n1gBdEzst3V91FHs8C X-Received: by 2002:a63:1766:: with SMTP id 38mr2772093pgx.299.1541699720392; Thu, 08 Nov 2018 09:55:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541699720; cv=none; d=google.com; s=arc-20160816; b=mhMzDVdDjKy4+PPj9o7cwIP1GQyV9bZuIEU6/qVsd3TTQi9W9Lai0uOF8QvVvUyirh 5asnVEXhr+eNumRDhJv351Yc5Q42Pom9I+DEkV7n4cg+iG9S6X7qY4NQeZskJniZYss2 3JeGp0jU1ELzRm4Zuzpo6k4isw6heOY+BHcBkzXT7UUm/oSl5hmBvQYrlNkmZV5xxqlh EERrUtzzWSKhy55mLr1DDBZjFAy/LsmgQgrdH8+Y3iAiBZT07mkzzumD9kE7ee0P+WLL llkATZFzJajdv9n1Qwqtg5E8eHh+B3+/cFbxrRurmhh6ImuCHF/XaDh0Hhh1IAEapf3f cgNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=ag/XT4kyn/f5YjRJMzECwsEWndokz0BUS0RazaAWpcg=; b=IVMKgefUt9HudFe3o0vFPgg5kXdsgU1jommlwEpGBQ3kq0VtSz39hNaiYou0WqrjDH oVXctFy9v0UXgl4Y+vEmibc6eLxQI0M3GCW8XyspFOCyHZIdRmkCKZHGLxE0Yyr2Ypz4 dCD8WfPmjsyI+lfjIXIZyExSzVMrEMUOI8kIRKaMml0ro1wYu1iNp/SG1DchbQSjXTX8 W9/S4+Tjl/3yM+djUJJ6Xin1RyJNBbKngd9n87RdSyZVvxUaOjfZ+TreaAmWoIcv25Tp bAU8Ax61HpDaWCWlvwLcmd1zFTyePYk0zPuJzeLeg7jPGONJcPUKdr6O1kYKM4rmedPC dvGg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y2-v6si4198789pgc.430.2018.11.08.09.55.05; Thu, 08 Nov 2018 09:55:20 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727988AbeKID3l (ORCPT + 99 others); Thu, 8 Nov 2018 22:29:41 -0500 Received: from mx2.suse.de ([195.135.220.15]:58352 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726801AbeKID3k (ORCPT ); Thu, 8 Nov 2018 22:29:40 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id BFA67AD5C; Thu, 8 Nov 2018 17:53:03 +0000 (UTC) Date: Thu, 8 Nov 2018 18:53:01 +0100 From: Michal Hocko To: Yangtao Li Cc: akpm@linux-foundation.org, rientjes@google.com, dan.j.williams@intel.com, linux@dominikbrodowski.net, dave.hansen@linux.intel.com, dwmw@amazon.co.uk, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm: mmap: remove verify_mm_writelocked() Message-ID: <20181108175301.GC18390@dhcp22.suse.cz> References: <20181108174856.10811-1-tiny.windzz@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181108174856.10811-1-tiny.windzz@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 08-11-18 12:48:56, Yangtao Li wrote: > 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 > --- > 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 > -- Michal Hocko SUSE Labs