Received: by 10.213.65.68 with SMTP id h4csp24292imn; Mon, 26 Mar 2018 14:11:35 -0700 (PDT) X-Google-Smtp-Source: AG47ELtwqRTkqTdrQDLRi0sYDSpsXwai7RQ6KMaEGsg7EKHfTh1xbSI9suVFQHU+dErWQFRgIq38 X-Received: by 10.99.96.66 with SMTP id u63mr29640591pgb.22.1522098695192; Mon, 26 Mar 2018 14:11:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522098695; cv=none; d=google.com; s=arc-20160816; b=JCsgSq3XDwWmHYHYcERk3PZHez4AXrXUiy2geI/6SPxElzwRKvqEGO6/tvaqfa5aca 6RjtriJpX8lpYzrN1KleAXYytwh/in/qtWUjCwXA7655tfpOkzq40DsGNMS6h2+LfH2S TgzddeTTFE4shmXfurtFDzz8FhxyM1UviQRe8qXCLv8jPqGnL311obIrD5KFXb8QgzAs NAJXDyXCqchD8qKYEt/DK0RRZYZYTy9FHfZRESk7648bVH+Q2+AQBYFoDfNSE3VleyQm jCMq3k1Z00JW+CXtkIhRU+3dYb601ckDIctR55OaWSVt1+4+qpZlqnt/p23VEgGZjVWG fKVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=RZSfZfmo6NH8I1Z3sG6xkpXrBb9wjFWNgSHAWoQ5f9M=; b=in0/VSdAKXEMWlfEsExlyPO9ShB3BsX6lIyh3iDWkBJrz+PXVxfSgb4BPOPuR0wHtd 1Dffkp4iLA1ulNmesOPS90Oy95Y0kXGiQK8xVNklhVEVg/lMLEkGPgjcCUoNQtJGK9b2 +QOOT4xP50MqMcNKtERVJZShxbAeNugVkRaxb9OUZUlg6f62l6cK/2KKCRGpH2SWF3w+ vTQZ86+8V72VIzNbHpXROGrdvvYwAkMR9LDumHCnyu1j/H+Ox8xk9XTyDMil6xj1qcd9 1nP2gCVl/d7UefFj9CqWV0VzFCDtmNOgCO9NSaXiQ1F4HgGrly3jRk9c+cGRxPcDdMKx eSvA== 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 16si991829pfh.354.2018.03.26.14.11.20; Mon, 26 Mar 2018 14:11: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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752016AbeCZVKR (ORCPT + 99 others); Mon, 26 Mar 2018 17:10:17 -0400 Received: from www262.sakura.ne.jp ([202.181.97.72]:49908 "EHLO www262.sakura.ne.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751107AbeCZVKQ (ORCPT ); Mon, 26 Mar 2018 17:10:16 -0400 Received: from fsav303.sakura.ne.jp (fsav303.sakura.ne.jp [153.120.85.134]) by www262.sakura.ne.jp (8.14.5/8.14.5) with ESMTP id w2QLAFnV045042; Tue, 27 Mar 2018 06:10:15 +0900 (JST) (envelope-from penguin-kernel@i-love.sakura.ne.jp) Received: from www262.sakura.ne.jp (202.181.97.72) by fsav303.sakura.ne.jp (F-Secure/fsigk_smtp/530/fsav303.sakura.ne.jp); Tue, 27 Mar 2018 06:10:15 +0900 (JST) X-Virus-Status: clean(F-Secure/fsigk_smtp/530/fsav303.sakura.ne.jp) Received: from [192.168.1.8] (softbank126099184120.bbtec.net [126.99.184.120]) (authenticated bits=0) by www262.sakura.ne.jp (8.14.5/8.14.5) with ESMTP id w2QLAAgc045012 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 27 Mar 2018 06:10:15 +0900 (JST) (envelope-from penguin-kernel@i-love.sakura.ne.jp) Subject: Re: [v2 PATCH] mm: introduce arg_lock to protect arg_start|end and env_start|end in mm_struct To: Cyrill Gorcunov , Matthew Wilcox Cc: Yang Shi , 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> From: Tetsuo Handa Message-ID: <0bfa8943-a2fe-b0ab-99a2-347094a2bcec@i-love.sakura.ne.jp> Date: Tue, 27 Mar 2018 06:10:09 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180326192132.GE2236@uranus> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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?