From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0B48EC433DF for ; Mon, 17 Aug 2020 15:55:52 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B45F8207FF for ; Mon, 17 Aug 2020 15:55:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="UZIc8ZT9" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B45F8207FF Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 0F2358D0003; Mon, 17 Aug 2020 11:55:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0A3636B0026; Mon, 17 Aug 2020 11:55:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id ED60C8D0003; Mon, 17 Aug 2020 11:55:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0188.hostedemail.com [216.40.44.188]) by kanga.kvack.org (Postfix) with ESMTP id D89D76B0025 for ; Mon, 17 Aug 2020 11:55:50 -0400 (EDT) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 738B333CD for ; Mon, 17 Aug 2020 15:55:50 +0000 (UTC) X-FDA: 77160511260.08.maid81_580b4a327017 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin08.hostedemail.com (Postfix) with ESMTP id 4BF9D1819E772 for ; Mon, 17 Aug 2020 15:55:50 +0000 (UTC) X-HE-Tag: maid81_580b4a327017 X-Filterd-Recvd-Size: 6175 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by imf18.hostedemail.com (Postfix) with ESMTP for ; Mon, 17 Aug 2020 15:55:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1597679749; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=k6oJC/PPG0hRAekHdOQPH1JgLE6OMEX6unSGcCgCQZY=; b=UZIc8ZT9SHUbkSNwH0XZx050YBY/Bwi1mbvNPLPHRbhBRUxkfj62AVaLneRyDBHZXfYH9s 1fnUpBN0nj5ZIW4sMvg9Eob/5azR86xWlb87uq3ZLAxk5gIIol0XI9aegJglRvjie6kuHA cqFLexZ0kabwvNP3lrXl6ZmiBVstOug= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-223-Rbny8aeWOpiIteDTxPfBTQ-1; Mon, 17 Aug 2020 11:55:44 -0400 X-MC-Unique: Rbny8aeWOpiIteDTxPfBTQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 81E101DDEB; Mon, 17 Aug 2020 15:55:42 +0000 (UTC) Received: from llong.remote.csb (ovpn-118-35.rdu2.redhat.com [10.10.118.35]) by smtp.corp.redhat.com (Postfix) with ESMTP id 950E37D901; Mon, 17 Aug 2020 15:55:37 +0000 (UTC) Subject: Re: [RFC PATCH 0/8] memcg: Enable fine-grained per process memory control To: Michal Hocko Cc: Andrew Morton , Johannes Weiner , Vladimir Davydov , Jonathan Corbet , Alexey Dobriyan , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-fsdevel@vger.kernel.org, cgroups@vger.kernel.org, linux-mm@kvack.org References: <20200817140831.30260-1-longman@redhat.com> <20200817152655.GE28270@dhcp22.suse.cz> From: Waiman Long Organization: Red Hat Message-ID: Date: Mon, 17 Aug 2020 11:55:37 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: <20200817152655.GE28270@dhcp22.suse.cz> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Rspamd-Queue-Id: 4BF9D1819E772 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam03 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 8/17/20 11:26 AM, Michal Hocko wrote: > On Mon 17-08-20 10:08:23, Waiman Long wrote: >> Memory controller can be used to control and limit the amount of >> physical memory used by a task. When a limit is set in "memory.high" in >> a v2 non-root memory cgroup, the memory controller will try to reclaim >> memory if the limit has been exceeded. Normally, that will be enough >> to keep the physical memory consumption of tasks in the memory cgroup >> to be around or below the "memory.high" limit. >> >> Sometimes, memory reclaim may not be able to recover memory in a rate >> that can catch up to the physical memory allocation rate. In this case, >> the physical memory consumption will keep on increasing. When it reaches >> "memory.max" for memory cgroup v2 or when the system is running out of >> free memory, the OOM killer will be invoked to kill some tasks to free >> up additional memory. However, one has little control of which tasks >> are going to be killed by an OOM killer. Killing tasks that hold some >> important resources without freeing them first can create other system >> problems down the road. >> >> Users who do not want the OOM killer to be invoked to kill random >> tasks in an out-of-memory situation can use the memory control >> facility provided by this new patchset via prctl(2) to better manage >> the mitigation action that needs to be performed to various tasks when >> the specified memory limit is exceeded with memory cgroup v2 being used. >> >> The currently supported mitigation actions include the followings: >> >> 1) Return ENOMEM for some syscalls that allocate or handle memory >> 2) Slow down the process for memory reclaim to catch up >> 3) Send a specific signal to the task >> 4) Kill the task >> >> The users that want better memory control for their applicatons can >> either modify their applications to call the prctl(2) syscall directly >> with the new memory control command code or write the desired action to >> the newly provided memctl procfs files of their applications provided >> that those applications run in a non-root v2 memory cgroup. > prctl is fundamentally about per-process control while cgroup (not only > memcg) is about group of processes interface. How do those two interact > together? In other words what is the semantic when different processes > have a different views on the same underlying memcg event? As said in a previous mail, this patchset is derived from a customer request and per-process control is exactly what the customer wants. That is why prctl() is used. This patchset is intended to supplement the existing memory cgroup features. Processes in a memory cgroup that don't use this new API will behave exactly like before. Only processes that opt to use this new API will have additional mitigation actions applied on them in case the additional limits are reached. > > Also the above description doesn't really describe any usecase which > struggles with the existing interface. We already do allow slow down and > along with PSI also provide user space control over close to OOM > situation. > The customer that request it was using Solaris. Solaris does allow per-process memory control and they have tools that rely on this capability. This patchset will help them migrate off Solaris easier. I will look closer into how PSI can help here. Thanks, Longman