Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp624524imm; Fri, 1 Jun 2018 06:58:36 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJOJ8bsFZWet031G55Wqj+KVmEa2f6w8C9BTcQCjywzzzr8Xs2W1yFJjbL0RyQD5I07RCb7 X-Received: by 2002:a65:640d:: with SMTP id a13-v6mr9113293pgv.154.1527861516851; Fri, 01 Jun 2018 06:58:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527861516; cv=none; d=google.com; s=arc-20160816; b=F6RPYlmKxaxUAJpsyCZP5Al8DMNZ6c6ZfoNho/msVLalf5HlsXU5DxZI2BaGhE7U2w UQ59IEYnvxqA1fMO7ebGw0wTeNbwic0neciOtokm58m9cC5oMTRXZdEF0O+mNQwnvX8p /Gle8xlEQrNzXvwf7BFzmtbNQkPevARBnDWcYbWoZ6aECuBswCxBLPfudRzghkxXO35v ZW0TYJO0SFdST9N5ksOPb+HBvjXdA1oSWes7KKgKNs+ODKLviNPi8Kxx5LRMIIDIhAOS 74jAeVYHdknJ8r+Q4NC9LqQITwg+GbQaP68QvhbD6CLEVwB+tSchHSwJLgGWYES9PPYY F09A== 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=GP78wZkZ911v44vAP3sRBJg7LRZVk72aV61hAN4sDfI=; b=tn6MVu6Ozy9iXgCqnfD5Fe0WU1QCd1eGX8g/pM6utTQnsVtDr+BGTo28a0e1aBANvn 8eWvwiap+iASwNBTiWxMymVzgliE75uW0943nRnMaGIVdcc3A8ZZwXibgMuT1m21mmJh CyfxJRacecpZHkdC6XCXx0w66LSK9o7EehppOCp39v84h455Z42/HOxnt2mnRLtFRRNo 4nWWErCecyCt66xdFANJX+crNOQE+rK3TNuMnLSjOu0DodJPB2dgINzsKZbyFQSFGIZj G7cU5sja3UZoPoqEyp3rzSTVn3q9Qly8L3jU7nI4Vrm13A/EfI8qFki4GPG7DYMX+GfJ QKZA== 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c32-v6si34071385plj.177.2018.06.01.06.58.21; Fri, 01 Jun 2018 06:58:36 -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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752003AbeFAN5g (ORCPT + 99 others); Fri, 1 Jun 2018 09:57:36 -0400 Received: from mx2.suse.de ([195.135.220.15]:58813 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751948AbeFAN53 (ORCPT ); Fri, 1 Jun 2018 09:57:29 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext-too.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id D3476AC79; Fri, 1 Jun 2018 13:57:27 +0000 (UTC) Date: Fri, 1 Jun 2018 15:57:25 +0200 From: Michal Hocko To: "Eric W. Biederman" Cc: Kirill Tkhai , akpm@linux-foundation.org, peterz@infradead.org, oleg@redhat.com, viro@zeniv.linux.org.uk, mingo@kernel.org, paulmck@linux.vnet.ibm.com, keescook@chromium.org, riel@redhat.com, tglx@linutronix.de, kirill.shutemov@linux.intel.com, marcos.souza.org@gmail.com, hoeun.ryu@gmail.com, pasha.tatashin@oracle.com, gs051095@gmail.com, dhowells@redhat.com, rppt@linux.vnet.ibm.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH 0/4] exit: Make unlikely case in mm_update_next_owner() more scalable Message-ID: <20180601135725.GE15278@dhcp22.suse.cz> References: <152473763015.29458.1131542311542381803.stgit@localhost.localdomain> <20180426130700.GP17484@dhcp22.suse.cz> <877enj9uwf.fsf@xmission.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <877enj9uwf.fsf@xmission.com> User-Agent: Mutt/1.9.5 (2018-04-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 31-05-18 20:07:28, Eric W. Biederman wrote: > Michal Hocko writes: > > > On Thu 26-04-18 14:00:19, Kirill Tkhai wrote: > >> This function searches for a new mm owner in children and siblings, > >> and then iterates over all processes in the system in unlikely case. > >> Despite the case is unlikely, its probability growths with the number > >> of processes in the system. The time, spent on iterations, also growths. > >> I regulary observe mm_update_next_owner() in crash dumps (not related > >> to this function) of the nodes with many processes (20K+), so it looks > >> like it's not so unlikely case. > > > > Did you manage to find the pattern that forces mm_update_next_owner to > > slow paths? This really shouldn't trigger very often. If we can fallback > > easily then I suspect that we should be better off reconsidering > > mm->owner and try to come up with something more clever. I've had a > > patch to remove owner few years back. It needed some work to finish but > > maybe that would be a better than try to make non-scalable thing suck > > less. > > Reading through the code I just found a trivial pattern that triggers > this. Create a multi-threaded process. Have the thread group leader > (the first thread) exit. Hmm, I thought that we try to iterate over threads in the same thread group first. But we are not doing that. Anyway just CLONE_VM without CLONE_THREAD would achieve the same pathological path but that should be rare. Group leader exiting early without tearing down the whole thread group should be quite rare as well. No question that somebody might do that on purpose though... -- Michal Hocko SUSE Labs