Received: by 10.213.65.68 with SMTP id h4csp728119imn; Tue, 27 Mar 2018 07:44:32 -0700 (PDT) X-Google-Smtp-Source: AG47ELv8ftRi4xBA3N2ZfEY7oHDLfV6SkzWi+VyRxzi2IexW28aS+ghBlvWhiC++63G86PQQ0HZV X-Received: by 2002:a17:902:8bc2:: with SMTP id r2-v6mr34788927plo.169.1522161872167; Tue, 27 Mar 2018 07:44:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522161872; cv=none; d=google.com; s=arc-20160816; b=AEaT1Cc1fOPJBiECCwUfNA08p9QJF+wFlAy0/BCD331r5nmx25jyuF8gXTJCQbh0kJ VZKgERDPt0Q5LX0L4RQZx9bETPJqhtYuojNPFnU4Au5h04N3kZuxmzRK1b1HMFYU8Vh1 XoTPcwr2mvJKCPdah2f6/D/Cc0aXtaQVaPUTxCxVAXGo1dvuuW7LT5H73EjGEcRxIHxj vB6Blsl05saIBVPaMuQuWr628cLmar3uHemvHG5Px9voKNrfdKkJ35RT4Qtx8vZCdeSW tXmMRDhY5RG+Zo1agEGBfdop+YtHGBrNkNR5GBz/iSjQgO9wokHk58fPJhUbGyCsGGmz ok1w== 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=1EiMyvYw9G1TWt1dOL6L23eFiEJ8K5Su82qg1bZBleE=; b=b4oJaDaa94VfBPiDdLqfQtYTE7jbB7eoQehozrPn/4htbxD2TC6r1zXMiGJpWdU+05 qxzIO1vP7e8N6S6FDTnjKtMIhXdtVkP9n/zRLMwdRxD2d9TrV1tS/JJCKJVcv9JSzEp1 fCtikWjTKcH9w9oqlRYCT1RFpAiemZgny2UQbMSQ8v+5G9/hqhk8so/hKyElSfSq0Sct Z4sbDPJh+59sdGq85aRnZlv+4kc5+dkOT4gA/AoRMhSv9c1ZBzUtiEzheLCNyNE2EW1g fFPHhRgevkQKLYg9wEmmouZ2zYyszNJcKeqsOlFIMZFir+Z7CyjiCg2negIEmgZQ58qP GXkQ== 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 j1-v6si331333pld.108.2018.03.27.07.44.17; Tue, 27 Mar 2018 07:44:32 -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 S1752123AbeC0OnX (ORCPT + 99 others); Tue, 27 Mar 2018 10:43:23 -0400 Received: from mx2.suse.de ([195.135.220.15]:41301 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751110AbeC0OnW (ORCPT ); Tue, 27 Mar 2018 10:43:22 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 4DC5DAEDC; Tue, 27 Mar 2018 14:43:21 +0000 (UTC) Date: Tue, 27 Mar 2018 16:43:20 +0200 From: Michal Hocko To: Mateusz Guzik 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: <20180327144320.GI5652@dhcp22.suse.cz> References: <1522088439-105930-1-git-send-email-yang.shi@linux.alibaba.com> <20180327062939.GV5652@dhcp22.suse.cz> <20180327143122.rjgxjoj2adzvfck2@mguzik> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180327143122.rjgxjoj2adzvfck2@mguzik> 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 16:31:23, Mateusz Guzik wrote: > 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. Because accessing the specific address in the address space can be later changed to use a more fine-grained locking. There are people experimenting with range locking. These mmap_sem abusers, on the other hand, will require the full range lock without a good reason. So it is really worth it to remove them and replace by a more fine grained locking. If the mm_struct grow is a real concern (I haven't checked that) then we can use a set of hashed locks or something else. -- Michal Hocko SUSE Labs