Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp583778rwb; Thu, 1 Dec 2022 06:05:34 -0800 (PST) X-Google-Smtp-Source: AA0mqf74hle2VZjHQNyiVrIMPxEbr3JjNXd+r0RipDWygvA7t8Ki4t1/B8I5BzQeuQ6nGX77fwTF X-Received: by 2002:a17:902:7898:b0:188:584d:b6d4 with SMTP id q24-20020a170902789800b00188584db6d4mr48446386pll.170.1669903534375; Thu, 01 Dec 2022 06:05:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669903534; cv=none; d=google.com; s=arc-20160816; b=J9f0jQDmF3kLglrEfH7WaDruGfJequAszkzzanYufaDQoN6qBr9BQ7t+6DoZ2td+jr 9wuY9tQxPEWN5e1+x58nO3GBiZNCxvd9Y2aXrUNZjYGARnnuUPjZKrmSvcAN0IhqykoO t6fL8zmyRunSlQZYhoqVFsd0igHNyDueu4TtNMakMnlutqvke0HwTgyDDVSBrFQu79Va jcDpmJUWDXzbleyXxJyK214sKoQDDbZtUOXaYuMpWh7NBDiFWDJHCHMjg73iuqA1fYJe FoRNXFX38O1g1gWmwfBqXOf3b/DiGwfI3Nfd72BaauZnGLbj94/m1+X1thbXLnDGjYeN Y1Hw== 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=K/3E4rKV56hZO1ZYVzKhSOwwyXDyBi7M71us9jjagdo=; b=yaFJmB1ettU012xOMClnhDfc7d4XKBKkqe6wK4lK2oHAeA8PIlDsNRh1lT8/GqA5se rEq4pzJ0+AQHxAGi7aPA9hoGMTTswfMtbOwkHRjgrfoAwGsPQH/XPyLJyTqoXniD4jEA ctjgGUTUEURthem9zqlJmw1H58XDIm8uOkqlsqnbq5tXRZkoDyZTgNzv4Ofeggrr/4kr oSH6PSvKGvtXYm4+Bu99KYdKgzzoh/ZP1MkG6AVSeSt434VD9rGVuQ2U/Et1c/HolpeZ vBfNEAZJggkglrHkDRcAMB6dOgSnCGEmgvg5p0ZN9ybDQhzi2AibPv/aixNl7CdYQztC nAmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=ZC25gQgY; 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 n2-20020a170902d2c200b0017a50d7258dsi5129920plc.97.2022.12.01.06.05.23; Thu, 01 Dec 2022 06:05:34 -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=ZC25gQgY; 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 S230471AbiLANIe (ORCPT + 82 others); Thu, 1 Dec 2022 08:08:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229717AbiLANIc (ORCPT ); Thu, 1 Dec 2022 08:08:32 -0500 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2EDD845A0C; Thu, 1 Dec 2022 05:08:28 -0800 (PST) Received: from imap1.suse-dmz.suse.de (imap1.suse-dmz.suse.de [192.168.254.73]) (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 C27961FD81; Thu, 1 Dec 2022 13:08:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1669900106; 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=K/3E4rKV56hZO1ZYVzKhSOwwyXDyBi7M71us9jjagdo=; b=ZC25gQgYpHLJv3sUQUpw833y1NbAm84Kj96hRcqLaxWPqonFdDKoAEQwY8o+h5Urr4f/94 sYhbrouqe8Sz2mT73RyW2KuWQ0ZQZVfQyN3N+lHgNLROGt3f2Q2frfuTwFrG8knt0CulCG XireW5USxtH4hjxIvL59nH4fLlaqq3M= Received: from imap1.suse-dmz.suse.de (imap1.suse-dmz.suse.de [192.168.254.73]) (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 imap1.suse-dmz.suse.de (Postfix) with ESMTPS id A9BA313503; Thu, 1 Dec 2022 13:08:26 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap1.suse-dmz.suse.de with ESMTPSA id uwI1KUqniGPoBQAAGKfGzw (envelope-from ); Thu, 01 Dec 2022 13:08:26 +0000 Date: Thu, 1 Dec 2022 14:08:26 +0100 From: Michal Hocko To: =?utf-8?B?56iL5Z6y5rab?= Chengkaitao Cheng Cc: Tao pilgrim , "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" , "cgel.zte@gmail.com" , "ran.xiaokai@zte.com.cn" , "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" , Bagas Sanjaya , "linux-mm@kvack.org" , Greg Kroah-Hartman Subject: Re: [PATCH] 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 01-12-22 13:44:58, Michal Hocko wrote: > On Thu 01-12-22 10:52:35, 程垲涛 Chengkaitao Cheng wrote: > > At 2022-12-01 16:49:27, "Michal Hocko" wrote: [...] > > >Why cannot you simply discount the protection from all processes > > >equally? I do not follow why the task_usage has to play any role in > > >that. > > > > If all processes are protected equally, the oom protection of cgroup is > > meaningless. For example, if there are more processes in the cgroup, > > the cgroup can protect more mems, it is unfair to cgroups with fewer > > processes. So we need to keep the total amount of memory that all > > processes in the cgroup need to protect consistent with the value of > > eoom.protect. > > You are mixing two different concepts together I am afraid. The per > memcg protection should protect the cgroup (i.e. all processes in that > cgroup) while you want it to be also process aware. This results in a > very unclear runtime behavior when a process from a more protected memcg > is selected based on its individual memory usage. Let me be more specific here. Although it is primarily processes which are the primary source of memcg charges the memory accounted for the oom badness purposes is not really comparable to the overal memcg charged memory. Kernel memory, non-mapped memory all that can generate rather interesting cornercases. -- Michal Hocko SUSE Labs