Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3689892imu; Mon, 28 Jan 2019 09:06:35 -0800 (PST) X-Google-Smtp-Source: ALg8bN7q0BoAtAAD6LwI9Hl3vBwb8T5FL8q9Qa43lihlcXuLMGlvTSMEa9CD9mGfcHBzPMXhJ6QX X-Received: by 2002:a17:902:70c6:: with SMTP id l6mr16520040plt.30.1548695195691; Mon, 28 Jan 2019 09:06:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548695195; cv=none; d=google.com; s=arc-20160816; b=cojftAYXq3+btkWMULUQWH/r5B7ahOBc92Inx+Eu/YKppeujg2BelsN+95Xa+HAfG9 qa/h6juBouAXaSxe6MzVpZwYY5NlNuMmYC1S/tc6rgWd159/HQ1sBtNtpMyH7rciJR3V TmjSVwGNw9+KvxsZtBOMGvKPOw4j/nu+NQtMPY80JkEsBpKcOGIsHw+wnZIT9tqgeH6C 1lG+WPGeGtRD3Ed8SnPX08dHqaHZ9UgqRVAsQtB9Ceq87vmZoHeXiFbPufKtPDoUfZHE gZ1aCJS2q2eUQFH88MwpahuD9y3iWxqZHzdpNfXLzeqkIhbp/NKjEuyD2LcLyiaNEnX/ EA/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; bh=Zx+Y/aRKp4CmUhZaZYeRQinQx2Q0AeBydieP60CheHs=; b=joL5R+gGn3AeKLKW3Lk5xo3fCoUrRtWCtO0GhWUFKNdQEL0su6YybozzOM/Ko1vQY1 4FRbIvH48XEUYdZ3D+g8ny5JjZ9U6E59zsSMeSDkNkr4ETlQWCgVIIi61kkBIrvUeWgC rbHDwysg3TCRiYW7yRBg2U8QoSRkF1T0tdnWcH2P5nsfkZyQXJHXoxK3UZ/8ffhDv97p KKThZyc25aglGiuBjus6QrvUT8NcRuWcjcSn4zbwMOLO+NmmPmrJJGkFJxyj0x4L6CKU LVL9svKFI2qYGE17PIrcfM/e5oaA7kQ1V2NZ7TeihgFHvGJeb978t8DNEVgU5mY4q+eY R8JQ== 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 d34si31987850pgb.43.2019.01.28.09.06.19; Mon, 28 Jan 2019 09:06:35 -0800 (PST) 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 S2387564AbfA1RFb (ORCPT + 99 others); Mon, 28 Jan 2019 12:05:31 -0500 Received: from mx2.suse.de ([195.135.220.15]:35868 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730743AbfA1RF3 (ORCPT ); Mon, 28 Jan 2019 12:05:29 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 95488AFCC; Mon, 28 Jan 2019 17:05:27 +0000 (UTC) Date: Mon, 28 Jan 2019 18:05:26 +0100 From: Michal Hocko To: Tejun Heo Cc: Johannes Weiner , Chris Down , Andrew Morton , Roman Gushchin , Dennis Zhou , linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-mm@kvack.org, kernel-team@fb.com Subject: Re: [PATCH 2/2] mm: Consider subtrees in memory.events Message-ID: <20190128170526.GQ18811@dhcp22.suse.cz> References: <20190125074824.GD3560@dhcp22.suse.cz> <20190125165152.GK50184@devbig004.ftw2.facebook.com> <20190125173713.GD20411@dhcp22.suse.cz> <20190125182808.GL50184@devbig004.ftw2.facebook.com> <20190128125151.GI18811@dhcp22.suse.cz> <20190128142816.GM50184@devbig004.ftw2.facebook.com> <20190128145210.GM18811@dhcp22.suse.cz> <20190128145407.GP50184@devbig004.ftw2.facebook.com> <20190128151859.GO18811@dhcp22.suse.cz> <20190128154150.GQ50184@devbig004.ftw2.facebook.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190128154150.GQ50184@devbig004.ftw2.facebook.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 28-01-19 07:41:50, Tejun Heo wrote: > Hello, Michal. > > On Mon, Jan 28, 2019 at 04:18:59PM +0100, Michal Hocko wrote: > > How do you make an atomic snapshot of the hierarchy state? Or you do > > not need it because event counters are monotonic and you are willing to > > sacrifice some lost or misinterpreted events? For example, you receive > > an oom event while the two children increase the oom event counter. How > > do you tell which one was the source of the event and which one is still > > pending? Or is the ordering unimportant in general? > > Hmm... This is straightforward stateful notification. Imagine the > following hierarchy. The numbers are the notification counters. > > A:0 > / \ > B:0 C:0 > > Let's say B generates an event, soon followed by C. If A's counter is > read after both B and C's events, nothing is missed. > > Let's say it ends up generating two notifications and we end up > walking down inbetween B and C's events. It would look like the > following. > > A:1 > / \ > B:1 C:0 > > We first see A's 0 -> 1 and then start scanning the subtrees to find > out the origin. We will notice B but let's say we visit C before C's > event gets registered (otherwise, nothing is missed). Yeah, that is quite clear. But it also assumes that the hierarchy is pretty stable but cgroups might go away at any time. I am not saying that the aggregated events are not useful I am just saying that it is quite non-trivial to use and catch all potential corner cases. Maybe I am overcomplicating it but one thing is quite clear to me. The existing semantic is really useful to watch for the reclaim behavior at the current level of the tree. You really do not have to care what is happening in the subtree when it is clear that the workload itself is underprovisioned etc. Considering that such a semantic already existis, somebody might depend on it and we likely want also aggregated semantic then I really do not see why to risk regressions rather than add a new memory.hierarchy_events and have both. -- Michal Hocko SUSE Labs