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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7901AC4332F for ; Thu, 8 Dec 2022 07:33:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 950A58E0003; Thu, 8 Dec 2022 02:33:11 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 901058E0001; Thu, 8 Dec 2022 02:33:11 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7EF9D8E0003; Thu, 8 Dec 2022 02:33:11 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 729F08E0001 for ; Thu, 8 Dec 2022 02:33:11 -0500 (EST) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 43B141A023D for ; Thu, 8 Dec 2022 07:33:11 +0000 (UTC) X-FDA: 80218322982.18.95F9200 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf04.hostedemail.com (Postfix) with ESMTP id 847D440016 for ; Thu, 8 Dec 2022 07:33:09 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=nDYXvrFz; spf=pass (imf04.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.29 as permitted sender) smtp.mailfrom=mhocko@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1670484789; a=rsa-sha256; cv=none; b=TIpGbisfCYpqWuYH45om+oHLgxuGOGGF2mpaV5h24N64JlNNsqi933Hy/u7erEM13GbN3F a43auopX+wRSLj7w8Vb87LNdTh/F6ch7ScmmVRTUYOGSADmsQB32dDmxbvEOlxMY2v+575 +RQP2bJRfYiRYlY/ZX9K9neh6S3+bN4= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=nDYXvrFz; spf=pass (imf04.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.29 as permitted sender) smtp.mailfrom=mhocko@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1670484789; h=from:from:sender: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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=JXDfWNY3Qbfl8rtTtlddtnpeaKhAduAL7p+BYr8IZ2k=; b=HiGoe+orcb/WLVqh0LTxTL9aVVZJxwhC29sbXpMr0WKtcNuSJN8EIgzrnH6z+nAEuYk1O9 JzQrUcphzjmunML07ZMIvnsPLitapceMe51dGoB13JpDYdomX8N3A11si1qPSAOKLd+7WW gJ5I/TKt02xzygP1UBvv5KiNvoc/Dko= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id D305620717; Thu, 8 Dec 2022 07:33:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1670484787; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=JXDfWNY3Qbfl8rtTtlddtnpeaKhAduAL7p+BYr8IZ2k=; b=nDYXvrFzHssNJikFT/o1HPTD29lvSXSarooGqRFa9kKWHGxdsciSmZFTpedjC7WMaWFBAN 3NkUZ+LYtt1ZA3o52N+KGeToMqt34WShBl8hgNMKmGxggv5/v4inFygp7VUzQs8Nwgr4HB sOfiPaSwz3k+ByjhpMiDeFZADJ63wqo= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id AA243138E0; Thu, 8 Dec 2022 07:33:07 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id FLl/KTOTkWOuDQAAMHmgww (envelope-from ); Thu, 08 Dec 2022 07:33:07 +0000 Date: Thu, 8 Dec 2022 08:33:07 +0100 From: Michal Hocko To: chengkaitao Cc: tj@kernel.org, lizefan.x@bytedance.com, hannes@cmpxchg.org, corbet@lwn.net, roman.gushchin@linux.dev, shakeelb@google.com, akpm@linux-foundation.org, songmuchun@bytedance.com, chengkaitao@didiglobal.com, viro@zeniv.linux.org.uk, zhengqi.arch@bytedance.com, ebiederm@xmission.com, Liam.Howlett@oracle.com, chengzhihao1@huawei.com, haolee.swjtu@gmail.com, yuzhao@google.com, willy@infradead.org, vasily.averin@linux.dev, vbabka@suse.cz, surenb@google.com, sfr@canb.auug.org.au, mcgrof@kernel.org, sujiaxun@uniontech.com, feng.tang@intel.com, cgroups@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v2] mm: memcontrol: protect the memory in cgroup from being oom killed Message-ID: References: <20221208034644.3077-1-chengkaitao@didiglobal.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221208034644.3077-1-chengkaitao@didiglobal.com> X-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 847D440016 X-Stat-Signature: 6irn74q61ribwydxx4wg1cppccmsguf6 X-HE-Tag: 1670484789-503158 X-HE-Meta: U2FsdGVkX1+A+U7u95eFBydETvukKlwBYOIdivBVbu8gW49hvcXFkdkSE62lJf/rUCPZe0eY+E59YNDmQ7mc1tJ9GoIxpGnYx4t2pSmV612gGiSQMqtLDIYKGsXCN7fwxX2UCIVXodgduVCecY1TcJ25AQJXlrQE96THT0RtLKs/ikRec0dFT0XlnonoCNp6RSNZMUPpWdkgoJPdqZktUSdAaY3lfd1c4kpsatFVcXBoUAgtGb+MjvLoqJL7Y2F6pejYTBwayiFjl2Dv398UMASOadj3YgzCGdH2Ma9U4nZTQy+EfLovFFAVsvy6PYZvUK2hDYJBAJQIicLvSIZHF2HNL28mUZ2fRbuKuTU8HGVBcIFlwraIrDV4iiMfu32dyGbSh3wkeF0PZ2Cn3Lzh6dCRMoyBQ1ihhH/yaJ1z5eaYEzuklCq5RyOuYXWQTVIxmzOPoycHP734Pk/zRwkf5wdHKxzVBdxfxqhWfzpFdOs5nGcEWRfFp9T7eCjsyS0SlI25jKASFWZ19JdYIN1HQAheYLLPjduUDRJqfu6+4fnbskkEY1zz5X/l8Wqm0D1AzhQIUZa1eJaY8kqN6k7t7ppiean1SEf7WbSAOom7N2Fes9W7no1Go7OgYyOwNhmR8fEulMUKJrd4YkTinAsHKhCseGuV/FUyaSpHfmC/lTjTovkNPVODdCyso5hCxNpvuhTVSNOZO7UpvbQ/lySgkjOjziWU5F8IJ1D/NbpNOcdlvDi/0vbplTxsu9hhliIFoNU+iN/2II6ctunyTI3G2+qjQ+1qvu+fdemTElV1xvfnaAQrQJuy37cZQowqFMdIhB2vLfwYYV7yb71TKULJKoYmHdc9NESJ5JqUEfnRi2GuieR5iLzkVfQP0F4PwW5jD/KSrXhUORxwGq6VzNtvbH+bJJ41rwF119zU8arUqaRP0U+tQJLfsw== 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 Thu 08-12-22 11:46:44, chengkaitao wrote: > From: chengkaitao > > We created a new interface for memory, If there is > the OOM killer under parent memory cgroup, and the memory usage of a > child cgroup is within its effective oom.protect boundary, the cgroup's > tasks won't be OOM killed unless there is no unprotected tasks in other > children cgroups. It draws on the logic of in the > inheritance relationship. > > It has the following advantages, > 1. We have the ability to protect more important processes, when there > is a memcg's OOM killer. The oom.protect only takes effect local memcg, > and does not affect the OOM killer of the host. > 2. Historically, we can often use oom_score_adj to control a group of > processes, It requires that all processes in the cgroup must have a > common parent processes, we have to set the common parent process's > oom_score_adj, before it forks all children processes. So that it is > very difficult to apply it in other situations. Now oom.protect has no > such restrictions, we can protect a cgroup of processes more easily. The > cgroup can keep some memory, even if the OOM killer has to be called. > > Signed-off-by: chengkaitao > --- > v2: Modify the formula of the process request memcg protection quota. The new formula doesn't really address concerns expressed previously. Please read my feedback carefully again and follow up with questions if something is not clear. -- Michal Hocko SUSE Labs