Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp1411866pxb; Sat, 23 Apr 2022 06:03:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwENihJfO/UwdCfOkoFZxWSTbrJf5Kqt3XBpWiT7rkaWbz4bTZ5zI4vPecukUi3g169kRY3 X-Received: by 2002:a17:906:7c93:b0:6cd:341a:a1d5 with SMTP id w19-20020a1709067c9300b006cd341aa1d5mr8118020ejo.698.1650719037898; Sat, 23 Apr 2022 06:03:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650719037; cv=none; d=google.com; s=arc-20160816; b=WIcIpHhPVMoJof4EH/1wR+TpeU4MppZA/XLx9x0kXW65sJhEM1R3JaIfH95xwZaOjc 8u1nWCXAahwTGqwKbjtXkN5AbQ9SLME5cRp20P23RqRnPa/rSqd2PQYOSoBxhewbGMMl P93iEwhzTdUCGRhRqbbTyaa4LWUf4OfojhExghH7MOTbTvJDjvaKaNA3aj47kmbNKBh9 SlLOwrY4QfXQnxNPbnjyw7ZAN+OG8MPgSznClCa39bbkslmyQh32/w4xvCd+LaHSWwUp gw5u5oYbthbMnV5O0+lt9aZ9Nrs+Iqlucop6CN3Co7vZCCYOzHSP7CGTuQnyzsN0+VYP T3EA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=PveZFFy5DjWV6FRcjoJAL/47PpCBgs3g9S6snQO0X6I=; b=Sg6RDap5e23wWA152Y+cP6+54FVFfKGzPuohlE0I5BPdFeJY+of7z9QPGLWMwOAVyl MwP6ukATPh3fyHzD1CaJJ76JvaXrysg4PDK/yv0ASeIFF2jeDRi+4nVXsiriZDjEkw1V wvJRucTdXPAHSdiwnrE4CWX5JFxnB/aBFM9j0+7VHCfhZJbspGcYugkSd23OHzYwhHUf /Dbigw3IrV/oy1oC/OapEqbVGBzd87vC+3fvu7maf1SFkRo8Erd5mSO/FQrfE1oXnR5I h5E//zEDEMC5sI9b7xNu5HxT6BRjYQyj3Ce9rbLqCOky9+ZRAeM5snyyP5NQYVHtVP+u 6fIg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hh6-20020a170906a94600b006df76385e53si8939440ejb.755.2022.04.23.06.03.09; Sat, 23 Apr 2022 06:03:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234513AbiDWLxf (ORCPT + 99 others); Sat, 23 Apr 2022 07:53:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235359AbiDWLxa (ORCPT ); Sat, 23 Apr 2022 07:53:30 -0400 Received: from mail-qk1-f178.google.com (mail-qk1-f178.google.com [209.85.222.178]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 389F71F6E6D; Sat, 23 Apr 2022 04:50:34 -0700 (PDT) Received: by mail-qk1-f178.google.com with SMTP id e128so7600993qkd.7; Sat, 23 Apr 2022 04:50:34 -0700 (PDT) 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:in-reply-to:user-agent; bh=PveZFFy5DjWV6FRcjoJAL/47PpCBgs3g9S6snQO0X6I=; b=YE5gyLgzP/JpHpFZI0jlGBFBuh+gBlLtrU+L/28MS0RD9waKFhTBRviDsiVBrPLQ6I MfF/TZKbdBuejaPCS9am3ClP+7C7Z7ShA0iHD+M8RPheKnmId9DsoUQcNXM/IkrR0hCh KJ3/p9ZEkcu7bxvgQlnD3Kcb4xsvs3DOTEvkJgbQ9wv+C5PNDMRvWOhOoGxs5qAsxgXb xAiaH0mdDG/KXxLSplWtf031WB5xjiXgGdiGSTdu3R2b+c/jH6xjIhF8IBbHlgJxIqUc MLjHSSH7GDATOMRgVzwh5v7IzS0UqjNTlhfwTgtObQNrpA5F3Thboscwbwi4n0liMAMC +17g== X-Gm-Message-State: AOAM530oaI2OfNoU/EP59zz9He7tq87SjnNA4/TqfyLhHyqSSx86uLrJ xrx8lMmdoccfw5andMyLy/Ucvdnr6o31aQ== X-Received: by 2002:a05:620a:2405:b0:69f:2238:989d with SMTP id d5-20020a05620a240500b0069f2238989dmr3391511qkn.318.1650714633308; Sat, 23 Apr 2022 04:50:33 -0700 (PDT) Received: from dev0025.ash9.facebook.com (fwdproxy-ash-020.fbsv.net. [2a03:2880:20ff:14::face:b00c]) by smtp.gmail.com with ESMTPSA id c13-20020a37e10d000000b0069c268c37f1sm2197836qkm.23.2022.04.23.04.50.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Apr 2022 04:50:33 -0700 (PDT) Date: Sat, 23 Apr 2022 04:50:30 -0700 From: David Vernet To: Roman Gushchin Cc: akpm@linux-foundation.org, tj@kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, cgroups@vger.kernel.org, hannes@cmpxchg.org, mhocko@kernel.org, shakeelb@google.com, kernel-team@fb.com Subject: Re: [PATCH 4/5] cgroup: Removing racy check in test_memcg_sock() Message-ID: <20220423115030.ee2gxwkwjzetzoby@dev0025.ash9.facebook.com> References: <20220422155728.3055914-1-void@manifault.com> <20220422155728.3055914-5-void@manifault.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20211029 X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS 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, Apr 22, 2022 at 04:50:12PM -0700, Roman Gushchin wrote: > On Fri, Apr 22, 2022 at 08:57:28AM -0700, David Vernet wrote: > > test_memcg_sock() in the cgroup memcg tests, verifies expected memory > > accounting for sockets. The test forks a process which functions as a TCP > > server, and sends large buffers back and forth between itself (as the TCP > > client) and the forked TCP server. While doing so, it verifies that > > memory.current and memory.stat.sock look correct. > > > > There is currently a check in tcp_client() which asserts memory.current >= > > memory.stat.sock. This check is racy, as between memory.current and > > memory.stat.sock being queried, a packet could come in which causes > > mem_cgroup_charge_skmem() to be invoked. This could cause memory.stat.sock > > to exceed memory.current. Reversing the order of querying doesn't address > > the problem either, as memory may be reclaimed between the two calls. > > But just curious, does it fix the flakiness (assuming there is no memory > pressure)? Yes, it does fix the flakiness. I saw it fail once or twice in my runs, but to your point that was only in the presence of memory pressure, which could make many of the tests in the file fail. Let me know if you'd prefer to put the check back in, and instead reverse the order of querying memory.current and memory.stat.sock. > > > Instead, this patch just removes that assertion altogether, and instead > > relies on the values_close() check that follows to validate the expected > > accounting. > > Acked-by: Roman Gushchin > Thanks!