From patchwork Fri Apr 21 17:40:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yosry Ahmed X-Patchwork-Id: 13220543 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 2ECEEC7618E for ; Fri, 21 Apr 2023 17:40:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B42536B007B; Fri, 21 Apr 2023 13:40:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AF2216B007D; Fri, 21 Apr 2023 13:40:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9944C6B007E; Fri, 21 Apr 2023 13:40:33 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 71D896B007B for ; Fri, 21 Apr 2023 13:40:33 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 49421AC8F7 for ; Fri, 21 Apr 2023 17:40:33 +0000 (UTC) X-FDA: 80706112746.17.DB1658D Received: from mail-pf1-f201.google.com (mail-pf1-f201.google.com [209.85.210.201]) by imf16.hostedemail.com (Postfix) with ESMTP id 7901D18000F for ; Fri, 21 Apr 2023 17:40:31 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=VsD7Uvvl; spf=pass (imf16.hostedemail.com: domain of 3jspCZAoKCFcNDHGNz6B325DD5A3.1DBA7CJM-BB9Kz19.DG5@flex--yosryahmed.bounces.google.com designates 209.85.210.201 as permitted sender) smtp.mailfrom=3jspCZAoKCFcNDHGNz6B325DD5A3.1DBA7CJM-BB9Kz19.DG5@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=1682098831; 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=2xVbU1EXT3F/5uSzRhbvwRdAhlPEIhLbnGkOO/O2kc0=; b=ikWeqgpVRxivbuF7/xcfMrodeJwet0mH5n/hxQZs9fIcOOQr/maS/zv4pLHjApKKoMVLQ7 LZ4FT2kfjUYEiRIfe7j7/KMudGDbwir6dkl6uaHeGRcU/HesdkgNcS2DL68+qYdkyeMQHs BvrKE1R3zn5qEcD1x+pmASeJttHMB2U= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=VsD7Uvvl; spf=pass (imf16.hostedemail.com: domain of 3jspCZAoKCFcNDHGNz6B325DD5A3.1DBA7CJM-BB9Kz19.DG5@flex--yosryahmed.bounces.google.com designates 209.85.210.201 as permitted sender) smtp.mailfrom=3jspCZAoKCFcNDHGNz6B325DD5A3.1DBA7CJM-BB9Kz19.DG5@flex--yosryahmed.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1682098831; a=rsa-sha256; cv=none; b=vIxK/lPRnV5eboxb34onxnvBzv+/LBUcwCwfQYDOIcnqUDBeZ+C6ktAOv6re1Us2eoAzUR R2E6UHalvssvqtyU1qNwAUrCeo2xFFUYhEeUbFQepoE84OgFpK61kh/9Y7z4iFv1HKrdhh 1fpHV0ODOdkH9iugjzG3TvidkA4I4ws= Received: by mail-pf1-f201.google.com with SMTP id d2e1a72fcca58-63b54d92622so1806610b3a.0 for ; Fri, 21 Apr 2023 10:40:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1682098830; x=1684690830; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=2xVbU1EXT3F/5uSzRhbvwRdAhlPEIhLbnGkOO/O2kc0=; b=VsD7UvvlQQthDrDrmrxfA+6j9bxs+fBOtiWfjPuVqKRncTMVYwHyMK7lQKw4z7d6OO 8f3IhH6XmGqVDVmFY8Cyv6LrhOYmMlAEwO97OjVKp4EfQ7GvmXRUQBA2elyZi2HdAWT8 tC3JhABpjBI1uwry+YoMsz8jQ+5FjhTBlcxyLfQuh9MawFFcJmVXlkCxxE83KRAGfIRN izUhapvRy65QRBOUgMasmNbiSkr8HJo7bR2eGmnfXoyNgGu2rdwIe+txD2JLoEKv7Tja ItjbWxT/dXoPWnPJUuXxJqFt3IyOH6lsotFnhAXC0TTQySKSNCNtSjYyYHqymn6WRMKQ FgWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682098830; x=1684690830; 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=2xVbU1EXT3F/5uSzRhbvwRdAhlPEIhLbnGkOO/O2kc0=; b=I3qjm1UVbR+mngqI0RnLv6l5dxBYMeGYx2Gb6flXeflXJAIM4Inzmnry9VoQ4h5r5z fiTkQgKT8PHK8ILMtbLSi1vDSzuCzPu64Q8qmhzA6AXEejRSs8Ujlf8SVNcws1luVgYv cs6jrOSoFs8hB96uouHnu8xby+Z7Ih/CkCeawfk4Hw96wegXgFaYE4WlaiEgYwO7R3Fy NB8emLmclye+iTGF6JQ0ONufK7ntm6J0+/f9FqPuvDHloUAX3KtOIcpZmGGhEoAwkv+v ttYZ2xpU6NLS2MOSvkoZG/0dzmqgx3gHqeVP29lgOsf2Jx5Elqn8YARbYuL4K363RzC0 3L0Q== X-Gm-Message-State: AAQBX9cEIzUsc53iioVDDcgaJhUC7M2WVv3IgGvMf4wZTXDp606J0EuF OvLw3xzuADfdcAz602O3CRSdBqpU1vU3lGvn X-Google-Smtp-Source: AKy350a5A112WsBcfM4E2oTlYZXb/Q86xb8XlqVuh7OqAqi/kCn371in9+BxtMemeJoGBiiS6Eu5MnjLStpGGXAY X-Received: from yosry.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:2327]) (user=yosryahmed job=sendgmr) by 2002:a05:6a00:2e97:b0:62d:9bea:2a0c with SMTP id fd23-20020a056a002e9700b0062d9bea2a0cmr2546450pfb.4.1682098830169; Fri, 21 Apr 2023 10:40:30 -0700 (PDT) Date: Fri, 21 Apr 2023 17:40:19 +0000 In-Reply-To: <20230421174020.2994750-1-yosryahmed@google.com> Mime-Version: 1.0 References: <20230421174020.2994750-1-yosryahmed@google.com> X-Mailer: git-send-email 2.40.0.634.g4ca3ef3211-goog Message-ID: <20230421174020.2994750-5-yosryahmed@google.com> Subject: [PATCH v5 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 , Tejun Heo Cc: Jan Kara , Jens Axboe , " =?utf-8?q?Mich?= =?utf-8?q?al_Koutn=C3=BD?= " , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-mm@kvack.org, Yosry Ahmed X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 7901D18000F X-Rspam-User: X-Stat-Signature: zq7sunwkzwd9ot7sw8azeourbgmkeu3s X-HE-Tag: 1682098831-206951 X-HE-Meta: U2FsdGVkX19k5vg9R5VtamneIp0SFuofu8loErxtXcxcyTNtrLgkccGAhSq4ujLzouHzqEeZAIm3YhfSfCvlntwAm261oePkszEHgmYSxvaVwBS/i55HdhW43z7xjmYoBkkEy6KwPkreKK5/doez7eagMiEstOoF9a9xOFw/UhSUA4b+hVNa+6kBrnkY8o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3h9q1ezB64cWERdiLlN4CYHePCcoro8+DxWFIJURcFcVGqecj437JTVfymZLsGI4Iv5SICzxrihChu/HovyPFGBU3/nC+K7UXk5BJtxaMAx4PjO9kBXNIA1dpORyylJX0/v9S/pXS/S4jrVbYhmk9FIl9k8EDng4SDyuHPfjhpov9/kxjQ0GqHTPNDtosQCrHlm+wl6vFNjn/mW+hS6V8/nrCZGtpcFCPng8sbO+zaFIyskfwY7o5wkCV6x6/32sUphK6HvgeogORbQG7I0SKnB5Wjm2MMDeNcA5Nw5l+dzt+K8UxFpHAY5MQqlZRwqup58AvdLWFZTHzHUHy4rAu4rwZK7PqdjlRYhD3mcYkG2zHg8lBdjABxFKCUkEdLxAqfVkY4hwUAldp0OvL9Z/c9PTrtifvT0sBYWokuNpKTSnfw4A== 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 222d7370134c..00a88cf947e1 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 cb78bba5b4a4..eadfe371a8f2 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -639,7 +639,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 @@ -652,30 +652,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) @@ -690,7 +676,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); }