Received: by 10.213.65.68 with SMTP id h4csp943840imn; Tue, 27 Mar 2018 11:39:36 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+O/pwfoqq6p+rDDN/WkOKaiJykKys5WIgV69wlGIXmqUnvioBQAKgT+Zco4duxg5BZ6hcl X-Received: by 2002:a17:902:650e:: with SMTP id b14-v6mr431323plk.147.1522175975997; Tue, 27 Mar 2018 11:39:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522175975; cv=none; d=google.com; s=arc-20160816; b=o593RBtFn1pykh2ksjJSrzslDFopUQmGWCU4BvEDV6kkbSqMJQ6pR+NHMZvDubuIgT abDP5Ii7riUahii2dv/B1tmXTp6LZJxYpKylELA0st1H4H37yK8/Rg+P9kaINOg/G2Ql sDS7EVeW/xk6Unnru7A80woEWVHz1kQkexywkBr4o3i7Gh0rR69IgXxobjEU/X8f5xy4 FkX0hVs/hoctLZEFpQyitR4krL+Vx8UH1i1jNSKZk07qn4MCJLqaLF8kJA0WNY4e7aGN KJaZTZT+pAHAKLSvwS8S4zyTSPavZW1O3cwhLhAF6WEpXoFXDhpVmMHdEWUyuwPdM5kE oVFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=RH950maWj6BZTM5HXHPZd+gnF8dE62lZQcQZTAY23h0=; b=QiYiu2MWPVaCoAaQNQEL5jSOoHIXoa6JbxX2oOLi8S0UIji9IdQ8U/muK41VQ0WzRY C57WnZkJF+fKgXn+uNtIU1411FifLG3p8BbDxs4Mfcuq7o0H2kVQ9JpXGt/n+vOZITrs ioOkGmB/vP8sT2S8cTvwMcFOuOiBfqGEA3mcIuaEy1IIIZedvEmQ8R9jb4oK9GfYTCYN rAGsBeqqAzJWyNJwIs/B1NQMeQJyw65s+bbc01O/SfGpxmyLaEAqZGv9ECMzL58VH7Qc SCGEPa/6nYYDd5UdaepSjHldhWD/Rw2O1vK9dBRWqlpOQzyzKptzAGCHWjCO3ScjiaZz xDqA== 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=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s3-v6si1710355plp.523.2018.03.27.11.39.21; Tue, 27 Mar 2018 11:39:35 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751157AbeC0Si2 (ORCPT + 99 others); Tue, 27 Mar 2018 14:38:28 -0400 Received: from out30-130.freemail.mail.aliyun.com ([115.124.30.130]:47870 "EHLO out30-130.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750926AbeC0Si0 (ORCPT ); Tue, 27 Mar 2018 14:38:26 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R141e4;CH=green;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01f04446;MF=yang.shi@linux.alibaba.com;NM=1;PH=DS;RN=8;SR=0;TI=SMTPD_---0T-Btkg2_1522175895; Received: from US-143344MP.local(mailfrom:yang.shi@linux.alibaba.com fp:65.207.107.50) by smtp.aliyun-inc.com(127.0.0.1); Wed, 28 Mar 2018 02:38:18 +0800 Subject: Re: [v2 PATCH] mm: introduce arg_lock to protect arg_start|end and env_start|end in mm_struct To: Michal Hocko 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 References: <1522088439-105930-1-git-send-email-yang.shi@linux.alibaba.com> <20180327062939.GV5652@dhcp22.suse.cz> From: Yang Shi Message-ID: <95a107ac-5e5b-92d7-dbde-2e961d85de28@linux.alibaba.com> Date: Tue, 27 Mar 2018 14:38:11 -0400 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <20180327062939.GV5652@dhcp22.suse.cz> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/27/18 2:29 AM, Michal Hocko wrote: > 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. Yes, sure. > > 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. Actually, I didn't think of why. It looks prctl_set_mm() checks if vma does exist when it tries to set stack_start, argv_* and env_*, btw not only env_end. Cyrill may be able to give us some hint since C/R is the main user of this API. Yang > > Thanks!