Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3206113pxb; Mon, 1 Mar 2021 04:29:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJwXmZx4ocy9ufG+3q4xw81dcP1pIG5Jl1d5J0DE1nkh4DYn8vP+7fq9IdjLfkX1nCJ/Y71t X-Received: by 2002:a17:906:f0c3:: with SMTP id dk3mr15473647ejb.540.1614601754126; Mon, 01 Mar 2021 04:29:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614601754; cv=none; d=google.com; s=arc-20160816; b=as6/vO/79H/XFRvO5dQohvtGCT80hPpQen0FHT03e9MkNzmQE6TPbIhbhNX7JEg+sx IVtV3lk+libysneS5kmSgWzYk01wdSHU/7ZJFokpLZA9o/o6AB0apylzLFBR7sRVeToZ sJKUppnrkVrbEX6fcVes3QX0JdKpaFh53wmGVwMBULTlhfYTZHCRW/i4MIyCx3nV6DHX UkLmKCRVKGB4EGvgZ5QA84PLtZpULuzeXfhacS78kwiweAjW+G9OFLyxRIZIY06Ip60F x0Ykq5o6gu3TqbdWCD0D7smh+Dwt0xuBGu3aKqUbDe0xVE2+HoS7ZAKSn882sMMYVLo0 v4JA== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=4e5MHeBWKUeRuWwrRN4F6v9QXnyfuUzg8gdWTjEdSqM=; b=USdLLe8QSIbghJZ9ObNJYw+lhQ1S0MGny3/0fVbn1mW1fTWT33YCYH1HZGjCHkFeHu s4ovgdczy61MoS5tUeENijfmV2WgfEB3xQlMDj0KGJ6ItJYr0DNL7JDJ7URLwJd7KLT9 a0Dlgz3bf/WOEtqJXbomgAaGzBVBR8Lo30TfT1oLJgXtpzAhpbpB4JeinhF7BUawd0bz RJBJgQZOV5CHYatjNvqqS5JQlnn06IbRO8nq4vRgDgeph2NGwVtlJ0mXB6aNXj1bjBZR Ez6E2kfXBi1+4T60tx0CFL7CnardUKcXfsNCTXqUiSrf8vrh950wlAEKJeBqIgZXzZHu XIsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=Fv+Mhst1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b8si880415edz.99.2021.03.01.04.28.51; Mon, 01 Mar 2021 04:29:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=Fv+Mhst1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234144AbhCAMZe (ORCPT + 99 others); Mon, 1 Mar 2021 07:25:34 -0500 Received: from mx2.suse.de ([195.135.220.15]:44356 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233559AbhCAMZc (ORCPT ); Mon, 1 Mar 2021 07:25:32 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1614601485; 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=4e5MHeBWKUeRuWwrRN4F6v9QXnyfuUzg8gdWTjEdSqM=; b=Fv+Mhst1p1X2WCTKlqJ9E0maHOvbj9R5gK7b5JimaCIkQTFmdYibMYSzgt1pTbuU6xo65u LgdWWmvuZDMdP4UAU4UbjaWlfXNtFIeDklFRYjLOz7GZVsLWD74aI5ALutzCgF28FQxfMw 0LdXP4KRPF9ogyGljs12sUzVbfqOCV4= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 23E67AE30; Mon, 1 Mar 2021 12:24:45 +0000 (UTC) Date: Mon, 1 Mar 2021 13:24:39 +0100 From: Michal Hocko To: Yang Shi Cc: Johannes Weiner , Roman Gushchin , Shakeel Butt , Andrew Morton , Jonathan Corbet , Linux MM , Linux Kernel Mailing List Subject: Re: [PATCH] doc: memcontrol: add description for oom_kill Message-ID: References: <20210226021254.3980-1-shy828301@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 26-02-21 11:19:51, Yang Shi wrote: > On Fri, Feb 26, 2021 at 8:42 AM Yang Shi wrote: > > > > On Thu, Feb 25, 2021 at 11:30 PM Michal Hocko wrote: > > > > > > On Thu 25-02-21 18:12:54, Yang Shi wrote: > > > > When debugging an oom issue, I found the oom_kill counter of memcg is > > > > confusing. At the first glance without checking document, I thought it > > > > just counts for memcg oom, but it turns out it counts both global and > > > > memcg oom. > > > > > > Yes, this is the case indeed. The point of the counter was to count oom > > > victims from the memcg rather than matching that to the source of the > > > oom. Rememeber that this could have been a memcg oom up in the > > > hierarchy as well. Counting victims on the oom origin could be equally > > > > Yes, it is updated hierarchically on v2, but not on v1. I'm supposed > > this is because v1 may work in non-hierarchcal mode? If this is the > > only reason we may be able to remove this to get aligned with v2 since > > non-hierarchal mode is no longer supported. > > BTW, having the counter recorded hierarchically may help out one of > our usecases. We want to monitor the oom_kill for some services, but > systemd would wipe out the cgroup if the service is oom killed then > restart the service from scratch (it means create a brand new cgroup > with the same name). So this systemd behavior makes the counter > useless if it is not recorded hierarchically. Just to make sure I understand correctly. You have a setup where memcg for a service has a hard limit configured and it is destroyed when oom happens inside that memcg. A new instance is created at the same place of the hierarchy with a new memcg. Your problem is that the oom killed memcg will not be recorded in its parent oom event and the information will get lost with the torn down memcg. Correct? If yes then how do you tell which of the child cgroup was killed from the parent counter? Or is there only a single child? Anyway, cgroup v2 will offer the hierarchical behavior. Do you have any strong reasons that you cannot use v2? -- Michal Hocko SUSE Labs