Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp7818080rwl; Thu, 23 Mar 2023 09:02:36 -0700 (PDT) X-Google-Smtp-Source: AKy350arstA0l0worDBj8jurLZl/aEBFibGcYq3gGPTpo71xd+e9fFk2u/boZ01GN0/D16p0f8JN X-Received: by 2002:a05:6000:1816:b0:2ce:a46f:bbc5 with SMTP id m22-20020a056000181600b002cea46fbbc5mr3300560wrh.34.1679587355752; Thu, 23 Mar 2023 09:02:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679587355; cv=none; d=google.com; s=arc-20160816; b=ydsaMan8MLkKlfovcDfN7CvptIkN8LI8WaKp4ICYu2/AhX2aRgXBnaKzdMm7/E2GBS wbTXYw1VvlWawIGzClT17e1TWWI+X4nzz3AgWaPxZmsAhe4bpoIg53Fw73U0zhHUHWye IokpKttQN2utwBz7Kx/x10t/E12XrVn27LwbBCkoVz48eMCLzvm4GXFjUIKN1DMrkuSo PlmdDkaD1kwkp8+1jtA7wWEfmmBviep9CR6UqnVU1gGVx2Z+vMRJxHbDT2mOpqi0CZVj Csltq2pnsc4qNBgV5NvqrOFAZOyjwjP/TPi+tm3NHFr9NtZljZq9CRyOPYngsSZYzdSu UxxQ== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=73H5IIveVwCSuj8ISfgz0DD6tM9W3+Bkt6XVlPhAYGQ=; b=gZy5+zq4qcgB9PJ+g9dt0ifyT6gR6y9GIP8UEph2WDtp/HNv6WSATgwPga0Yu3DjBz kKNaYKpEBbRsvn6ErNCOd0zpph3oeyykEcU2ZQALAeIu8NCewCqwvTEw+0sR68ETcH5u wXwWzmHq45OjcldXr1HUmua0WCvhidg5euP2JrywFr9fPrbKCzLiMrIEt1+7y4gQ5fs8 AJAtuAzUgukgU7k1t5LinxdZF55SItkknRZxWkf/bQ6B48o1DUcmk31Va0v2g4HhHlUs jC2w5F+PTcSnr4dHMXMAOclZPBB2v2SI/jLCywU8NBoFKNELz7cBkLBxXfn09m/BF2d4 8ydw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20210112.gappssmtp.com header.s=20210112 header.b=BOTN3RHi; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x4-20020a5d4444000000b002c5578c2726si14553930wrr.467.2023.03.23.09.01.56; Thu, 23 Mar 2023 09:02:35 -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; dkim=pass header.i=@cmpxchg-org.20210112.gappssmtp.com header.s=20210112 header.b=BOTN3RHi; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232192AbjCWP4S (ORCPT + 99 others); Thu, 23 Mar 2023 11:56:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229560AbjCWP4Q (ORCPT ); Thu, 23 Mar 2023 11:56:16 -0400 Received: from mail-qt1-x82f.google.com (mail-qt1-x82f.google.com [IPv6:2607:f8b0:4864:20::82f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9021D21A0B for ; Thu, 23 Mar 2023 08:56:15 -0700 (PDT) Received: by mail-qt1-x82f.google.com with SMTP id hf2so22922374qtb.3 for ; Thu, 23 Mar 2023 08:56:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20210112.gappssmtp.com; s=20210112; t=1679586974; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=73H5IIveVwCSuj8ISfgz0DD6tM9W3+Bkt6XVlPhAYGQ=; b=BOTN3RHikvmNyJ/5BRIscfqCjptXrf8qpEubjPg0OC/Xwy+boUt94/+OfrbOvrjrzs cJmWGbxdzfNwYKXLNjFeE4gMQoT6n7Ue/HEG5/LMoEeTKeSw/uGUVJVLhA+eCCAdPAw6 TtqrrK35mvYRbzkyskIxNy5mDJm9BfKY9K6UzVcc3DGVU9OzF+09jvq6Drjb5mZ2qmVt HenjMS5dF/r4y3zFsqrBc6Pye1BCCpqXxrBcHNF0Eo2mmCOm0/3b/V5FU143KRmBza1U 0t4zXTHbwVZfvfVGehbwYOD9++M2yfXXjOlk6zzl04FgUWlZQ7+y/4hEPkd/CR7pqYbK NovA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679586974; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=73H5IIveVwCSuj8ISfgz0DD6tM9W3+Bkt6XVlPhAYGQ=; b=OvFxkTtJ2l3Z3+9jnTI88PGWrPHasvTINrKhbehILiCqUKfc2scI8JfxSrbZgvbsgs zsZCsfBGgngx0MGheaL60VmI6uP0j4et2ASjW2CFYMJN2fpzPu5nPGkqFcQ4Q2iHo9nF i/fgM/thXtYHhEnOhyQ9xo/3zbzqZg+agW9lJB9LK4IxM624WxgTEarZnSBOTOgFiJwr jkxApkJGg+6sqaykSSWsUBtcm2XYNgxNeNGxQN5gT8oyg5a6Fa0tF9DqC/lFhrg4iwGl XeDzGfQYtbd7M6qkGDiQZyGXaAumxePBjdeetPV+2ResF0IoF/IpoI3hPMICO4CJl8DR hP7w== X-Gm-Message-State: AO0yUKURM7QCLS82G4H9ozhHTXmYCva031OI/cUd3zrIeKbOC1qHn/RL cV84BlfpCUDISaLikV2BKkykNy39sIXyeZLrY2A= X-Received: by 2002:ac8:5b87:0:b0:3b9:bc8c:c214 with SMTP id a7-20020ac85b87000000b003b9bc8cc214mr9815638qta.31.1679586974671; Thu, 23 Mar 2023 08:56:14 -0700 (PDT) Received: from localhost ([2620:10d:c091:400::5:62db]) by smtp.gmail.com with ESMTPSA id 201-20020a3708d2000000b007456efa7f73sm8647826qki.85.2023.03.23.08.56.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Mar 2023 08:56:14 -0700 (PDT) Date: Thu, 23 Mar 2023 11:56:13 -0400 From: Johannes Weiner To: Yosry Ahmed Cc: Tejun Heo , Josef Bacik , Jens Axboe , Zefan Li , Michal Hocko , Roman Gushchin , Shakeel Butt , Muchun Song , Andrew Morton , Vasily Averin , cgroups@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, bpf@vger.kernel.org Subject: Re: [RFC PATCH 4/7] memcg: sleep during flushing stats in safe contexts Message-ID: <20230323155613.GC739026@cmpxchg.org> References: <20230323040037.2389095-1-yosryahmed@google.com> <20230323040037.2389095-5-yosryahmed@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230323040037.2389095-5-yosryahmed@google.com> X-Spam-Status: No, score=0.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 Thu, Mar 23, 2023 at 04:00:34AM +0000, Yosry Ahmed wrote: > @@ -644,26 +644,26 @@ static void __mem_cgroup_flush_stats(void) > return; > > flush_next_time = jiffies_64 + 2*FLUSH_TIME; > - cgroup_rstat_flush(root_mem_cgroup->css.cgroup, false); > + cgroup_rstat_flush(root_mem_cgroup->css.cgroup, may_sleep); How is it safe to call this with may_sleep=true when it's holding the stats_flush_lock? > atomic_set(&stats_flush_threshold, 0); > spin_unlock(&stats_flush_lock); > }