Received: by 10.192.165.148 with SMTP id m20csp1127194imm; Thu, 10 May 2018 06:08:29 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqwMP6tPujI6U/TtDsdT0xcZ+7WLQrqMqvxmiS18SrwrwI47oQxa+nCE6KqCKM9Ys5yXlL6 X-Received: by 2002:a62:9056:: with SMTP id a83-v6mr1364504pfe.186.1525957709629; Thu, 10 May 2018 06:08:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525957709; cv=none; d=google.com; s=arc-20160816; b=J/Ikts3BKl6JzSyI3o0m67OI1gy/8qoCkj4KnzVzoon1kW5uScSvc66fsGrykjcNvv ZQuV6O3TGm8H1jAQtLVe72/77FlZ/q0pte/m976Ce8hF37l7RqQx2vjBJezO0KLH5Y4l oD17dUyvc0IDZYXyl5qm016pGz9st+i2ReSEXDc2i31hPqCv7rrkkzOlswDJU/R7Kw3V Yn66qInp4egU/emJO9wgs0mJrGDHMri4Y7ipuAfALaTBITyllIq57utNqMDHMrxujmvD 96wyRZ1PG+go4l8LRenxQeT7JTAG/72RTnWyYqMw0M/J0AhbiL+aD14O/XM9SB1636Ml 8g+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=NA/FZoXiFvJLwJ5ZhNjUiBSrGzaoHHFuBjC8uGQwQjM=; b=dXS6mWYsD/4mtd0vEns6PIRo+8ziJqSL+HbZrcTutqu+NkdvPDkZXg8xALTT7JcVUT Y6U5p0Aix/kyMhJg9XqcF0QtAssrg2W7XPDwj2M3TrlGCBAP8H4gDULwfpWwOtCohUQM fjekugxzJzOYvQ0QQ2nhxHYPUSmjFSpw0z0v/uIzatERcwQAfPbmszQwh61B71fhebBd jv/EG9ldQegb8pFFvM1e/U5DkKTh4BUTO8ZFV/1/QagXBgvGNOuhP/mgAKeQT9/X9iXz lOt95qsLD3z+TdtvaN345ETuC1Qnwp8OEIRPB8icWDLLHIstZU3XYGx6is9Bxwm++5vg ia8Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y4-v6si620628pgc.588.2018.05.10.06.08.14; Thu, 10 May 2018 06:08:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757235AbeEJNIE (ORCPT + 99 others); Thu, 10 May 2018 09:08:04 -0400 Received: from mx2.suse.de ([195.135.220.15]:43083 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757200AbeEJNID (ORCPT ); Thu, 10 May 2018 09:08:03 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id E25FAAD79; Thu, 10 May 2018 13:08:01 +0000 (UTC) Date: Thu, 10 May 2018 15:07:59 +0200 From: Michal Hocko To: Roman Gushchin Cc: kernel-team@fb.com, Johannes Weiner , Vladimir Davydov , Andrew Morton , Konstantin Khlebnikov , linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v2] mm: fix oom_kill event handling Message-ID: <20180510130759.GG5325@dhcp22.suse.cz> References: <20180508124637.29984-1-guro@fb.com> <20180510114147.GB5325@dhcp22.suse.cz> <20180510121251.GA6762@castle.DHCP.thefacebook.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180510121251.GA6762@castle.DHCP.thefacebook.com> User-Agent: Mutt/1.9.5 (2018-04-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 10-05-18 13:12:56, Roman Gushchin wrote: > On Thu, May 10, 2018 at 01:41:47PM +0200, Michal Hocko wrote: > > On Tue 08-05-18 13:46:37, Roman Gushchin wrote: > > > Commit e27be240df53 ("mm: memcg: make sure memory.events is > > > uptodate when waking pollers") converted most of memcg event > > > counters to per-memcg atomics, which made them less confusing > > > for a user. The "oom_kill" counter remained untouched, so now > > > it behaves differently than other counters (including "oom"). > > > This adds nothing but confusion. > > > > > > Let's fix this by adding the MEMCG_OOM_KILL event, and follow > > > the MEMCG_OOM approach. This also removes a hack from > > > count_memcg_event_mm(), introduced earlier specially for the > > > OOM_KILL counter. > > > > I agree that the current OOM_KILL is confusing. But do we really need > > another memcg_memory_event_mm helper used for only one counter rather > > than reuse memcg_memory_event. __oom_kill_process doesn't have the memcg > > but nothing should really prevent us from adding the context > > (oom_control) there, no? > > Not sure, that I follow. oom_control has memcg pointer, > but it's a pointer to a cgroup, where OOM happened. > In particular, it's NULL for a system-wide OOM. > > And we do send the OOM_KILL event to the cgroup, > which actually contains the process. You are right! For some reason I thought we do count events on the hierarchy which is under OOM. I was wrong. Acked-by: Michal Hocko -- Michal Hocko SUSE Labs