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 51DE2C3A5A7 for ; Thu, 8 Dec 2022 08:14:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B07B48E0003; Thu, 8 Dec 2022 03:14:14 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id AB6758E0001; Thu, 8 Dec 2022 03:14:14 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 97F8A8E0003; Thu, 8 Dec 2022 03:14:14 -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 88C338E0001 for ; Thu, 8 Dec 2022 03:14:14 -0500 (EST) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 4FCB140AD4 for ; Thu, 8 Dec 2022 08:14:14 +0000 (UTC) X-FDA: 80218426428.06.90FE069 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf17.hostedemail.com (Postfix) with ESMTP id 9130D40006 for ; Thu, 8 Dec 2022 08:14:12 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=qSOLY1dx; spf=pass (imf17.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.28 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=1670487252; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=u0hWHCxU1/envycw51Ct9du7tEezNa6pk2WQ6bJqy/w=; b=v9xDa3apSIuX1aU/OkHM0BKejuGKzViyBUqMOtrHNMUklIsr9FImo6aCDJPALCQ+VB3zvi QRz9JTFOa4/zuqNdinmQqf4ll5fUrxqxtrBRqpwQNRj/kilH05prGOc1453FsBW1EMelxP 0Fc46aczItGXisyMTkJHNmF4icy4LGs= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=qSOLY1dx; spf=pass (imf17.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.28 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=1670487252; a=rsa-sha256; cv=none; b=aadAhMjkkQI+zvoY70CBPT9E/xHqmB/lDfrdWXSx8C8edvx8GO9Fc26p+3+IxObi3H4ucQ MfBq1Ab4ExFaU+MaptsrRQXR6zVBdkdVol9tOioIdYlKl4LQfwbE1f3DrM5Vf7CbmDDfFp 1OGgRkxlnEesMEA2Z9C5AYD5nXsrcEk= 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-out1.suse.de (Postfix) with ESMTPS id 28E733369B; Thu, 8 Dec 2022 08:14:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1670487251; h=from:from:reply-to: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=u0hWHCxU1/envycw51Ct9du7tEezNa6pk2WQ6bJqy/w=; b=qSOLY1dx+vkJzivbCTsCM6e4XSENfZXkIpKv/uIg1CATNmHjNY4qQmbEfTF1zBvlpfBfZT kuFp6GA6Rdwoo2SHhC7mZK5EewUghzIzzQc8AXOLSmLt0/rP/+25c/0VjGpPh0kd2FCN9f GxRQzJWB1DXd3jhReywaSOAFI2wqhaE= 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 EE926138E0; Thu, 8 Dec 2022 08:14:10 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id Uy66OdKckWMOHgAAMHmgww (envelope-from ); Thu, 08 Dec 2022 08:14:10 +0000 Date: Thu, 8 Dec 2022 09:14:10 +0100 From: Michal Hocko To: =?utf-8?B?56iL5Z6y5rab?= Chengkaitao Cheng Cc: chengkaitao , "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" , "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: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Stat-Signature: 98jxknu75m1j11qoqxhjft9bwabheggo X-Rspam-User: X-Rspamd-Queue-Id: 9130D40006 X-Rspamd-Server: rspam06 X-HE-Tag: 1670487252-947502 X-HE-Meta: U2FsdGVkX18yAb1Ka8rYyIYtFhvv4VOMlQEArZ1oLCLqNGElz2ZV2O8hOpPGEKfawApkZyax2nJ4KcABlJrXGQIQB9M+EH47Vu1UGquXJuT/kVQzPThZBvixxsf1khlEU5VF5ByY+x8D75i4PUdzP0D9hyZHwVGR9xKGIC+37CSBqdSHBwMNvUgvrwYEM5Y3PHsSMZwhASM37Ud/KMu1xwTk2xNqlhs+B6mIFabQgk41EsIp45IgDmPAgLv3RvODqipfMRWeSWLO1tIFo5VUNWsSjROQEoGoZVsH16MLkHW5DxMhoLu3AQDFb7junDBq1t5ZuNdE7DTAalQKIOpiggBL03PjzLh+7Z+zZp4y5uk7CdXwwhYFJfqk+w19MAnK/fBh/4qPYr1/UhxS1rCuDHtDpTx/E/gTkctHumWpZ2iwntG9anuFV36ZJhXuRdCLzA+TAbAslKsW9HUisB8AuearlNJW40ealk+hXT9ymw4uGN1V7Lw0/kPsSXSJgC5SzOlsbISNday0Sf9BRRN95UHKuOEINYB4a4RfN3PWdckfSEBU8BOr/4EoLgRo+DDwfjTAz0T90vr6RAae3CKYb25Bk8SY2kJDoLVVGWgdDpf2G5IPAFltwm3dpitsj3D9BU55ooYw+y5u/PI2DsdyyiLl94nRVi6bJ1mPvAa7xhcoqgFrep3AA1P2DuorgSGDAhEinK0ioo7v8Y+lnbdg6Yt/hNE24yyXiPf85flKjYetW5clEs/dusZGIfLZjmee5yBq6XAeLcKdCeykjYJbKFFV7mVm0s2SM+zmA8vbQdWdG/M6hlTkMlpwa2CfL0O/AamYSZS+FrL0wq5tVoHpMyboMXUduNRhVCOCX85FnO5AghHI3VrX5I7+j0C2a022ObMYhsEQ0i/ad1oyJvbDiEtHgvsAyn/Khyl1tJsMBn5hXpKc9VjWUYX/1/sUX/MPidFCEDCT//sYHC4clft AAjo1S1H CoaGn 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 07:59:27, 程垲涛 Chengkaitao Cheng wrote: > At 2022-12-08 15:33:07, "Michal Hocko" wrote: > >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. > > The previous discussion was quite scattered. Can you help me summarize > your concerns again? The most important part is http://lkml.kernel.org/r/Y4jFnY7kMdB8ReSW@dhcp22.suse.cz : Let me just emphasise that we are talking about fundamental disconnect. : Rss based accounting has been used for the OOM killer selection because : the memory gets unmapped and _potentially_ freed when the process goes : away. Memcg changes are bound to the object life time and as said in : many cases there is no direct relation with any process life time. That is to the per-process discount based on rss or any per-process memory metrics. Another really important question is the actual configurability. The hierarchical protection has to be enforced and that means that same as memory reclaim protection it has to be enforced top-to-bottom in the cgroup hierarchy. That makes the oom protection rather non-trivial to configure without having a good picture of a larger part of the cgroup hierarchy as it cannot be tuned based on a reclaim feedback. -- Michal Hocko SUSE Labs