Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp1258790rwr; Thu, 20 Apr 2023 12:11:46 -0700 (PDT) X-Google-Smtp-Source: AKy350Y3O90KlmPRbVxjG+1R8DBYNjHjayZ3j7zgh+gwCPQeQJ6U2Z3s2QFeneZ6mCBKBousTRQ4 X-Received: by 2002:a05:6a00:1948:b0:63e:9e1f:6d06 with SMTP id s8-20020a056a00194800b0063e9e1f6d06mr2612376pfk.17.1682017905966; Thu, 20 Apr 2023 12:11:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682017905; cv=none; d=google.com; s=arc-20160816; b=lAX85/1+myutdO6T/6qzzCuj/5zkz4jRQ+3gaUDCMxRDKgZ2CfnOoajN6t8rFYPD7g zJrUalRlaCGZ/k8aj/t5PzK6jrd1lwwTx9iqqI+rUxiIMdViQHRVFEMdgjFEDZ2YLk+n 8QUSqP6/wH3D4NJ+JIyUJzPn0BstR0tvauIJgAWGwS+vUIuI/sVEnfWqbjgwaejuZV4z VOfCU5amKPfNey1JE3tea9rWHinGv7FsJuTb3gBI5gCW9XrSfCANAyRQjsu01vyZzdhR bYZrqvBLkAUVjLFxbVy0RiZlC/3Xq5kAZSAQgyLK5H5YfPY5GkeX5n3meMWe8Lh46V9D AYkg== 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=PPC/T+cZBiALDJb1UQ+biPUmWPyQkwBmvhpGsYNp8Ec=; b=SRw584YhPPjnRrF3p2aBqGNFMWJu0zFCKBrVU0FdifC+PJxPxIe6cY9DBoDHyiPsYQ OF+10ogvgGbOTPDBIrsbDSovGE54wRdImHojD8cW2/TenfoBvfYI8wRyyGoAxt/1NsZ4 BCVxK8fklOzdqZuUnmxI66M9PkxTXIbzjpuQtzd8eBiuUCufNEp+NkKE2ZhwUD+8xyhc SltzJWqe57rky/G7ntGftiLX3P7gj8rYkAIwHyXrYs3RMfZHpbd66v/02Lyd06B8XiEJ FQLYdk07Tykpom3eb1uKBn4mwhoRCrJIQlZCBzXrxvx6cqa5KYziRQ+9HnIAkimzq2OI uzcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=PkKT30pQ; 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 u8-20020a63d348000000b0050be63b50c1si2113445pgi.642.2023.04.20.12.11.30; Thu, 20 Apr 2023 12:11:45 -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=20221208 header.b=PkKT30pQ; 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 S231858AbjDTS5o (ORCPT + 99 others); Thu, 20 Apr 2023 14:57:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231932AbjDTS5U (ORCPT ); Thu, 20 Apr 2023 14:57:20 -0400 Received: from mail-qt1-x82b.google.com (mail-qt1-x82b.google.com [IPv6:2607:f8b0:4864:20::82b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0A852101 for ; Thu, 20 Apr 2023 11:57:18 -0700 (PDT) Received: by mail-qt1-x82b.google.com with SMTP id d75a77b69052e-3ef31924c64so901761cf.1 for ; Thu, 20 Apr 2023 11:57:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1682017038; x=1684609038; 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=PPC/T+cZBiALDJb1UQ+biPUmWPyQkwBmvhpGsYNp8Ec=; b=PkKT30pQsy0dCCBavAqHdYdEypziw027sTRPtrDqQEAdFY/TgNivu3OfPvntSwK5vh mU5R6qzBEL+qOULk/9IpVdRCuSYMJd/CzosuFnkJHrtdKzbtz0qrvCTLqa6YVYOFENL6 eUbuwLtPygmsEnnix7qVPS4j+Mb06vn2kCVGU22IQ/QipOnHx3x30cc17Wf2V/b6eOQA FBcLvayQhbewEQqXjzzBGqjCWuPzVpydlIFaj667t12Zh2ffgrUquDBsin3Tzj+OScUJ BWjEbdTXXG4edmqIovf5NwazZ359XreOT3MIExV27wqDBPOW6JeKvDnWf6Vv752fS0yk hnzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682017038; x=1684609038; 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=PPC/T+cZBiALDJb1UQ+biPUmWPyQkwBmvhpGsYNp8Ec=; b=cevpu0DNUNjZA2RpE+zCk4DMuUnyvIQOgsd9FuU0lHUf5vbbe1AL0xC1CpNTI7a7/Q 8+90bBIUjtyQbqGhEkCQhVWYsBZHR2sbbX7kM1erXP9IOw7LDLMZgo9slgcPfQJ99q9q SwOovyOhqbojfQDiDAg19iog48OmTY6+ApHua6roaRgzSqEKbyYMQn8MENUDmbYF226P xofShTXC4wcT/RngdwEmFLx/iAQS8fqLP++ROk5UoZzyOXo+Y0C9Yu85VxCXEAw03Hvg /bLk14SNl1gyC1AZcukrNFAU9hO1ZLfkdQ55cSfltDPQGggECeED26Au/2Pqxw2krFWv VtQQ== X-Gm-Message-State: AAQBX9e2kl26//SLeALmTA96+YbGn1cHyUr5g5PjsGZD5LS+W8B5KImv gSQR/A5+ESwqvr0GNqNIVezYc73Jc7ZLQFVEh1Z/SA== X-Received: by 2002:a05:622a:290:b0:3ef:5008:336f with SMTP id z16-20020a05622a029000b003ef5008336fmr29892qtw.1.1682017037936; Thu, 20 Apr 2023 11:57:17 -0700 (PDT) MIME-Version: 1.0 References: <20230403220337.443510-1-yosryahmed@google.com> <20230403220337.443510-4-yosryahmed@google.com> In-Reply-To: <20230403220337.443510-4-yosryahmed@google.com> From: Shakeel Butt Date: Thu, 20 Apr 2023 11:57:06 -0700 Message-ID: Subject: Re: [PATCH mm-unstable RFC 3/5] memcg: calculate root usage from global state To: Yosry Ahmed Cc: Alexander Viro , Christian Brauner , Johannes Weiner , Michal Hocko , Roman Gushchin , Muchun Song , Andrew Morton , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-mm@kvack.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,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, T_SCC_BODY_TEXT_LINE,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 Mon, Apr 3, 2023 at 3:03=E2=80=AFPM Yosry Ahmed = wrote: > > Currently, we approximate the root usage by adding the memcg stats for > anon, file, and conditionally swap (for memsw). To read the memcg stats > we need to invoke an rstat flush. rstat flushes can be expensive, they > scale with the number of cpus and cgroups on the system. > > mem_cgroup_usage() is called by memcg_events()->mem_cgroup_threshold() > with irqs disabled, so such an expensive operation with irqs disabled > can cause problems. > > Instead, approximate the root usage from global state. This is not 100% > accurate, but the root usage has always been ill-defined anyway. > > Signed-off-by: Yosry Ahmed Acked-by: Shakeel Butt