Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp7804880rwl; Thu, 23 Mar 2023 08:53:33 -0700 (PDT) X-Google-Smtp-Source: AK7set/GwEGSzTRdjLpNVkUxuVybknd9aZTl2HVEywWwhuMEHCAoGBwX56bf0WJFnSslhCSgH8HS X-Received: by 2002:a05:6a20:98a7:b0:d7:47e8:59bd with SMTP id jk39-20020a056a2098a700b000d747e859bdmr3199531pzb.60.1679586812788; Thu, 23 Mar 2023 08:53:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679586812; cv=none; d=google.com; s=arc-20160816; b=Q4+bOchzmBpPWk20RNTDqLUCmhqBcNHFUL4s6D1zyMfw2IxksmPiu5DrEBzLkesllw m44BnQVRAs4149jhirYzbWgVNsXOiPKldaqwDx1BGPwypOHlGed3JNiN1qQTiL4tr4Ww iDWWGRCc9ZTo2sW8beri9xBAWU1Giw0McpxmTbP/uozYJtFJigYvn+NgxE+vfEM1NaRA UE2G5PvaG9LhfF9Lqvyvw0yL2p39aa0o50069AajJnphEJTPtCXZlWnxCzgep6CLOuPZ 9kCiczkYXNknSW/1uNhnRLw/zyxwmd8FMy6dKwGPLcMBflS140dRXWXrQa3xZdtJfaUy u/Wg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=aXqZ3IJA77cnf/fukJT6xyyWj+RxTe/4tMZOB+1mbkQ=; b=L9uXJnXJ3/6i7DiF4SJtyGmsdAKaG9+9xH6VHOOYhcbmAboedM031y/19eCOEvWo+j pPUfsFst/0Ph+b6XRY1+daUcMqPnbbKoie15JAn2+YoZJ79ZxNuuEZHmXHqUTwItHmNB yUnF/myJBWuNx6rdWa1SgeiJXEypchaECqDcLZbHRIURwUSOnkNseTMdFa439MTW/tU1 +i1BPw5gG2phgoqxpOfo3Mv6lfvn2wZJcz2L5Zu6ejFfeSF1FkzdbmzWXl2BdtZHICxr kw0d0P5Ftq2iXk4CTuZM2E4O1iJj02B1IM3aYEFi310EZRhjXEkYIihNNJx3uKx8RHYu o29Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=pZto6I+v; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o127-20020a62cd85000000b0058003199fbbsi18316687pfg.63.2023.03.23.08.53.20; Thu, 23 Mar 2023 08:53:32 -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=@google.com header.s=20210112 header.b=pZto6I+v; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231658AbjCWPkp (ORCPT + 99 others); Thu, 23 Mar 2023 11:40:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229847AbjCWPkn (ORCPT ); Thu, 23 Mar 2023 11:40:43 -0400 Received: from mail-yb1-xb35.google.com (mail-yb1-xb35.google.com [IPv6:2607:f8b0:4864:20::b35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 174321E1EC for ; Thu, 23 Mar 2023 08:40:42 -0700 (PDT) Received: by mail-yb1-xb35.google.com with SMTP id i6so25351086ybu.8 for ; Thu, 23 Mar 2023 08:40:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; t=1679586041; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=aXqZ3IJA77cnf/fukJT6xyyWj+RxTe/4tMZOB+1mbkQ=; b=pZto6I+vvxaphKg4Ca9NDWCYEUNhj7BJYmHfaAG8M51g5rBMERT2pTxw32czJVRwqf EXpqwyXIM77qAJ204++TM8DrNrSWXsJyryfpkiZaymGsJv+mhNCo+v4QMcuWklOwQ1zb 14XunBWOhtBzzFTiU3Gj8RFDbfEQ4MSASypSDfsLzNrh14XAxfBwpnKQD7EnPJaTeklc QpjEu0BIrsjS593Tol8303VAwfsZeO1qSu7wHKzhAJW4G9NFMuqTCi3YV8xqFEcXgHrN 7FMdZFQg1MqDPNCzODUn974BlGYh8gXmdMD2HE3tXqWplxkq95RhThaIWYkoMKBBBJ0Y EGwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679586041; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aXqZ3IJA77cnf/fukJT6xyyWj+RxTe/4tMZOB+1mbkQ=; b=HBJGD9+kTlh3r0IV3gk1iwyzSK9BcPhHtrxQ218eOjc1rRvhmTUTlFIr/sFICqFlJH UsTb/AaBLUw6LwD3MF9LxglDwHQVeR3G7EjdUymAObEiLtxYbIcXny7JJ//3ieoRZKf2 8cJ4fqYDcxzv90eXSDGImYvLAeGZPmUTn4y7usjUASuDCYK6RYpZ9EhYhFJK0Wd5P0xv 5Ld/ZDIixgpQWWO4d1Z1BsYeh0rGr4+EddCXvz4GLgyDHk8NS3grRN5WDv6kioMcnIny 4yp5Da/7Z00fTkJLcW+flqTd1Q+GPlPGbA08OHoYSgxBwmvI8i/FPuzc3AsL+dAXc3Ek QY3w== X-Gm-Message-State: AAQBX9fgdSVsu27FfKCwtT0FkRaZico10SupqahX4mJnbG6hAE9dZPaB T+wZS9kL9J54yIkCJtHWt+GjE8NhdCwDUS68JYgyjA== X-Received: by 2002:a05:6902:1083:b0:b67:d295:d614 with SMTP id v3-20020a056902108300b00b67d295d614mr2101971ybu.12.1679586041114; Thu, 23 Mar 2023 08:40:41 -0700 (PDT) MIME-Version: 1.0 References: <20230323040037.2389095-1-yosryahmed@google.com> <20230323040037.2389095-2-yosryahmed@google.com> In-Reply-To: From: Shakeel Butt Date: Thu, 23 Mar 2023 08:40:29 -0700 Message-ID: Subject: Re: [RFC PATCH 1/7] cgroup: rstat: only disable interrupts for the percpu lock To: Yosry Ahmed Cc: Tejun Heo , Josef Bacik , Jens Axboe , Zefan Li , Johannes Weiner , Michal Hocko , Roman Gushchin , 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-15.7 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,ENV_AND_HDR_SPF_MATCH, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL, USER_IN_DEF_SPF_WL 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 6:36=E2=80=AFAM Yosry Ahmed = wrote: > [...] > > > > > > > 2. Are we really calling rstat flush in irq context? > > > > > > I think it is possible through the charge/uncharge path: > > > memcg_check_events()->mem_cgroup_threshold()->mem_cgroup_usage(). I > > > added the protection against flushing in an interrupt context for > > > future callers as well, as it may cause a deadlock if we don't disabl= e > > > interrupts when acquiring cgroup_rstat_lock. > > > > > > > 3. The mem_cgroup_flush_stats() call in mem_cgroup_usage() is only > > > > done for root memcg. Why is mem_cgroup_threshold() interested in ro= ot > > > > memcg usage? Why not ignore root memcg in mem_cgroup_threshold() ? > > > > > > I am not sure, but the code looks like event notifications may be set > > > up on root memcg, which is why we need to check thresholds. > > > > This is something we should deprecate as root memcg's usage is ill defi= ned. > > Right, but I think this would be orthogonal to this patch series. > I don't think we can make cgroup_rstat_lock a non-irq-disabling lock without either breaking a link between mem_cgroup_threshold and cgroup_rstat_lock or make mem_cgroup_threshold work without disabling irqs. So, this patch can not be applied before either of those two tasks are done (and we may find more such scenarios).