From patchwork Fri Apr 21 17:40:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yosry Ahmed X-Patchwork-Id: 13220544 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 5E185C77B78 for ; Fri, 21 Apr 2023 17:40:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EC4B86B007D; Fri, 21 Apr 2023 13:40:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E755E6B007E; Fri, 21 Apr 2023 13:40:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D3C806B0080; Fri, 21 Apr 2023 13:40:35 -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 C50D06B007D for ; Fri, 21 Apr 2023 13:40:35 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 9CB23C083E for ; Fri, 21 Apr 2023 17:40:35 +0000 (UTC) X-FDA: 80706112830.30.0AED94B Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) by imf30.hostedemail.com (Postfix) with ESMTP id D176480010 for ; Fri, 21 Apr 2023 17:40:32 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=2LLI0uS0; spf=pass (imf30.hostedemail.com: domain of 3j8pCZAoKCFgOEIHO07C436EE6B4.2ECB8DKN-CCAL02A.EH6@flex--yosryahmed.bounces.google.com designates 209.85.219.202 as permitted sender) smtp.mailfrom=3j8pCZAoKCFgOEIHO07C436EE6B4.2ECB8DKN-CCAL02A.EH6@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=1682098832; 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=xEOFJLcgICBTmNTLnyQD1ooBVf7w9cMBHK4zBwAxhps=; b=m4zJqlRCOaxwoFXrSVZTMwTtJP2L7UjMkuzuKI88o23rP/kvVf2tjDUzIbLvHo6q7KiwD+ eDleM5ifAaT5wtEZ8ujImfZPzuaZ/h/wcQPZkSe/J7LvTzFFufU0vjUaX8yDGaTuS4qskv G1j7o6Eg/OJZQJCu3GVEbWLAIQzLXxg= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1682098832; a=rsa-sha256; cv=none; b=dCGM3KqgVnLFAZoTC7s232bR4Uc4nYA8+nyQmtxJ895i9bW6I29lYoP41QTKB1+hLj6wtJ J3qLXjdr1MZOcHGt7CUuDRGkABxj5wlcWwff8NYmyG27aqVDGvDZjTxhvIpzR4Nl3ucZZH eJ/v5NQoQHHX022OXUsOxS4Rh8e1RlU= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=2LLI0uS0; spf=pass (imf30.hostedemail.com: domain of 3j8pCZAoKCFgOEIHO07C436EE6B4.2ECB8DKN-CCAL02A.EH6@flex--yosryahmed.bounces.google.com designates 209.85.219.202 as permitted sender) smtp.mailfrom=3j8pCZAoKCFgOEIHO07C436EE6B4.2ECB8DKN-CCAL02A.EH6@flex--yosryahmed.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-b8f53c7683fso3340255276.0 for ; Fri, 21 Apr 2023 10:40:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1682098832; x=1684690832; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=xEOFJLcgICBTmNTLnyQD1ooBVf7w9cMBHK4zBwAxhps=; b=2LLI0uS0HCGgUG+To5FG73zbxk+tuzk5tTcOBZNGKwnVbYk9yq2r0zkyTl0MD4wfQ3 kKiggVfa7NNclULg8NuxAqHV3zYnq7LZjfMrcVD62yChQCNHWbk54zVsBhxomTb0t0SN +XgJr7wul3fQD2JopF/MZfktxPtuUWKER8IL9ZU+RSEl7sW66jFXxgj6K5ErZztO7Nce l4ZWAyWNanyDDUgKfIgOcWOkpHNwJKJvYyr6/84gH8i9GqoBVPKeVaSusHPk+GdeSMBt A9hidHBqS6YCIVpadKtHiQ8uYxCY8mC3l7iI3bjfr9izY/KQoToKFIDt3lP79eIF321D fMOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682098832; x=1684690832; 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=xEOFJLcgICBTmNTLnyQD1ooBVf7w9cMBHK4zBwAxhps=; b=BkJTHhr7oyBJWEAWEV/okDj8qjwSCQbnIGkut/zmbu2/hMqqg1dCghew8MCPM5oesb Z3dXcUO7p58sdfOYWvmLkmJM0mlsfA/eTuug9CkAUiXWGOUbp/oFSf+vzQ7RWh8vC9JJ OxkPUTaSq2JSGhfv6UiHlUaJkGYFc6//DOnqFYlAApKbq0UAnw9Q8E1JrDydOo4p3f8G dH+x++JzKtF8OVbdL1N61K6/uw03WYnJ4p5Me0zXmfFCcAgzx1k7aFIsV3lo/9nFSW3F VEF3vKj3Ujr1Rrs1O+3VQRQS4w8Pc6Rmi9N144kewT8+i5vjVCIdinV8+13IjIbDug2h eoWQ== X-Gm-Message-State: AAQBX9fUFCbdJ+Hly0Mi07KQR6QQJEXyfXZHPC4RLfIMWBp5tnwpHSqp 4FjmxDP/8BqfLPc2dUhJJiv+xfOSUD2ulMQg X-Google-Smtp-Source: AKy350ZZ8ts19Uuwp1KvgVZn+d+WSE2zsbcOTm9kgrCL3PJuuy6na6YJxn3jgGZppB+bAg1Vc1I9v8GZpcBWJ5vX X-Received: from yosry.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:2327]) (user=yosryahmed job=sendgmr) by 2002:a25:bc4a:0:b0:b33:531b:3dd4 with SMTP id d10-20020a25bc4a000000b00b33531b3dd4mr1583021ybk.1.1682098831943; Fri, 21 Apr 2023 10:40:31 -0700 (PDT) Date: Fri, 21 Apr 2023 17:40:20 +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-6-yosryahmed@google.com> Subject: [PATCH v5 5/5] cgroup: remove cgroup_rstat_flush_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-Rspam-User: X-Rspamd-Queue-Id: D176480010 X-Rspamd-Server: rspam09 X-Stat-Signature: 7uzri6aybd6mruj7n11zuuctuegr7kfi X-HE-Tag: 1682098832-625164 X-HE-Meta: U2FsdGVkX1+cv0Ru65rP0tgoCKjBvld8+HSCq5VyEGRm17t0t59+oQ0NSzKcZDkVKMs2mR/rN0RQ9feU7Vn2xXTzM2CFORmMqNrlThQZboG/ugqHu1HV8/4YyINQCD3qKWbHvPj/lDhN4Z6xowvRhYWrpsA+nrv7XGUWtlI4DMPIZGCtiaW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ON7sJCrGtyTqtc/7oFwDg36CO3yGNo1f2lnkPAfQVqJjm1HG1DBtGKTcWUHkAC6ki+JZeOPpGznuBlMOKajOEBW/mpR6330elswTPMVCMYygk10djqyjz5tTJawBG6uCfEMCmbXKtrGHc1e73O2YUQdvnKNFS9L1B6WCMykKK2wfRcACyGMTxgnBI2eazQpZTT4rkfqcFQjBS9Ayhqj7bILGhuJcdGqVlBX+ItmmTlfKKpopx6jZFV8LL0QBZK4aIq4jALTwLuUvgEPJD4lM8XDWJgcz7mu0kx5sUqzL3jyvhbnAZ12txBkrYvnr0HNETK70zPeUZH9oZLcDHJWe3U4aXFkB29zIaOo0hC3Q8OdeI+wZwVXZf6c3BQ0OZs7efVQfU8g8F7P79R0st3HwihFkQ3so47uQ== 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 the only caller of cgroup_rstat_flush_atomic(). Remove the function and simplify the code. Signed-off-by: Yosry Ahmed Acked-by: Shakeel Butt Acked-by: Tejun Heo --- include/linux/cgroup.h | 1 - kernel/cgroup/rstat.c | 26 +++++--------------------- 2 files changed, 5 insertions(+), 22 deletions(-) diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h index 885f5395fcd0..567c547cf371 100644 --- a/include/linux/cgroup.h +++ b/include/linux/cgroup.h @@ -692,7 +692,6 @@ static inline void cgroup_path_from_kernfs_id(u64 id, char *buf, size_t buflen) */ void cgroup_rstat_updated(struct cgroup *cgrp, int cpu); void cgroup_rstat_flush(struct cgroup *cgrp); -void cgroup_rstat_flush_atomic(struct cgroup *cgrp); void cgroup_rstat_flush_hold(struct cgroup *cgrp); void cgroup_rstat_flush_release(void); diff --git a/kernel/cgroup/rstat.c b/kernel/cgroup/rstat.c index d3252b0416b6..f9ad33f117c8 100644 --- a/kernel/cgroup/rstat.c +++ b/kernel/cgroup/rstat.c @@ -171,7 +171,7 @@ __weak noinline void bpf_rstat_flush(struct cgroup *cgrp, __diag_pop(); /* see cgroup_rstat_flush() */ -static void cgroup_rstat_flush_locked(struct cgroup *cgrp, bool may_sleep) +static void cgroup_rstat_flush_locked(struct cgroup *cgrp) __releases(&cgroup_rstat_lock) __acquires(&cgroup_rstat_lock) { int cpu; @@ -207,9 +207,8 @@ static void cgroup_rstat_flush_locked(struct cgroup *cgrp, bool may_sleep) } raw_spin_unlock_irqrestore(cpu_lock, flags); - /* if @may_sleep, play nice and yield if necessary */ - if (may_sleep && (need_resched() || - spin_needbreak(&cgroup_rstat_lock))) { + /* play nice and yield if necessary */ + if (need_resched() || spin_needbreak(&cgroup_rstat_lock)) { spin_unlock_irq(&cgroup_rstat_lock); if (!cond_resched()) cpu_relax(); @@ -236,25 +235,10 @@ __bpf_kfunc void cgroup_rstat_flush(struct cgroup *cgrp) might_sleep(); spin_lock_irq(&cgroup_rstat_lock); - cgroup_rstat_flush_locked(cgrp, true); + cgroup_rstat_flush_locked(cgrp); spin_unlock_irq(&cgroup_rstat_lock); } -/** - * cgroup_rstat_flush_atomic- atomic version of cgroup_rstat_flush() - * @cgrp: target cgroup - * - * This function can be called from any context. - */ -void cgroup_rstat_flush_atomic(struct cgroup *cgrp) -{ - unsigned long flags; - - spin_lock_irqsave(&cgroup_rstat_lock, flags); - cgroup_rstat_flush_locked(cgrp, false); - spin_unlock_irqrestore(&cgroup_rstat_lock, flags); -} - /** * cgroup_rstat_flush_hold - flush stats in @cgrp's subtree and hold * @cgrp: target cgroup @@ -269,7 +253,7 @@ void cgroup_rstat_flush_hold(struct cgroup *cgrp) { might_sleep(); spin_lock_irq(&cgroup_rstat_lock); - cgroup_rstat_flush_locked(cgrp, true); + cgroup_rstat_flush_locked(cgrp); } /**