Received: by 10.213.65.68 with SMTP id h4csp718210imn; Tue, 27 Mar 2018 07:33:00 -0700 (PDT) X-Google-Smtp-Source: AG47ELv7a3T+sM5iyJ2xNwiVRU4AI6DRXWK+AKuumm7uuKJJFPcxmZf6+3ljv/xR9COKz7KwIxxv X-Received: by 2002:a17:902:8b82:: with SMTP id ay2-v6mr44404201plb.12.1522161180284; Tue, 27 Mar 2018 07:33:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522161180; cv=none; d=google.com; s=arc-20160816; b=pcuGY+XYZSsKu3YnzOMjm+GqNofGMgMBWfJirQWuSG1M/1UV9ODlPujB7QqolGAlPa n+s/fElkn5hMhSTyd0mXNt6/rxVulI92m+MqGylz0OYjxQYi72NZRMsfPmLapYfcIcQA 3G+KZhwUslDxc0LgSSQBJZSvUlllyq1fsCQ1njN05lz4A4lvpkWutaYa8zHfb6CO/Ic+ k1mFd04Scd0Dk2vb2p03QiNXLMdpDOVvbhHkPvVQYshR/iGakSVho2JVr329J0Vh2RX7 gjHrqb0ujkdSPpE8TGSa5llDmENgn8JfKliiQMz/uOt485yB0LLsXJ+ARTIjfrpIA4P3 rvdw== 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=zU61xW4MnpFSBUQmaqqk/UtGs4Ymtor2sN1FMstlhxs=; b=T7uqm5zKqVlJEV2uIPge9KtjEkeH4p1xV1lz0EKTmEsfSOqSWTl87euDo2h3NTlefK Q7lJaHQ0fBYlOhiagazZrhBxk8LA3Yo1Q4vtlmn+WZrn2g2I129gO5tZK4vRuSz2Zf1h pvqsrNvFGCS88gGzaiyozNkLZ+CLAov40+An76Er2sSQK02Aj9ZLcGvQY1q1BzA8d6yM bQcRHucYGjPn/NyxkhjEgD+PwzmVsCN1fdtxaC1W4G6lL7olukjRd0+Yh3YDK4Q0/ICo oaC3t5nF3F5F37v3orV9JxiTRsSMZ0WHrkQMq1OW7SB6S2XlmSdaCASZg3XDJYH5o7zT jS2w== 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i72si954655pgd.65.2018.03.27.07.32.45; Tue, 27 Mar 2018 07:33:00 -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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752310AbeC0Oba (ORCPT + 99 others); Tue, 27 Mar 2018 10:31:30 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:53676 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751122AbeC0Ob3 (ORCPT ); Tue, 27 Mar 2018 10:31:29 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CAD63401DEA7; Tue, 27 Mar 2018 14:31:28 +0000 (UTC) Received: from mguzik (ovpn-204-70.brq.redhat.com [10.40.204.70]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D15572026E03; Tue, 27 Mar 2018 14:31:25 +0000 (UTC) Date: Tue, 27 Mar 2018 16:31:23 +0200 From: Mateusz Guzik To: Michal Hocko Cc: Yang Shi , adobriyan@gmail.com, willy@infradead.org, 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: <20180327143122.rjgxjoj2adzvfck2@mguzik> References: <1522088439-105930-1-git-send-email-yang.shi@linux.alibaba.com> <20180327062939.GV5652@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20180327062939.GV5652@dhcp22.suse.cz> User-Agent: Mutt/1.6.0.1 (2016-04-01) X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Tue, 27 Mar 2018 14:31:28 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Tue, 27 Mar 2018 14:31:28 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'mguzik@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 27, 2018 at 08:29:39AM +0200, 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. > From what I gather even with other fixes the kernel will still end up grabbing the semaphore. In this case I don't see what's the upside of adding the spinlock for args. The downside is growth of mm_struct. i.e. the code can be refactored to just hold the lock and relock only if necessary (unable to copy to user without faulting) -- Mateusz Guzik