Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp635248rwb; Thu, 8 Dec 2022 00:33:28 -0800 (PST) X-Google-Smtp-Source: AA0mqf4g6g8P0FhyZOzjKwlKKoS/+GDY2Q572TFvAfXEQ6VTgrICPLVLvj6ssSxBVJ1bwUYR4oBs X-Received: by 2002:a17:906:70c2:b0:7ae:d58e:3a4a with SMTP id g2-20020a17090670c200b007aed58e3a4amr63451760ejk.332.1670488408164; Thu, 08 Dec 2022 00:33:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670488408; cv=none; d=google.com; s=arc-20160816; b=WZ+AXmaVM81LLldb/tLmVTZjakpxpo7f2Gm3U0/vgYczaW7uAY321sX1C8LYmq4srO xsciBJpy/BeQ4GjmdGd0K1l0lw8nJBvLU2LMtDpMFICfOsMVjzOgh7K7x5FQLYpvw/3O OcgtcyYjZjnN05yiW9fC+JCYzd62fe6zGojjbZkaQiGbCrAldtCh+ka4+WUqdUSNJvtf /wHYPYAUyJAnQqWyZ9o50LsozTlY29A+QGCAUznSQ/R5ipUMkTpm3LZCvDFtqpd7iTqP AlEuhhh4ao0rwcfF7Lhi8Sj8uFZvw4ZZbe+L5QUwr3TIW3ZfBoVtNX5DuHmrnQLUmfBu gqeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=u0hWHCxU1/envycw51Ct9du7tEezNa6pk2WQ6bJqy/w=; b=eb0AhJ5ad+Xaz+nAL32HBqWhhFg+JoKMskTJkp42p489X86LqIlg1X9ty6jbxcmNOA S0OXCLzc/O3ZVuok7FEllHaYXIy/QeCX53umkG5w9BGmWTezUncuDZ1RX+aeWwp9li8y VviiluwzbEfmtsUmgsZNeRLgudcqsqSt9sYyCGEqXltkrKXCKSp//pkNB6+fQl6Pylrq lH9y4bvlS1rTLKl8bBFtqLB7gZybWpgRCOGJLHBb7xgiwvE68+uCxiJqLib7qH5faGrU t+baGAs7LBznJqjgWX5a/zECUWaM2iYzGr8l9ZH8VqvivKXy0IAS88dxBUYTMqitoy8b B+ug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=qSOLY1dx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ec1-20020a0564020d4100b0046b55a18bc4si5454149edb.436.2022.12.08.00.33.09; Thu, 08 Dec 2022 00:33:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=qSOLY1dx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229845AbiLHIOc (ORCPT + 74 others); Thu, 8 Dec 2022 03:14:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229877AbiLHIOU (ORCPT ); Thu, 8 Dec 2022 03:14:20 -0500 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 770615B595; Thu, 8 Dec 2022 00:14:12 -0800 (PST) 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-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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