Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3603593imu; Mon, 28 Jan 2019 07:42:19 -0800 (PST) X-Google-Smtp-Source: ALg8bN5E2l2h9hYgzZ00JzK7RWLkEWDgRGtu58h3Owbsaq3tA2ucF2HSQKplRDWDiwNGCXxvuCS6 X-Received: by 2002:a63:580a:: with SMTP id m10mr19958988pgb.332.1548690139330; Mon, 28 Jan 2019 07:42:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548690139; cv=none; d=google.com; s=arc-20160816; b=NNtUNJ/fkResFHOVNxoWdDAKCpOlDPHz0gzvlLGVtwn9COccpraOeAj69PaT1PJu5r OCGJ4K+yn9uumlzKvYBgP1kXOxF/BLJDIRmsuZNFS2v1aY/3o/6mErr8h94G53tvpupR WfvWC/ECa3KXiDPNtlI44lX/2pN0KhB4Iw87J+hdTSIA0hG1XRsMiWjqrSn1OrFTVKjj ekv3lInKCaiD4epnES8SWwazfjd+7rsPmxiH7hVFvKF6/CxTz6lgsQvwE31bg1gG5wN+ 22kUDJERN7PzErEvUZbVFHF5bxsp4yoKgpHayTGGX6NBY7RzY4xgLUyJXJNb0qtivMd1 YtwA== 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:dkim-signature; bh=wPBPoBOwIobapi6oC16zq6H6TFfwJ/3I28jXaGw7G7E=; b=GLCNhDalAllY3FO89aUOMZ50DA9cdeJ4Dp6KFfMvrcp75sXws7jdaPqfAOwEvZQnN4 EizsCgel6ru2BaWs68Mtnpe7gCZFcx1h2j9+E+3b3AONgIonsWwNfpxjqJH/5gXmKtUv WJKSXiY5XpKEBe8zFj97thG2uhPOEmRSt3AU2+cbs/Xk/K4XCfxeVElX/d0LA+xQ3FBy Z/c0ep74PtHHolr8lh0nib7JLvaw9VSoxmx0EuiksixSQj0LPB1vi/opQbNFVlvB9AXp J8QrpFQNQlgxFddHgKWtusBLsgDhPIN3pCl4pXskoqdfk22TUt8Rl30fI/VGOUaKwQVl PVwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b="u2H/PyOQ"; 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 x6si22912717pgh.363.2019.01.28.07.42.04; Mon, 28 Jan 2019 07:42:19 -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; dkim=fail header.i=@gmail.com header.s=20161025 header.b="u2H/PyOQ"; 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 S1726749AbfA1Plz (ORCPT + 99 others); Mon, 28 Jan 2019 10:41:55 -0500 Received: from mail-yb1-f196.google.com ([209.85.219.196]:37787 "EHLO mail-yb1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726266AbfA1Plz (ORCPT ); Mon, 28 Jan 2019 10:41:55 -0500 Received: by mail-yb1-f196.google.com with SMTP id 2so6834231ybw.4; Mon, 28 Jan 2019 07:41:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=wPBPoBOwIobapi6oC16zq6H6TFfwJ/3I28jXaGw7G7E=; b=u2H/PyOQXKHj3iK3PpnDcwvm6ncSmV+EqOAB3hUtcVKQdikPGsRkySFxZP/Ndmf/7r ubxpAytZAOZ4sbfd2Zwo4w1DwKJufOrluB98Eq03/6O8+a3SBvf4kJw4LbPD7oift2uK 4eWzC4te3BWZvtS33vhNSitykED9QWq/zHWOkrC4aO+NJGY9RwfpHcA87AWSQkP8uxOx qLwB7xRdKYlmYE0kpTooNI0oi+jmc2KuWbVo/rUBHLnjWEDqUHcKfb/AYm6Yh5JkhJst 90t9UPeKLs6HXbN4iJY0JPQB8PlJVJyBS0CpqXqslaBbAB9veaL8WCt3uBIbVBMviRgA TeAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=wPBPoBOwIobapi6oC16zq6H6TFfwJ/3I28jXaGw7G7E=; b=jJdmWJbnkQpJnmJgrrOxCrZ7fWIMiN+KzwCzsjupsXgTVfBTeIm1+7mI1mKhT22k4A 0FjRoPayiBI21P1FPhfON+JXnZwQxFdJPBYX8m9aq02IlvFBa2BIaMZjZdoL9bJtxp0T 2mbNCgd8s5Xr2M/MYD0gc5xuub0ADi6b877gv+kD2pQ2pj/wGFEqKSrUp2icxSGlSist Xo29t/sNjsYr23kb3DHHS/mCxicTmCd0SjlkPFHZ8NJ8vPQzBjicTk1+LV16H/FnuRAl v5vnwF/m6v8gKTmRSfyeDvzgd7Ghf+X84ynBak/KsFojDnhqdpmPvFqH2R3xPB9Q1XTH nNXQ== X-Gm-Message-State: AJcUukcWYeks+KDwZV7tid0L+1UDsKPuf2A2Pg58ZR3j0zbGXKOl8cSg BZZenQQO8chF4lh0DYW73BQ= X-Received: by 2002:a25:e90f:: with SMTP id n15mr21500266ybd.39.1548690113671; Mon, 28 Jan 2019 07:41:53 -0800 (PST) Received: from localhost ([2620:10d:c091:200::7:a62a]) by smtp.gmail.com with ESMTPSA id f188sm12623878ywc.70.2019.01.28.07.41.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 Jan 2019 07:41:52 -0800 (PST) Date: Mon, 28 Jan 2019 07:41:50 -0800 From: Tejun Heo To: Michal Hocko 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: <20190128154150.GQ50184@devbig004.ftw2.facebook.com> References: <20190124182328.GA10820@cmpxchg.org> <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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190128151859.GO18811@dhcp22.suse.cz> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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). But, no matter where you put C's event and notification, the followings hold. 1. A's count will be different from what was seen before. 2. There will be another notification queued on A. IOW, it's guaranteed that we'll notice and re-scan if we don't see C's event this time. The worst that can happen is scanning spuriously but that's true even for local events. This isn't a novel thing. It's how aggregated stateful notifications usually work (e.g. a lot of hardware interrupts behave this way). The notification is just saying "something might have changed here, please take a look" and the interlocking is achieved by following specific orders when propagating and reading the events. > I can imagine you can live with this model, but having a hierarchical > reporting without a source of the event just sounds too clumsy from my > POV. But I guess this is getting tangent to the original patch. It seems like your opinion is mostly based on misunderstanding. Let's keep the discussion focused on API stability. Thanks. -- tejun