Received: by 10.213.65.68 with SMTP id h4csp355843imn; Mon, 26 Mar 2018 23:53:27 -0700 (PDT) X-Google-Smtp-Source: AG47ELsxxOHovXZamdZ1U9hWG52JtqLnpy+THb0OiH6EtZZH7G0fjmgu5dKVbrU/GGb0mZLuSO1l X-Received: by 10.99.125.75 with SMTP id m11mr16960374pgn.391.1522133607242; Mon, 26 Mar 2018 23:53:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522133607; cv=none; d=google.com; s=arc-20160816; b=YqawQ8McA/jtcPtXDyegP4eALT1jKjAy0/bRK6SMUyRpMoh+4mEBA1x7Ce6UF3IRra qsOLta06/2BVr1/YTobRaZXlSIOaLvWYcwdLtmRIbqZOD7DOMS+Xr1+O2L3WxgVU9cBs Hlmm1NYv6R4tTnIJeGdIrkt5sxa1jyliPO/YEOxlTmf8CDr85xQyoiE54fG+f1SdAGGd O+8H0Nlwnnt/QJIloWP3sN6ZslBIoG0p349LmnaW+leOoQ7FOT6IX+fTVTLz0VennouJ dKoAaqtZw10F6BdFizQnnfUA+Dl0cpEb5gbIlStqmcZh80O55xhPuwntGCNzLy/AkpYr EsOA== 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:arc-authentication-results; bh=tCrQSiuQmLNtA+F+6AwYr5HWjBbIrzRFTQq8fk5hBM0=; b=JWFsN/5CUg3ygqcs7YcTgJmnCPgnSZZPuORbsecon+JDHj6hfK2q9vhXIgwntTp5tq Kt3yyqGxXVXPBCmIg571JUumsa1g+q3Fl2aBDh87el/I36Qsm3BqcofmhJukTigJkCw6 dVAPxbHzzdDOK0jxcoPHY4A7urCvQC7uIGv6aCZoh7iyY72ZB80w52BwW0oCwZ/UAp3s T18ONvDyGubpdsucRqeWwIW3uMZcxYzpcLDhPVh2gqDQBC39BMmAv8IWg8F5chFtrKTJ bYenr0Jo7QHCCczvXEeX+OIsVa8v1wy2fTvFTPSSPeLeigTXiPCA+ICC7/HP1abZgE8O mdUQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m63si445978pgm.302.2018.03.26.23.53.13; Mon, 26 Mar 2018 23:53:27 -0700 (PDT) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752362AbeC0G3m (ORCPT + 99 others); Tue, 27 Mar 2018 02:29:42 -0400 Received: from mx2.suse.de ([195.135.220.15]:44565 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750848AbeC0G3l (ORCPT ); Tue, 27 Mar 2018 02:29:41 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 7A1E5ADD5; Tue, 27 Mar 2018 06:29:40 +0000 (UTC) Date: Tue, 27 Mar 2018 08:29:39 +0200 From: Michal Hocko To: Yang Shi Cc: adobriyan@gmail.com, willy@infradead.org, mguzik@redhat.com, gorcunov@openvz.org, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [v2 PATCH] mm: introduce arg_lock to protect arg_start|end and env_start|end in mm_struct Message-ID: <20180327062939.GV5652@dhcp22.suse.cz> References: <1522088439-105930-1-git-send-email-yang.shi@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1522088439-105930-1-git-send-email-yang.shi@linux.alibaba.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue 27-03-18 02:20:39, Yang Shi wrote: [...] The patch looks reasonable to me. Maybe it would be better to be more explicit about the purpose of the patch. As others noticed, this alone wouldn't solve the mmap_sem contention issues. I _think_ that if you were more explicit about the mmap_sem abuse it would trigger less questions. I have just one more question. Now that you are touching this area, would you be willing to remove the following ugliness? > diff --git a/kernel/sys.c b/kernel/sys.c > index f2289de..17bddd2 100644 > --- a/kernel/sys.c > +++ b/kernel/sys.c > @@ -1959,7 +1959,7 @@ static int prctl_set_mm_map(int opt, const void __user *addr, unsigned long data > return error; > } > > - down_write(&mm->mmap_sem); > + down_read(&mm->mmap_sem); Why do we need to hold mmap_sem here and call find_vma, when only PR_SET_MM_ENV_END: is consuming it? I guess we can replace it wit the new lock and take the mmap_sem only for PR_SET_MM_ENV_END. Thanks! -- Michal Hocko SUSE Labs