From patchwork Mon Apr 3 22:03:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yosry Ahmed X-Patchwork-Id: 13198876 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 AAC40C77B62 for ; Mon, 3 Apr 2023 22:03:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CB5EC900002; Mon, 3 Apr 2023 18:03:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C15AD280002; Mon, 3 Apr 2023 18:03:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A655F900006; Mon, 3 Apr 2023 18:03:51 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 96128900002 for ; Mon, 3 Apr 2023 18:03:51 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 6CBE5140BA9 for ; Mon, 3 Apr 2023 22:03:51 +0000 (UTC) X-FDA: 80641457862.01.14DFFB1 Received: from mail-pl1-f202.google.com (mail-pl1-f202.google.com [209.85.214.202]) by imf08.hostedemail.com (Postfix) with ESMTP id AFA47160008 for ; Mon, 3 Apr 2023 22:03:49 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=kWaOfIm3; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf08.hostedemail.com: domain of 3RE0rZAoKCLMrhlkrTafXWZhhZeX.Vhfebgnq-ffdoTVd.hkZ@flex--yosryahmed.bounces.google.com designates 209.85.214.202 as permitted sender) smtp.mailfrom=3RE0rZAoKCLMrhlkrTafXWZhhZeX.Vhfebgnq-ffdoTVd.hkZ@flex--yosryahmed.bounces.google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1680559429; 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=QacupsFZGNVPJSGTJC6YypXeluEyL82tnZkM1VlhIdc=; b=JB6D07oCaARr/5FBPL1xGb0KAg5TmwXQwJIn2d0haN49U6hFPjQj0VgxetN/jWc2cs1eZb t5UzAx+YLbkYwEl7YPDhJ4Hx2hForda3Dtv7dZZrUX6GYNtelE34qlctO9VZxGAom0w+7k Ea4mKeyGGngp/sBqahuTSvRyksJJSo0= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=kWaOfIm3; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf08.hostedemail.com: domain of 3RE0rZAoKCLMrhlkrTafXWZhhZeX.Vhfebgnq-ffdoTVd.hkZ@flex--yosryahmed.bounces.google.com designates 209.85.214.202 as permitted sender) smtp.mailfrom=3RE0rZAoKCLMrhlkrTafXWZhhZeX.Vhfebgnq-ffdoTVd.hkZ@flex--yosryahmed.bounces.google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1680559429; a=rsa-sha256; cv=none; b=7zUKHmI0vwQqDcr0r4frJVaUP4VcHJmvIYkymlX0gMsxzNfOhEzpJw0bi/iMBKGgG/kHMR gnaXGiaDsEVon/DYdNeWAAOD1EDaVRr6xKzRjjR/8JknGLsipOLrnDGhZ/GE+P+Cr4E+g0 kip1BnaGye/VZWfi9CjD0+Ij4C/wtDk= Received: by mail-pl1-f202.google.com with SMTP id z16-20020a170902d55000b001a06f9b5e31so18544429plf.21 for ; Mon, 03 Apr 2023 15:03:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; t=1680559428; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=QacupsFZGNVPJSGTJC6YypXeluEyL82tnZkM1VlhIdc=; b=kWaOfIm3ix3CjQ6P0LRgdpWoqBgJu3ykmdsz32NiUF8x9A1dmCU0K7B4JSzYOReEDZ FYgPQlT3SuWLrHKrP3wDopLbn9eVfq4lg7l4naylQ8tTZgKaGOhXPPjrkCrnIEo3mSYz lk/IOCkztnHJOg8hCDeaYralpjItb0pP1L9kf7xz8p5kouBsn/T4mHo837Hsw6EVM4fX wXifin0wFGMZCFLJ9fRpD2UTXhFCMfIx9NWguUNma600XyrmJZUcuoS1IkX3lwn5WJbF /q9yx8rYhgQBtZhs0hPFucZM0Rd23Z/nGcnjDiwXILvEaD94FJtXEZgMXINCRE/Es3tO KyGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680559428; 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=QacupsFZGNVPJSGTJC6YypXeluEyL82tnZkM1VlhIdc=; b=HoZ7/M/HR6ZsVaFIGAodT5TUW8A17rSjA9TaGlychbey3PpC/qBapt6oVVq9ZCyAkS GMdFKrh/2zmNJGirSjpngGUcMLU7HAwuruep1eyc1HQexA9hQjCeHQT9fJvQL1GJlF2t gSexCjwkS56QABN0tRZJN6TIneFlHazQhMgo+qOoVxlsHYLtWKFX4uWNin5Hf5B7/Z9a tydVkS3u2nCiTAHPmyGflX63OXc9EIo6ZgQBmsdXmsF3FogfPhIGgCcfOIFAfpFKnZX8 Bz7HqQLz0yy8i/TjXS250Agp4gntB3CpeX6Bp4dJbxQyO+7fEMmd4mKcBH/tFJYIxJQh mgeQ== X-Gm-Message-State: AAQBX9dXbe0AQ9LRvnOd97po5QAT64eZmYcCfkjyIfHDpi5pYAdLJWRp exGiRTHGIZAavJgc9nvWNogd5l4t6EyPjPua X-Google-Smtp-Source: AKy350bOmcX4bhvMcYbhTSAl8lBQ2O0deW3xZkttmpHKSB+VEjNEWJFCZZnxKvEdtC6SV8VkwoJDDIrEQNByEpas X-Received: from yosry.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:2327]) (user=yosryahmed job=sendgmr) by 2002:a63:485d:0:b0:4f2:8281:8afb with SMTP id x29-20020a63485d000000b004f282818afbmr35913pgk.4.1680559428241; Mon, 03 Apr 2023 15:03:48 -0700 (PDT) Date: Mon, 3 Apr 2023 22:03:37 +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-6-yosryahmed@google.com> Subject: [PATCH mm-unstable RFC 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 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: rspam02 X-Rspamd-Queue-Id: AFA47160008 X-Stat-Signature: bducpd4cg3jc9bbj9uqjx3539of55ojy X-HE-Tag: 1680559429-611009 X-HE-Meta: U2FsdGVkX1/Y6p2HjCCrx+k2pHyp6zI86Bej+rAHX6qGFP8nMRcp0wtoT9YLtyEG6NmRPqdEKZgB1+30kJNkTJ0eolufiKrXAOLdo1OPvqUj//+3TJfqcsaAeJ2sfm1ncVl7niF+77dp67pUkg5gVrbIC2WyRXrb0IJYAQCvk1He1uS/3E6uIV1zpInkV5QYMk1PZeXHRrK33ZsBYzzv4Vrn/YM+BJOo1rqILwryMqmUetHFfPCyF+DDPA8Tbkk3sGSWQZebEqYGQ2TrmP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2OtGujeDj6tJCQh5YWU8NA/Rb8HJNu2kFrbSsb1CcOjECIYO3vLfspU6xObDp/PJCTy3ff3WgtsSlKP9EvqFiJ7kTfQE4ggn8PMmgQ+OeAQGujekDp10SeyPlkLOWgV1fIQPqiPtnxK29zd4d7r1IwewRiBXJZ9itHG6t6SrYQ2G4bjI0O7R5EVDl8YmqDGV5AIuxxs5uWCb2l5BPhQ+3Qx65nAMSqgHjeRw5w2AAH7BgnkQTQEjxhq7aZKhSffbXwsE5+eNAR0m1Cr96GYvHH5VN43G/hCCBpw24oM0KlwrLHLXtAuT4jGUmeDYLVoOKqyCzXe5bol5/2cxi6yZ2/FjIu5Icos= 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 --- 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 885f5395fcd04..567c547cf371f 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 d3252b0416b69..f9ad33f117c82 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); } /**