Received: by 2002:a05:7412:6592:b0:d7:7d3a:4fe2 with SMTP id m18csp1391130rdg; Fri, 11 Aug 2023 22:31:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGHYpNF902gEFxAIXc31CClv86WnXyAisHQIOwdA/JFyLIwfPLxQ24NXPKYLBYcHzWa+uF5 X-Received: by 2002:a17:902:e5c8:b0:1b9:cb8b:3bd3 with SMTP id u8-20020a170902e5c800b001b9cb8b3bd3mr4092547plf.31.1691818311004; Fri, 11 Aug 2023 22:31:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691818310; cv=none; d=google.com; s=arc-20160816; b=WG99KQoumPr1wfbaPKMYoRzl+IbIANVfGWC8gNx2Vl2WcMBThcOxv0SOIBXIYv5z5/ zF91ZjrQTBlfcSKN8y8l8PtSymkPvwMzEc7JDXegm9JigPSsdqy4ki/7bHReDIA9eoUr lkKGW4Qan8vDpMn/XKUM/WbWSEI1zG10T1tbh9LV6zhyYXzoJFkBASBclav49RUToC87 1I83EWTU+rkqVZk7t6kbzEvSyv0vpbtack9Q5T+3ylEAO5uAt8Tpo5APApeSfzBuhM3t lkpY72W/0olOWxyU84K7DDz4MIT6u/zVCeQmx0wMIebn2XGoID+iCYHUNHyQ4EW0SUKg n60w== 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=NDyw1JjcpV1wN7RXJDPu6qRAhGishkYEQXNXltLrwqE=; fh=uQesB/j4nsyQIz1s1DkkWFTcwvH9YycPQtP2zp2PfZw=; b=XNiPJdmtOulOoCzYP5oWYeW6s09WVysc/04rrTVvIX19HI1esxGF4wpWnE7vshrZ99 XqwSokpUKy3geJDSxgOM760aZ1Wt91Sn8OY4ueCFaFVG61lzxxXSPihEzzsvDxyw3r44 QFanVN3v++D6YyJ/ZNO4/K/xIMk9haOoK4tApANakCGqNLmYm3OR+O10sfcAYY0F4lNA megS9rWhchU1fWnZtDjM00XBP3yDGCJVIMsupGj6k30dSW7xGz5rEQm1/1ruFEphE35l hQ2xJmN5B2cIZOTUpAUJfcH32pGC2fyK9Hz8tlRfTl5vtblAr2mwjUd3xhy3J01gIrJb 5OtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=xrwp0+Ic; 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 b15-20020a170903228f00b001bc35017804si4483324plh.443.2023.08.11.22.31.33; Fri, 11 Aug 2023 22:31:50 -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=xrwp0+Ic; 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 S229649AbjHLC33 (ORCPT + 99 others); Fri, 11 Aug 2023 22:29:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229609AbjHLC32 (ORCPT ); Fri, 11 Aug 2023 22:29:28 -0400 Received: from mail-qt1-x834.google.com (mail-qt1-x834.google.com [IPv6:2607:f8b0:4864:20::834]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E0CE1736 for ; Fri, 11 Aug 2023 19:29:28 -0700 (PDT) Received: by mail-qt1-x834.google.com with SMTP id d75a77b69052e-40c72caec5cso87211cf.0 for ; Fri, 11 Aug 2023 19:29:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1691807367; x=1692412167; 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=NDyw1JjcpV1wN7RXJDPu6qRAhGishkYEQXNXltLrwqE=; b=xrwp0+Iccpn6Uin6XRwUTuUWAnIphWW88ckS5UVuoJHR53Wz4zPgauLVAlS8ea/reh P6nCQPt5kk6qpeaA28ylijv9M1ShXu/CQqeQ+unDlr0l7ODJE/MVNy5LJ5+miYzm65P9 ewYg0S91YpN/MM4udZ/TrSppR0VBaO7ppUTPtx0pb5l3K5N7GVVdXKZiEq0tn1RYFgXP 22jsWQQsasyrgLUu0kJVAOTTuh/0o+1lwGAChd7eiyHLTE/Sdpv9fYOhS5yqRPkh2juo x9QW7u/JQydETf6QqHhl2k+BhQrQm92GwgG1crEWzw1n3TWeJPmiJVe8O8IQsfGc2YXP y1Jg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691807367; x=1692412167; 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=NDyw1JjcpV1wN7RXJDPu6qRAhGishkYEQXNXltLrwqE=; b=cbvF1b6qWnf7GQdPO5OxbndiaiqYCi/hrT1c6NOQRihgqPWT2SoXCUZcSd4o5w2js0 B/ktftgqtC513F4kr/mBDT/+Quxebao0akCdN7RhCGpA6pYWOywXLEJR3Q6XMQbJKS7P sGmoNB+H3a9S64x6m6nX2h0x8OLbvna9hVzdjul0UdIaczKy+vjULKNW6P8A1hUmUtWd TBFW+syhKxjBEJgyZAuqOH2vz0frWBNhbzXK+JKaure92dXcyH/If//xSX5hc0q10rEl a6xoHgwSJ/jWugZpotmmqFBGnYRykepjCu4EpHheVYsyy0babSjzlW2UWZvD2toCuZ+W uZvQ== X-Gm-Message-State: AOJu0YycGm0E0SzI5LmVCyriMCiLgQ/cRkYDkc3ougU5C/O7b1M0KaGx J/d6pHidVJZkkDuEBSZUXI0hsEeYETN8GgjAEwdYgA== X-Received: by 2002:ac8:5a15:0:b0:405:3a65:b3d6 with SMTP id n21-20020ac85a15000000b004053a65b3d6mr325349qta.13.1691807367233; Fri, 11 Aug 2023 19:29:27 -0700 (PDT) MIME-Version: 1.0 References: <20230809045810.1659356-1-yosryahmed@google.com> In-Reply-To: From: Shakeel Butt Date: Fri, 11 Aug 2023 19:29:14 -0700 Message-ID: Subject: Re: [PATCH] mm: memcg: provide accurate stats for userspace reads To: Yosry Ahmed Cc: Michal Hocko , Johannes Weiner , Roman Gushchin , Andrew Morton , Muchun Song , cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.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_BLOCKED,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, Aug 11, 2023 at 7:12=E2=80=AFPM Yosry Ahmed = wrote: > [...] > > I am worried that writing to a stat for flushing then reading will > increase the staleness window which we are trying to reduce here. > Would it be acceptable to add a separate interface to explicitly read > flushed stats without having to write first? If the distinction > disappears in the future we can just short-circuit both interfaces. What is the acceptable staleness time window for your case? It is hard to imagine that a write+read will always be worse than just a read. Even the proposed patch can have an unintended and larger than expected staleness window due to some processing on return-to-userspace or some scheduling delay.