Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp5133372rwl; Mon, 3 Apr 2023 15:05:07 -0700 (PDT) X-Google-Smtp-Source: AKy350ZEf5xFMZIC3i0S47FPcfai8uKKdEvJnVqOqSPBiYZl2UbYgnrViXYETTIiqAf5LdEhNTh6 X-Received: by 2002:a05:6a20:a724:b0:db:6026:4393 with SMTP id by36-20020a056a20a72400b000db60264393mr104303pzb.59.1680559507596; Mon, 03 Apr 2023 15:05:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680559507; cv=none; d=google.com; s=arc-20160816; b=Og+7uil6zD7LG3h8n0C6r9eyAG+1QpFyD8+bjPAntu3PTPAFRqXEstObDD8Pm8HF6E Xg6PIfuFX/rIykvbCX8sRIP/3RIG0/pPyRfNwyU9LeMPouXPNgT+KMCAZvZcDTjKU3qp I4gSv/LGN0AdcONlJNgsgW8lfpmIiAwqYMIVPKpguTrsG0k1KE5S2g0Nkx6oabJvzci1 RzmYsEdLoMfvI6RYz7Kk0fBGqVcopLzx4i0s5ZrPiwbwEtmTOxd+7mJ1O8YsjfD2yQY1 RSHYwrSG5isgmajXYbGr5xd387Q0n8pYf27+LgbNRKBcmxT/nIGEBXJ/cy5wKIU/I07d EPtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:dkim-signature; bh=9Hf88QAEgRalaH3f7thcio7vExcVqqDxAYa/aCaE9Jc=; b=B+pP+zJ6IfVChOHycQuZxOQN0mkYpDzIsW18eEj+259cEkaIQ77W11ibjFRNuAoqRs 8daJy+729PMONHgWeqdb1nMmWZ2eg7VrX/eeLXmkt3mMbC+W9F/hucV7WiH4CCjneS0O u5vw7hpnWkwkkAAAgEZOIXsu74zU31uYODaxFo9lguidS7Gyg9W29C0d0bLsS1XrLHvB W91fGLoXlhRRIxTqAyRGZpTuQKGzwPgiut/tr/DrXL6Yg7+r2nVsgpbBw6KUgtsgh1D1 VydIRG3d+W1b84eNvSRmOtMyFPae7hnRJQ7q1E8WRrcNJhT2+n3+bJzWw34PX4c4Q41T cbdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=Qd1B7SbD; 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 v16-20020a63d550000000b0051323bae2c2si9293237pgi.844.2023.04.03.15.04.55; Mon, 03 Apr 2023 15:05:07 -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=Qd1B7SbD; 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 S233672AbjDCWDv (ORCPT + 99 others); Mon, 3 Apr 2023 18:03:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233609AbjDCWDo (ORCPT ); Mon, 3 Apr 2023 18:03:44 -0400 Received: from mail-yw1-x1149.google.com (mail-yw1-x1149.google.com [IPv6:2607:f8b0:4864:20::1149]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 975261BF3 for ; Mon, 3 Apr 2023 15:03:43 -0700 (PDT) Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-5446a91c40cso305705697b3.18 for ; Mon, 03 Apr 2023 15:03:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; t=1680559423; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=9Hf88QAEgRalaH3f7thcio7vExcVqqDxAYa/aCaE9Jc=; b=Qd1B7SbDQyGizezUFQyV/0tO/bOhj44AtZ1VKHtgOG9TbJavAnnMGZmO6zQIpqIoK7 5cj24hiW5m5RcceJDQ1KEplDfhRxIe4M8gmfj3L+NZAuLHvyis3MtYjzW6MZhBerb1QT JbsSvLpI6syO5GW80nsYNqGOYj2kCCLCJxDrHY++EHRBCuORnOG3ZRIIIY9qF02f9mrK 7QKQBjFz8zSpKFSQE5ME0/wr0Ah4Zv+Tdpoq6l9nLH2lZJPiIROIUeme5UI6HVL7rK6b PMhT9C0HP1QYba587rjt9xa6OsG8uX3e11ytS9ZKFnspyAhVnb6ce2SHS6u9IWMy0H74 szug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680559423; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=9Hf88QAEgRalaH3f7thcio7vExcVqqDxAYa/aCaE9Jc=; b=3DulaFOOceirPGK7isgrgoRwFREToXZL4+w0qsYE0Zv5YDjWC+A1ANPfxfPr71QFIz OicO5fmMK7jNHzgehbOlddLK+Wxf1o9PLeiwtmVbkW8X6vdZEX02WooqStsX4EFlrbNo ayIOhV2WqI67iGzS4V8ojZE4nfWrfFdUGQIdPvFVknBLxuglR0M/R6ZqSzi/yGNHSZW4 jPk2K2hbzFLmCTFe5u8wvlcxVIgvUmqu/vNfjEYo0BSa/jC9KM35+NVunmJ+4UCIq+WP cyr1Q/zqVuOvc+YXrVHhsHTvhqO9EN3t546MNj5p8TlonjYe7p9me01LhNJAtu6nPloR zaSQ== X-Gm-Message-State: AAQBX9ehX78i5t+yBQAcM1zq6lkHU2R79AuLyK0X5lEfGJV2yI81CVEZ +LY5o/RmZDANCYIK+g/CU50NMhNdCPHXtQT4 X-Received: from yosry.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:2327]) (user=yosryahmed job=sendgmr) by 2002:a81:b60f:0:b0:545:bade:c57e with SMTP id u15-20020a81b60f000000b00545badec57emr288637ywh.5.1680559422857; Mon, 03 Apr 2023 15:03:42 -0700 (PDT) Date: Mon, 3 Apr 2023 22:03:34 +0000 In-Reply-To: <20230403220337.443510-1-yosryahmed@google.com> Mime-Version: 1.0 References: <20230403220337.443510-1-yosryahmed@google.com> X-Mailer: git-send-email 2.40.0.348.gf938b09366-goog Message-ID: <20230403220337.443510-3-yosryahmed@google.com> Subject: [PATCH mm-unstable RFC 2/5] memcg: flush stats non-atomically in mem_cgroup_wb_stats() From: Yosry Ahmed To: Alexander Viro , Christian Brauner , Johannes Weiner , Michal Hocko , Roman Gushchin , Shakeel Butt , Muchun Song , Andrew Morton Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-mm@kvack.org, Yosry Ahmed Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-7.7 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_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 The previous patch moved the wb_over_bg_thresh()->mem_cgroup_wb_stats() code path in wb_writeback() outside the lock section. We no longer need to flush the stats atomically. Flush the stats non-atomically. Signed-off-by: Yosry Ahmed --- mm/memcontrol.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 3d040a5fa7a35..bdd52fe9e7e4b 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -4637,11 +4637,7 @@ void mem_cgroup_wb_stats(struct bdi_writeback *wb, unsigned long *pfilepages, struct mem_cgroup *memcg = mem_cgroup_from_css(wb->memcg_css); struct mem_cgroup *parent; - /* - * wb_writeback() takes a spinlock and calls - * wb_over_bg_thresh()->mem_cgroup_wb_stats(). Do not sleep. - */ - mem_cgroup_flush_stats_atomic(); + mem_cgroup_flush_stats(); *pdirty = memcg_page_state(memcg, NR_FILE_DIRTY); *pwriteback = memcg_page_state(memcg, NR_WRITEBACK); -- 2.40.0.348.gf938b09366-goog