Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp5080740iob; Mon, 9 May 2022 08:14:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzyNqs1VBBZpDmmdbrWIcSc4W39qoPBOYgOtymKrPM/WiPDSc2bVlxnft5L39Bx2WpsdLmM X-Received: by 2002:a9d:7f85:0:b0:606:1305:f8ca with SMTP id t5-20020a9d7f85000000b006061305f8camr6011424otp.96.1652109268765; Mon, 09 May 2022 08:14:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652109268; cv=none; d=google.com; s=arc-20160816; b=l8/4ayrIvO0kX0noBlHjeSFzX/N6tsGNt1ibYLEzFbgsKOboCYaMcZzB3L46ibWGlX Ac32rgrUTpt+Y93YghBsj3eTljxmeddVYHOKqeIkbcn57LmZo400GqzWmwjEkOfO4J41 O2ZwOF+6ZYZ9/G0PHa309mviE7loTVGS7DkQte2i2D5vVFqTECMR4mvCW8P2r8tH+Asm /ORHXwEWjUE1eyHRQYEGdPwK2xX5CEj2zaeNf2YKp1DJTKtuqHKMob39R7rwCOwfIXM8 Dlj0GSnJcVsMqHgLxod2TCh2GnA5/nhFsMPDf7Speo7szpck9fUOCTgaZ+swz83ISZtd FySA== 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=4MK5Z5duMa87oHfTgQRev3JJqnSTwXWH5fVcV34L7dM=; b=dCtOT48KSCcwolBGZTa/7rUHFiLW81yk3TnQVfabpZBhRDTif9Pr8LlNBOluzJS5Iz qSlo7+EveRYdC12F4Opu8JVEkmoe0YnYF5u56jUTRCVIEjAOyaANzVAQHudnldl0vHAd 4qs4yu6R9LkGR4k1RPdrm8BONUvJioSoeWvAtMgq2/vXWtCSIPIxti/sQxgNdRVZZSO9 fAe08+zy2YzCwhd/FVeE/bmKoS4QtaiabhmHBTCZW7pHn/M7cCZY2QWamKht17BUzXjx hiY275uLD0wvwqQYtjspjmxmCiW8YXdCzpEHJdnnEzyRL+ExrLA4LdvZNbWO1461vmoz I1OQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20210112.gappssmtp.com header.s=20210112 header.b=l+MeEY8P; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id pu1-20020a0568709e8100b000e962cda238si10053890oab.164.2022.05.09.08.14.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 08:14:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@cmpxchg-org.20210112.gappssmtp.com header.s=20210112 header.b=l+MeEY8P; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id BC0FE28D4C2; Mon, 9 May 2022 08:10:35 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238040AbiEIPOP (ORCPT + 99 others); Mon, 9 May 2022 11:14:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238029AbiEIPOI (ORCPT ); Mon, 9 May 2022 11:14:08 -0400 Received: from mail-qv1-xf31.google.com (mail-qv1-xf31.google.com [IPv6:2607:f8b0:4864:20::f31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97A1428B87B for ; Mon, 9 May 2022 08:10:13 -0700 (PDT) Received: by mail-qv1-xf31.google.com with SMTP id kj8so10613986qvb.6 for ; Mon, 09 May 2022 08:10:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=4MK5Z5duMa87oHfTgQRev3JJqnSTwXWH5fVcV34L7dM=; b=l+MeEY8PFGfskD3FsCOlvSab9XgG1oPg/iynQwlXTFrp/alh8KkZYehnFpakdk+2y6 jKiO9k7kOkYPU29eqCecdB6DUs7C1PNR2Ev/yXH8aw2fNbvvy9l/YtVVbQahxBmKHV76 m/29e1REy8tS9WU0KLk8b+3BVI/mNjWrTP6+evBbdVEgKqv6XW/bg6XuZXwtDZOlT/Hf fQDDLvknV+r9yrtTnJrM1LaVNhutiu1tHOYhsUCqSsvBfrOsnuazqm6H4R9vbMlZoy6J 3FHixuJyOBVhZ7sr+23dJSEwCWrY0/paq2Z0MtQCeTzBTz5qsjpX6Mro80MNDaSvgMJT nGGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=4MK5Z5duMa87oHfTgQRev3JJqnSTwXWH5fVcV34L7dM=; b=f1d6KxDow25XBGnGkVRJ3rcyqDATj49tAPs9CRrnK9+aF5NvkjlXxLOqhIm7qrgue1 af3iNAtWnl8Fd4y0Hrqp+zx56UAd/Jf1EVNSjQIh20wZxYCFuAoxZrSIBKr1DDGsqZO/ 6RerlXHsicnDFMOlYG+sWhemOPLn4oC1mPTJhvZD7ER+11a8kRxhLxsEjQl5QKhqsi9C Kv+vJLMpyEesCoSp1nGjk6Wlp3JfOy9bUWngMV6iwApmOq7OUwfqBM2L5ubwrC+Tqsc2 oex4+exAQi17/m0MCVfP8eqFIg6Tu2S18Ed5jZSCrvp5Ac1qtSCiHTOsGvquPQ9Ivmrf IB5w== X-Gm-Message-State: AOAM530TQVRpAva9JAysscEwyJN0VOwNvXFH6TlKRAJyLgDJ1Vm6g+gk vJOoBKWNODNbznXYxZGdQdmAuQ== X-Received: by 2002:ad4:5504:0:b0:456:35e0:1968 with SMTP id az4-20020ad45504000000b0045635e01968mr13517316qvb.126.1652109012556; Mon, 09 May 2022 08:10:12 -0700 (PDT) Received: from localhost ([2620:10d:c091:480::1:538c]) by smtp.gmail.com with ESMTPSA id n1-20020ac81e01000000b002f39b99f679sm7883463qtl.19.2022.05.09.08.10.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 08:10:11 -0700 (PDT) Date: Mon, 9 May 2022 11:09:15 -0400 From: Johannes Weiner To: David Vernet Cc: Michal =?iso-8859-1?Q?Koutn=FD?= , akpm@linux-foundation.org, tj@kernel.org, roman.gushchin@linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org, cgroups@vger.kernel.org, mhocko@kernel.org, shakeelb@google.com, kernel-team@fb.com, Richard Palethorpe Subject: Re: [PATCH v2 2/5] cgroup: Account for memory_recursiveprot in test_memcg_low() Message-ID: References: <20220423155619.3669555-1-void@manifault.com> <20220423155619.3669555-3-void@manifault.com> <20220427140928.GD9823@blackbody.suse.cz> <20220429010333.5rt2jwpiumnbuapf@dev0025.ash9.facebook.com> <20220429092620.GA23621@blackbody.suse.cz> <20220506164015.fsdsuv226nhllos5@dev0025.ash9.facebook.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220506164015.fsdsuv226nhllos5@dev0025.ash9.facebook.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Fri, May 06, 2022 at 09:40:15AM -0700, David Vernet wrote: > Sorry for the delayed reply, Michal. I've been at LSFMM this week. > > On Fri, Apr 29, 2022 at 11:26:20AM +0200, Michal Koutn? wrote: > > I still think that the behavior when there's no protection left for the > > memory.low == 0 child, there should be no memory.low events (not just > > uncounted but not happening) and test should not accept this (even > > though it's the current behavior). > > That's fair. I think part of the problem here is that in general, the > memcontroller itself is quite heuristic, so it's tough to write tests that > provide useful coverage while also being sufficiently flexible to avoid > flakiness and over-prescribing expected behavior. In this case I think it's > probably correct that the memory.low == 0 child shouldn't inherit > protection from its parent under any circumstances due to its siblings > overcommitting the parent's protection, but I also wonder if it's really > necessary to enforce that. If you look at how much memory A/B/E gets at the > end of the reclaim, it's still far less than 1MB (though should it be 0?). > I'd be curious to hear what Johannes thinks. We need to distinguish between what the siblings declare and what they consume. My understanding of the issue you're raising, Michal, is that protected siblings start with current > low, then get reclaimed slightly too much and end up with current < low. This results in a tiny bit of float that then gets assigned to the low=0 sibling; when that sibling gets reclaimed regardless, it sees a low event. Correct me if I missed a detail or nuance here. But unused float going to siblings is intentional. This is documented in point 3 in the comment above effective_protection(): if you use less than you're legitimately claiming, the float goes to your siblings. So the problem doesn't seem to be with low accounting and event generation, but rather it's simply overreclaim. It's conceivable to make reclaim more precise and then tighten up the test. But right now, David's patch looks correct to me.