Received: by 10.213.65.68 with SMTP id h4csp32308imn; Mon, 26 Mar 2018 14:24:23 -0700 (PDT) X-Google-Smtp-Source: AG47ELsdrg6Pdq4yQRvAJ/NYRKGTdHk9s+BTZeg70uUwceMJKfEA68+TYYxL1KwaOso8eBLZLSZP X-Received: by 10.98.31.86 with SMTP id f83mr24572526pff.196.1522099463153; Mon, 26 Mar 2018 14:24:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522099463; cv=none; d=google.com; s=arc-20160816; b=xUDyQdaBkva/bdWWUQIYuXWNTKgn1xCwJDTIRqDsXvbBwm2/0KgRM0WrJfEppEYFZD W0ybOL+W+KXo24ZdEgPwHtXErFo0sBphcQ99TDQ/8E6F4H61FCRdsqtBaT2i5434rNmp TZiHM5Qj4OQX0y+AZl1zguixAyhFRSSwz4kKaFsIHrgl1qC6u3JH/gxTXykWFh4Ku3MZ TKLQ7luA/VFbEUCDTh6ECjW3I1mjxUkBP2TnEuy8254ncKAghQdjt8MVhpYcYZxAWHA2 YIXrCZ56bqnUOjwy+KHTuu1Jddco6GUDEhK8SykP564+TwEQ2pZ1+DEu2ujxk9bWYBJs J3kQ== 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=qsrntfJXhTkfwYE5UJEDfdmW0Tc/lHZYyu3UIgdZ/qs=; b=ndDd2Ocydh69H1VDVZuREBCxTzaWg4CYluzyEiyDyZR/VSxwwpGsAfUAnDC9mpg2tK aqkx3S+koXgVJ610+qw4Z+DkPA5SU2f5dpA9eEvkKRC51lFOk/D4hi9F7RT77RyydBpy XPmUKOu31hUWZl6G5adUpGBQ8RDHfhwJKvILvMCW+D2s6OdiNCfUBMY+xN+PJdiPK+OL i/680qNsg9M93xSg3h0tKh83QPLXmvMkvZbFIs71hiyVXTk9FHO4tzmtLIGEFjMFQVDg eEW2PIhspIR6tIolTWvJ/uEBPb40aXZyFtDqTg/lm7Jr47M4T9JyDayrh6zqJCePhPNY OsBg== 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 n1si12141704pfa.94.2018.03.26.14.24.09; Mon, 26 Mar 2018 14:24:23 -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 S1751840AbeCZVUq (ORCPT + 99 others); Mon, 26 Mar 2018 17:20:46 -0400 Received: from out30-130.freemail.mail.aliyun.com ([115.124.30.130]:59448 "EHLO out30-130.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750983AbeCZVUp (ORCPT ); Mon, 26 Mar 2018 17:20:45 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R581e4;CH=green;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e01355;MF=yang.shi@linux.alibaba.com;NM=1;PH=DS;RN=9;SR=0;TI=SMTPD_---0T-8lR6F_1522099234; 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); Tue, 27 Mar 2018 05:20:37 +0800 Subject: Re: [v2 PATCH] mm: introduce arg_lock to protect arg_start|end and env_start|end in mm_struct To: Tetsuo Handa , Cyrill Gorcunov , Matthew Wilcox Cc: adobriyan@gmail.com, mhocko@kernel.org, mguzik@redhat.com, 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> <20180326183725.GB27373@bombadil.infradead.org> <20180326192132.GE2236@uranus> <0bfa8943-a2fe-b0ab-99a2-347094a2bcec@i-love.sakura.ne.jp> From: Yang Shi Message-ID: Date: Mon, 26 Mar 2018 17:20:33 -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: <0bfa8943-a2fe-b0ab-99a2-347094a2bcec@i-love.sakura.ne.jp> 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/26/18 5:10 PM, Tetsuo Handa wrote: > On 2018/03/27 4:21, Cyrill Gorcunov wrote: >> That said I think using read-lock here would be a bug. > If I understand correctly, the caller can't set both fields atomically, for > prctl() does not receive both fields at one call. > > prctl(PR_SET_MM, PR_SET_MM_ARG_START xor PR_SET_MM_ARG_END xor PR_SET_MM_ENV_START xor PR_SET_MM_ENV_END, new value, 0, 0); > > Then, I wonder whether reading arg_start|end and env_start|end atomically makes > sense. Just retry reading if arg_start > env_end or env_start > env_end is fine? It might trap into dead loop if those are set to wrong values, right?