From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 33332C6FD1D for ; Thu, 30 Mar 2023 07:56:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229893AbjC3H4K (ORCPT ); Thu, 30 Mar 2023 03:56:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229916AbjC3H4C (ORCPT ); Thu, 30 Mar 2023 03:56:02 -0400 Received: from mail-ed1-x52c.google.com (mail-ed1-x52c.google.com [IPv6:2a00:1450:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A454E6195 for ; Thu, 30 Mar 2023 00:55:54 -0700 (PDT) Received: by mail-ed1-x52c.google.com with SMTP id cn12so73100341edb.4 for ; Thu, 30 Mar 2023 00:55:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; t=1680162954; 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=anbj3k8bVreIFvoy5ezWKZvlLhuV6pERZy1Bnx+kNns=; b=ZD9aj6n0GX26RjIgVcV8XWHXeXxhiTySnXtfLlIh2Y4ULsYer620/o/Gxai5NDEyx0 U9cLhrKkIyrcXCb9H0C1LsSrI3aYqgf3GO6P4vMGibxu+NJs5rV7tQbNe7/BuzZ9ngD4 QlTJGq/55WJCvX0baHxwlbOU546xXFXX3rhwhxfTlPe1DtgL+SZFj+3v/M/zynT9IjDn ZyadAB66teMDMbs9xKwieRC4GEnlOFheMYpz1xGF7yvvoKjAofsoTZMoVDKAnSS6/+pv n2YA0BsqSmXP4EqjlRt/DgekBF6qWk4ejPD+mZWis8RRK9kN76WGkT00+z0dkPShQagp 7beQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680162954; 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=anbj3k8bVreIFvoy5ezWKZvlLhuV6pERZy1Bnx+kNns=; b=EHF1By9+JdczKNmV3Z79rlEd8F2Bm1o5/yE7d1HM8E+vkTH1k8NO/J3vO4ruwdvwwy +rPwEfOiSjh2UVCKW5PZ+4G3Wg81T8u9ogEmCZBf6EDXFfhehDjuE9XcKSqXCtowqNuu KTDxplpUmIWO0MXSE/IW3ciDasmtLLx+QfFU0a7XOE/mXespINTf5F32oew+zg0Ugd7N C3gk4i0PjvcKezAXbRudKfgRZIzRD5wtPFxCQ4Ym3NP4m5Vr+KiNBRgclDr4B/aG0dY3 8mxsFJC83ThgrAl0HZ0XluegyFVWIWkIQ22nNWX3Yk+rDJ+Pyp8wRrENpI0RKJeubYTp 3hyA== X-Gm-Message-State: AAQBX9d5WxDie0tGQ5U+FjB5q1synPCgyxa6d+AE54VpQnOL5UgQH/U2 Gcr7rxbfzzYVf8qtnJdE/9mb/5XaNC6ybPS7rKGWQA== X-Google-Smtp-Source: AKy350ZKBVchKo8yL5qnCRGOKj6HMXymGhCHv0sbs5xG5akH53sSrKAZcQmbeW6Sz+oAWJWB2Er2VE8WUpb+CRjLT3s= X-Received: by 2002:a17:906:eec7:b0:93e:186f:ea0d with SMTP id wu7-20020a170906eec700b0093e186fea0dmr10952473ejb.15.1680162953989; Thu, 30 Mar 2023 00:55:53 -0700 (PDT) MIME-Version: 1.0 References: <20230328221644.803272-1-yosryahmed@google.com> <20230328221644.803272-8-yosryahmed@google.com> In-Reply-To: From: Yosry Ahmed Date: Thu, 30 Mar 2023 00:55:17 -0700 Message-ID: Subject: Re: [PATCH v2 7/9] workingset: memcg: sleep when flushing stats in workingset_refault() To: Michal Hocko Cc: Tejun Heo , Josef Bacik , Jens Axboe , Zefan Li , Johannes Weiner , Roman Gushchin , Shakeel Butt , Muchun Song , Andrew Morton , =?UTF-8?Q?Michal_Koutn=C3=BD?= , 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 Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org On Thu, Mar 30, 2023 at 12:50=E2=80=AFAM Michal Hocko wro= te: > > On Thu 30-03-23 00:42:36, Yosry Ahmed wrote: > > On Thu, Mar 30, 2023 at 12:39=E2=80=AFAM Michal Hocko = wrote: > > > > > > On Tue 28-03-23 22:16:42, Yosry Ahmed wrote: > > > > In workingset_refault(), we call > > > > mem_cgroup_flush_stats_atomic_ratelimited() to flush stats within a= n > > > > RCU read section and with sleeping disallowed. Move the call above > > > > the RCU read section and allow sleeping to avoid unnecessarily > > > > performing a lot of work without sleeping. > > > > > > Could you say few words why the flushing is done before counters are > > > updated rather than after (the RCU section)? > > > > It's not about the counters that are updated, it's about the counters > > that we read. Stats readers do a flush first to read accurate stats. > > We flush before a read, not after an update. > > Right you are, my bad I have misread the intention here. > > Acked-by: Michal Hocko Thanks! > > -- > Michal Hocko > SUSE Labs