Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp5134190rwl; Mon, 3 Apr 2023 15:05:51 -0700 (PDT) X-Google-Smtp-Source: AKy350b3nlClIxsh/McZm2J3PuRkgIslbwo+2ILU66pnTfYV4zhUiCNcytHlvULaGWBMzfCz7e+T X-Received: by 2002:a05:6a20:7511:b0:d9:199a:c719 with SMTP id r17-20020a056a20751100b000d9199ac719mr177627pzd.37.1680559551239; Mon, 03 Apr 2023 15:05:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680559551; cv=none; d=google.com; s=arc-20160816; b=WWSxIFjFAssd7c7LgxFGZr4eabkx1sfkmizVLjGt/ztLrOwtvwhpuAn7r8zPQ6xdLn fX3cDuurrc+zRr84KZnPA++kmsWVlO6ZDWYCsGCxf4ny2qyIB62T71XT4XoAdtxv/Qh6 nY3kHHQKekGJVBtef/kf9aGQD8iTQ5wz+RUnaXpmaodVFh70/RaA4uprZxMeMeTRec2A d4R9p4lfOQzyVywP5W0rmLBlQEqinJ6SULJsAoCxNRb3nWIbpHt+Mp6xkAGba8KYurw8 7EKMsHuZ53BXqtT5+7kMoSLK4mXogizTdxJaxTo+52FP7uPF1LcnlKHvskrnfppGxgyW MNgg== 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=hNJBwGVVZOmg9VOOVOlV/1s5wuc6P4CJY0BTT3hY1AM=; b=x/tmxO64P9gusEfdlJrWrN/BC3JR/xYn6cdoU2t4/zJi4DtBplhhXQ3CPgxgiTbU35 ZeZI4CzTKYbBATcaQkwrSGKWS3e8QtU2uCEmOMkzz7hyRreHEWxXNqavnV7Acti9wQ76 LkXNUxWmRWHWeAjfBv4UcIc17TT03IoSV/YPV5Og/sID85m5u7mSuXCaexZ4X5KDaHDs AvYTmnuJNL717gTQ6IsJg4WfNRxUubiIJ5ikUXIdZfe+TgG9n3ReYZiedtWAucDqaW7j uyjQSngqYEHXNkF6KE+1lMrz61Y1PffZoD4GWlOkVq+43SA11W3aXtVoiYvwoQh4t3YZ yeCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=PLSbfUpO; 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 w62-20020a636241000000b00513a793932fsi8415360pgb.394.2023.04.03.15.05.39; Mon, 03 Apr 2023 15:05:51 -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=PLSbfUpO; 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 S233690AbjDCWEL (ORCPT + 99 others); Mon, 3 Apr 2023 18:04:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233294AbjDCWDx (ORCPT ); Mon, 3 Apr 2023 18:03:53 -0400 Received: from mail-pg1-x54a.google.com (mail-pg1-x54a.google.com [IPv6:2607:f8b0:4864:20::54a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E00DF26A3 for ; Mon, 3 Apr 2023 15:03:46 -0700 (PDT) Received: by mail-pg1-x54a.google.com with SMTP id t12-20020a65608c000000b005091ec4f2d4so9025757pgu.20 for ; Mon, 03 Apr 2023 15:03:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; t=1680559426; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=hNJBwGVVZOmg9VOOVOlV/1s5wuc6P4CJY0BTT3hY1AM=; b=PLSbfUpOYbUqIYWD0lVUspaLdyltho/9MJ34jFGgaIu6ps/MvfYgJtvBICL0/UsCg8 Eo1bG+CpaO1W/JWBORyxWnVMwYforRdWFpLcNNnnTr6WckgWqX8cpRotu3SoW3jnNsSm PizUX3QJilPLsW/5Gft8jVYazARk9Ut3n4G+JQv0SopU/bBBAHVR6m+9um87Q19Q1oES JkmqUr13ZWZzVKrKo78OL0QtsqIHc61QjUXFxRzUrqMEuTOHPCZ7yp3LqOiDIHhK80Se /pN6/hsU4YI1MwbFb/U4Ozh2+s+tmlO9zkIjBJHts6ziq2HpcgAoxfLImivvQtFY+h9I 09eg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680559426; 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=hNJBwGVVZOmg9VOOVOlV/1s5wuc6P4CJY0BTT3hY1AM=; b=molHDdatagpyIiJ+QXM63COZWvX6CwT/WA4bLd0tznij0SgeUnQuJGMUK4Dz+a3YtV Mu0dHz+Ou33xOykk8vI7HVM2RcAdDyt/c+7XDJ+0J9u17FSy1urkpqpufe53uYmuhg1F oCt7mJCXbS1g8rhfW+9iyCBA7vuSighyF37YD2f0w+nFGFTt65SQfe6Su7sGDhvidFxT PYmuytfNsNWBV1wFWIBHzBYebOYUa7oqJFu/rWNaBRYNfFueoP59wyb13bT5Op78JsMC C3MiR+b8SCaL5IFrXWFPPUaiAttWlhdTgEaNq2NvMQcEXJlXJOA/wOnO5eMeqvyr+lgt uf/w== X-Gm-Message-State: AAQBX9fjwFxQ0axO9cIAj/EmA+2qs+MQ2zMo1JGV2mTwWCN5pMq60nVL 34qWz5phCuVLbEgTr6rTFUkaomXUDK/ELaSt X-Received: from yosry.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:2327]) (user=yosryahmed job=sendgmr) by 2002:a17:90b:4cce:b0:23b:5155:309f with SMTP id nd14-20020a17090b4cce00b0023b5155309fmr7558849pjb.0.1680559426408; Mon, 03 Apr 2023 15:03:46 -0700 (PDT) Date: Mon, 3 Apr 2023 22:03:36 +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-5-yosryahmed@google.com> Subject: [PATCH mm-unstable RFC 4/5] memcg: remove mem_cgroup_flush_stats_atomic() 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 Previous patches removed all callers of mem_cgroup_flush_stats_atomic(). Remove the function and simplify the code. Signed-off-by: Yosry Ahmed --- include/linux/memcontrol.h | 5 ----- mm/memcontrol.c | 24 +++++------------------- 2 files changed, 5 insertions(+), 24 deletions(-) diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index 222d7370134c7..00a88cf947e14 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h @@ -1038,7 +1038,6 @@ static inline unsigned long lruvec_page_state_local(struct lruvec *lruvec, } void mem_cgroup_flush_stats(void); -void mem_cgroup_flush_stats_atomic(void); void mem_cgroup_flush_stats_ratelimited(void); void __mod_memcg_lruvec_state(struct lruvec *lruvec, enum node_stat_item idx, @@ -1537,10 +1536,6 @@ static inline void mem_cgroup_flush_stats(void) { } -static inline void mem_cgroup_flush_stats_atomic(void) -{ -} - static inline void mem_cgroup_flush_stats_ratelimited(void) { } diff --git a/mm/memcontrol.c b/mm/memcontrol.c index e7fe18c0c0ef2..33339106f1d9b 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -638,7 +638,7 @@ static inline void memcg_rstat_updated(struct mem_cgroup *memcg, int val) } } -static void do_flush_stats(bool atomic) +static void do_flush_stats(void) { /* * We always flush the entire tree, so concurrent flushers can just @@ -651,30 +651,16 @@ static void do_flush_stats(bool atomic) WRITE_ONCE(flush_next_time, jiffies_64 + 2*FLUSH_TIME); - if (atomic) - cgroup_rstat_flush_atomic(root_mem_cgroup->css.cgroup); - else - cgroup_rstat_flush(root_mem_cgroup->css.cgroup); + cgroup_rstat_flush(root_mem_cgroup->css.cgroup); atomic_set(&stats_flush_threshold, 0); atomic_set(&stats_flush_ongoing, 0); } -static bool should_flush_stats(void) -{ - return atomic_read(&stats_flush_threshold) > num_online_cpus(); -} - void mem_cgroup_flush_stats(void) { - if (should_flush_stats()) - do_flush_stats(false); -} - -void mem_cgroup_flush_stats_atomic(void) -{ - if (should_flush_stats()) - do_flush_stats(true); + if (atomic_read(&stats_flush_threshold) > num_online_cpus()) + do_flush_stats(); } void mem_cgroup_flush_stats_ratelimited(void) @@ -689,7 +675,7 @@ static void flush_memcg_stats_dwork(struct work_struct *w) * Always flush here so that flushing in latency-sensitive paths is * as cheap as possible. */ - do_flush_stats(false); + do_flush_stats(); queue_delayed_work(system_unbound_wq, &stats_flush_dwork, FLUSH_TIME); } -- 2.40.0.348.gf938b09366-goog