Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5694445yba; Thu, 11 Apr 2019 03:53:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqyQFzafzSMOkZUU3sj3c2leE2lorZoVrrHOxaXPHhk2HiRkQz0UzTPSJ886KipQUFKu4AWv X-Received: by 2002:a17:902:7043:: with SMTP id h3mr50398189plt.228.1554979995570; Thu, 11 Apr 2019 03:53:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554979995; cv=none; d=google.com; s=arc-20160816; b=kItFYe+NO2fj2dDNmLVe1ZNq1X+H8/NS9/GFdBs90bEXzABENS2lZGxYZ0cPAwd5jl q93VgagKSn03njucxt9D9BogWuLD2nkIYhzCCHtlyYyI3AxoXvnRBTY1LKOe703pdyvh RCItVywcDTcD5+fa+0OPMMYNhXyVVdJRkJWORd1g64vtd1fCmNV4gwX/74Fw8h1jSqgw SNKYpTTEp0JfWBvQZ4n0lrkVXQ6S5VzYDlNrW5SZ1d42wSs5Zc1oP5mKG/NPQeIbgUB9 9z+3/4hR36YwqPFXU5LfGL4UeZDHcNA4q1Iie6IypM9IIwcYZiriBfB22CNGiXOv6/nt E++Q== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=fsF0DTHRJ2Lob7a1MaX8Z5BHLr7TecIc5EZZhX5aYZM=; b=cJ3r9hRxjX+6R7ensQ32KYvQrs7lB6O8+ut0z+Bx0w02cf7aGQkQLXWCkLfbpOzakg ep5pVJufVQyaqW6UTaJt8S6vEYwp9Vy4yufBvZAevFJofWKzV5DjMG0LEneo2v07Dqx0 TyQZm961AajYL3J0nbUZi/7cNvAsJobq0OAJQ3nhd6ZI4T4rBmoSuzbmECFMpZ4XCySJ LaG5jwFJWbQVP3YUvuxisJ7v0P5dYeSWmy+++CaUVZZI1bnugx6PIzebwaZXdG4X65F2 HAE9XroS6zy/IjnXm/4liIJQz6p13KzS76bYDaA8HSAXjmHoLSwEoz45Qm6gWCGlsniF zFKw== 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 o19si35397859pgk.324.2019.04.11.03.52.59; Thu, 11 Apr 2019 03:53:15 -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 S1726755AbfDKKvP (ORCPT + 99 others); Thu, 11 Apr 2019 06:51:15 -0400 Received: from mx2.suse.de ([195.135.220.15]:35404 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726640AbfDKKvO (ORCPT ); Thu, 11 Apr 2019 06:51:14 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 58915ABAC; Thu, 11 Apr 2019 10:51:13 +0000 (UTC) Date: Thu, 11 Apr 2019 12:51:11 +0200 From: Michal Hocko To: Suren Baghdasaryan Cc: akpm@linux-foundation.org, rientjes@google.com, willy@infradead.org, yuzhoujian@didichuxing.com, jrdr.linux@gmail.com, guro@fb.com, hannes@cmpxchg.org, penguin-kernel@I-love.SAKURA.ne.jp, ebiederm@xmission.com, shakeelb@google.com, christian@brauner.io, minchan@kernel.org, timmurray@google.com, dancol@google.com, joel@joelfernandes.org, jannh@google.com, linux-mm@kvack.org, lsf-pc@lists.linux-foundation.org, linux-kernel@vger.kernel.org, kernel-team@android.com Subject: Re: [RFC 0/2] opportunistic memory reclaim of a killed process Message-ID: <20190411105111.GR10383@dhcp22.suse.cz> References: <20190411014353.113252-1-surenb@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190411014353.113252-1-surenb@google.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 10-04-19 18:43:51, Suren Baghdasaryan wrote: [...] > Proposed solution uses existing oom-reaper thread to increase memory > reclaim rate of a killed process and to make this rate more deterministic. > By no means the proposed solution is considered the best and was chosen > because it was simple to implement and allowed for test data collection. > The downside of this solution is that it requires additional “expedite” > hint for something which has to be fast in all cases. Would be great to > find a way that does not require additional hints. I have to say I do not like this much. It is abusing an implementation detail of the OOM implementation and makes it an official API. Also there are some non trivial assumptions to be fullfilled to use the current oom_reaper. First of all all the process groups that share the address space have to be killed. How do you want to guarantee/implement that with a simply kill to a thread/process group? > Other possible approaches include: > - Implementing a dedicated syscall to perform opportunistic reclaim in the > context of the process waiting for the victim’s death. A natural boost > bonus occurs if the waiting process has high or RT priority and is not > limited by cpuset cgroup in its CPU choices. > - Implement a mechanism that would perform opportunistic reclaim if it’s > possible unconditionally (similar to checks in task_will_free_mem()). > - Implement opportunistic reclaim that uses shrinker interface, PSI or > other memory pressure indications as a hint to engage. I would question whether we really need this at all? Relying on the exit speed sounds like a fundamental design problem of anything that relies on it. Sure task exit might be slow, but async mm tear down is just a mere optimization this is not guaranteed to really help in speading things up. OOM killer uses it as a guarantee for a forward progress in a finite time rather than as soon as possible. -- Michal Hocko SUSE Labs