Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp106670rwl; Fri, 24 Mar 2023 22:04:56 -0700 (PDT) X-Google-Smtp-Source: AKy350YYEWtc2JPtfk8/8TPU8wJc5BALMjyaKdpDqfKTBx3ackK4r3ODD670EcSYYuP74Ln+Q34I X-Received: by 2002:a17:90b:3a85:b0:23c:61f:2be5 with SMTP id om5-20020a17090b3a8500b0023c061f2be5mr4893630pjb.18.1679720695990; Fri, 24 Mar 2023 22:04:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679720695; cv=none; d=google.com; s=arc-20160816; b=zo5HnZcM5dTGVfQOG2pbAsRIV7B3lFL8nFk0Ey6h3Z8xQeaXD/Hlw/vWJZudm5mhbo o62HBCtEX8qbPP5uXnpXgaiKKadxo8jjnwIcEUq41JlvnT2PLhIvkj8VBmh3bfXoWoY5 N194x3G+ig8RKbo7adkFuvVOuy+E+s99mtBK4xDSd4kEhE0XRYTrawUvHf4MetUSKiTv +UZBZtPubeQolkTN/0CEW/G9dbp7tloqt1UITrvXA2HxdD4KcmV384IT7nGPL92n8u5y QZtmGjn1Lm2BBCDrAvgnmHVOqWgjlAuJ3t+THB3d+djQ7YVpyySGKi7dJrlAH2x9WIW1 NpPA== 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=NMuWO+eqM4F8nQZaJRTjXyqs2/5MQPRiPwC4jEGB2Rs=; b=P42TAjGTp6HZmTeI8jSQRNbqSCPTBvkiiljjHZ+0CxP/v9PyhQyqTxDWkoFh9UpfOt tolPhQHiM0sn16y49T4GX9G/6gkDHuHcVIBCe41bwNItmYOqy1O7nm3U6bkFJ8PX/eDN yL0dQ4JTnQaSzwrKVD8wEtKh2QleEbSI6l3417VrVGSMJNY99XNbNClzFKEHwE6LRuof kVzZkMIFnK48Fyikn09ac/8ITisH5rTS1fbSQuTR4o0f6TNQOsM317aHN6m6JMx5dKdC m9fcKY+8UPiUAWCVlOQf2O2/M01qeJ1tp60cCgZs+F7LKhIAMd5K47u+E3ZovOFDYM3L TA5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b="L+/JPY/0"; 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 g11-20020a17090a578b00b0023a30502979si5450015pji.155.2023.03.24.22.04.33; Fri, 24 Mar 2023 22:04:55 -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="L+/JPY/0"; 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 S231861AbjCYEhs (ORCPT + 99 others); Sat, 25 Mar 2023 00:37:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230360AbjCYEhr (ORCPT ); Sat, 25 Mar 2023 00:37:47 -0400 Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [IPv6:2a00:1450:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18DCD1422E for ; Fri, 24 Mar 2023 21:37:46 -0700 (PDT) Received: by mail-ed1-x533.google.com with SMTP id cn12so15396057edb.4 for ; Fri, 24 Mar 2023 21:37:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; t=1679719064; 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=NMuWO+eqM4F8nQZaJRTjXyqs2/5MQPRiPwC4jEGB2Rs=; b=L+/JPY/0iREVQLvI7pggvIU85qKWyZuwLse9KHVQy00x8LnQk15zEqQ2dItfbkf8Xc jinjmlAjwTxba/K+cbeiot0mNiIF15Oi4eDBVwxanGDJjspzMRs/QEKZhb3nTnGG20Qk VCIX3A1iKO2CtSUq+wB+uKNxtSvCDACGv/ulf6pILtz7hI/K1gI6rhNEP0DsLW0t3JSg AzhYalbZFDACojW1EW0rFcfP25ejlhpDyTw+3o3AN5EoMcU49k0QrbmBymzShyxBd/Kn HTBVcaYssSwFsoVs2gUZS47oZ5CUrOJQR6m1EZ/9EUrtjdiIBWvfQH4XA7Ier1JLOUtr 7ZBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679719064; 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=NMuWO+eqM4F8nQZaJRTjXyqs2/5MQPRiPwC4jEGB2Rs=; b=XnlW6hnDMx0msARpNt+zOeEvmLAJdH96zAdo/BCE3q/N+aZluBj/0kpysoHbO/Qe8H /uSvLv7g1efsyTVX11PhmN6fUBBgftBxFrYaqMw/0h7dGfIXOtBZQqUTccBrlLnYelXu yqSOhoSuUEo6r+JEDftShOMyGubQ9lWaHdd1NpdMidLkOYYthN185556wz4qElgb+q30 7o9s2OFSPnZ9LQSKL64Jqsyp4YVsgMHpnaRCXB7f6GS9GyQmKlP7CEfyCntxGAxCOXOp qIGB/lKuUe6oDS90Fxdge37LdsCAv8pWSRDjUIHdug3i672uCuHD/+HAQPnSSaZEw3sm iBfQ== X-Gm-Message-State: AAQBX9fee+HYoXn4dHckLyTe3IkNrzXZvk0AYZQ7lLlpUtRFbNu8A9yO 71Fo8tWvcGlWRlGkeDgrBsj0NGsYneO/D9tlsEJVaw== X-Received: by 2002:a17:907:1c09:b0:92f:b329:cb75 with SMTP id nc9-20020a1709071c0900b0092fb329cb75mr3153111ejc.5.1679719064436; Fri, 24 Mar 2023 21:37:44 -0700 (PDT) MIME-Version: 1.0 References: <20230323040037.2389095-1-yosryahmed@google.com> <20230323040037.2389095-2-yosryahmed@google.com> In-Reply-To: From: Yosry Ahmed Date: Fri, 24 Mar 2023 21:37:08 -0700 Message-ID: Subject: Re: [RFC PATCH 1/7] cgroup: rstat: only disable interrupts for the percpu lock To: Shakeel Butt 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 Fri, Mar 24, 2023 at 9:31=E2=80=AFPM Shakeel Butt = wrote: > > On Fri, Mar 24, 2023 at 7:18=E2=80=AFPM Yosry Ahmed wrote: > > > [...] > > Any ideas here are welcome! > > > > Let's move forward. It seems like we are not going to reach an > agreement on making cgroup_rstat_lock a non-irq lock. However there is > agreement on the memcg code of not flushing in irq context and the > cleanup Johannes has requested. Let's proceed with those for now. We > can come back to cgroup_rstat_lock later if we still see issues in > production. Even if we do not flush from irq context, we still flush from atomic contexts that will currently hold the lock with irqs disabled throughout the entire flush sequence. A primary purpose of this reason is to avoid that. We can either: (a) Proceed with the following approach of making cgroup_rstat_lock a non-irq lock. (b) Proceed with Tejun's suggestion of always releasing and reacquiring the lock at CPU boundaries, even for atomic flushes (if the spinlock needs a break ofc). (c) Something else. I am happy to proceed with any solution, but we need to address the fact that interrupts are always disabled throughout the flush. My main concern about Tejun's suggestion is atomic contexts having to contend cgroup_rstat_lock much more than they do now, but it's still better than what we have today. > > Tejun, do you have any concerns on adding WARN_ON_ONCE(!in_task()) in > the rstat flushing code?