From patchwork Mon Apr 3 22:03:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yosry Ahmed X-Patchwork-Id: 13198875 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3C472C76196 for ; Mon, 3 Apr 2023 22:03:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BEEA1900005; Mon, 3 Apr 2023 18:03:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BA0EE900002; Mon, 3 Apr 2023 18:03:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 97C61900005; Mon, 3 Apr 2023 18:03:49 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 85149900002 for ; Mon, 3 Apr 2023 18:03:49 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 52A941A05F7 for ; Mon, 3 Apr 2023 22:03:49 +0000 (UTC) X-FDA: 80641457778.04.FE5921B Received: from mail-pj1-f73.google.com (mail-pj1-f73.google.com [209.85.216.73]) by imf26.hostedemail.com (Postfix) with ESMTP id 89CE4140011 for ; Mon, 3 Apr 2023 22:03:47 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=PLSbfUpO; spf=pass (imf26.hostedemail.com: domain of 3Qk0rZAoKCLEpfjipRYdVUXffXcV.TfdcZelo-ddbmRTb.fiX@flex--yosryahmed.bounces.google.com designates 209.85.216.73 as permitted sender) smtp.mailfrom=3Qk0rZAoKCLEpfjipRYdVUXffXcV.TfdcZelo-ddbmRTb.fiX@flex--yosryahmed.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1680559427; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=hNJBwGVVZOmg9VOOVOlV/1s5wuc6P4CJY0BTT3hY1AM=; b=to9dChtp7oo8+f/nu86QCx08Av/+0kywlJmcyppleAdqZS3dBBIdqKUCE4/UvKmwiKYqZl A2SK8WlS4uHOPB/yibmbmSDcLbcB7yCcLZesQza0ihnNfDLzlJdOdPnGPqLpYCPTtHJONG j9/Ho+ibKWi5jTawgfbJzeqFp39f9gk= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=PLSbfUpO; spf=pass (imf26.hostedemail.com: domain of 3Qk0rZAoKCLEpfjipRYdVUXffXcV.TfdcZelo-ddbmRTb.fiX@flex--yosryahmed.bounces.google.com designates 209.85.216.73 as permitted sender) smtp.mailfrom=3Qk0rZAoKCLEpfjipRYdVUXffXcV.TfdcZelo-ddbmRTb.fiX@flex--yosryahmed.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1680559427; a=rsa-sha256; cv=none; b=llZQGVaohcqKDePetL2hZ0bFHNrx8iZPgEwSSsyvkOR78VWFxEHf9TAMTSJwdYZxWmfdX5 rVtZqYftplQzioevIrWOUkqQPHg6bg4SkJY8zbtIudoPkzAK49v+FO+kYBLbvZvAhUU2Cn a165davbjdNeQYfOdISzI0/GFp3v9Ic= Received: by mail-pj1-f73.google.com with SMTP id qa18-20020a17090b4fd200b002400d8a8d1dso14796851pjb.7 for ; Mon, 03 Apr 2023 15:03:47 -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=B3VglrYVsG4RqHjB+++2vwIjJ0VmGJ4oDSC79qmCGFTPJHOGhvSKgBAoZWN2yj7I30 NklVHMtGj/6XGevnujY8TuyqtdEKkIVhFzlychI05uyTdRpubIGWXjlo6mBimb2FvO0y ODUyPlfMZT6p8b1947rOJHkrOXAiQdY09TXN6buNGLRRkjtXLW3+kLFukHtsqfP5fV1t Egm8K92terGzztVombyR6EyQi3NFv4OVblSs/1sAwUnHaHHZcK/svEjksIveoh0IkZyp eiqjlsZU12K/QhSsnc0/vtet1RdqrdMVjLyNVTbg9m2mHWUBUO2oXiuOUKsnwdmVhxoV m0Vw== X-Gm-Message-State: AAQBX9dBYbgs2qqcSluxn2NtyGsJoMKFem4X87vJpKfP0y9Y7CzyNeqb +XfZOH/eDwOXZkQ5ezUEvsmhTnrphkTa4vWe X-Google-Smtp-Source: AKy350YqjuJx0cPEvkhGlL8e3G8Xhx/mHcAIKY7AoMYKpy6RY5t/7e2yXmvxs0CQV10HpQGcD3F9B9OJJYiZoWXv 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 X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 89CE4140011 X-Stat-Signature: 98sh4z5zxkuk3awzuro61hiao4jaup3a X-HE-Tag: 1680559427-879674 X-HE-Meta: U2FsdGVkX18Vk1+2b1N6YMrHX2tlFlO/4YMBl02ht4MRtBtnxy/moc1rbLnjDAyz92IcofYNjSg+eU0wwhG9ltkxMG4JKsuLR7/U73U9whCH3VKD5BMOdOqIVwV6kLY4KqQiPS5r5491h3Q2lBIPZhYaKZ54QgSpcz59zBuWHmYedD4TLr6ThyaIhYYS1dqaUM107CYQ+r70YpX9fD+xywsIohu6LjS5lkSh4MLDKfbedvHWYokAkd0HTy5xoLllvkYnOjqDZsHeEkDhw8GX2P2dt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8k0kHQSOouIJCiu9yjh/V5zOEvkMs3NgDOscz10Wl8t5gacsYKLsT5Z5OXuKjk5nWM72MTT04Iyhx8lztjfJvS4HgPX2aeZ9lHDTPt1pZQfUi59DsS5J/XF1bkZftn19acucfW8hnH2U3OUJ8G4FZYONLucq8uy0JgZ6vOuNxyDfdugev+aGqt1ZS7vt0CbQGWm6Yqno4JCo4M/yOpmV03uQZoEXPHov7iDlcumC4Do+OosxmWMDoier47cEgbRnkY80Vl5+x0fBufmPgZOya3GlwfSSG00BjeEqm1Xt9Ii4XbMmwp6vKfEtA64FdXcCingiaid/9ytPSJkOKD4t/biq8ycGo4/4mXAsddJQ= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Previous patches removed all callers of mem_cgroup_flush_stats_atomic(). Remove the function and simplify the code. Signed-off-by: Yosry Ahmed Acked-by: Shakeel Butt --- 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); }