Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp5134684rwl; Mon, 3 Apr 2023 15:06:18 -0700 (PDT) X-Google-Smtp-Source: AKy350bK8lp54tJqmYFSjxzcnWg41pf2RjLTHg2ughvvvi3/LHr+iDfYsbTuNbtCEKc5r4LjV4ON X-Received: by 2002:a17:902:e294:b0:1a2:4839:596c with SMTP id o20-20020a170902e29400b001a24839596cmr509236plc.9.1680559577867; Mon, 03 Apr 2023 15:06:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680559577; cv=none; d=google.com; s=arc-20160816; b=dhnBAJz4HzfBuQEuLlcDRHDIPDAEimjL96m+WMt3PyaZK4ep9fkxZhJ7EyIiC6iaNj uMhP17iImuCuWtYA0NekHNA//1nVb7xGFhQn4fafA7R16gkwVlctxsFZrljm7kHu+BI5 dkxdI6HbpkN+q7rByWg5VtplkVy3hzwOPAbpxah/QWkZ/VoY2Twh3kp50ENFxWQJfME/ hFXSe7gKOk3mXPWuJUZNLfOUXnr03hmvURzN3bChvl+WGTjJnnTefafNH+rY1xdQQxyv ISUQY+G1mmD/LrXdgVIEsmyXwVS09u4z1/fP+cP7jN9rtInncdWjy5KtQYdYVHbPlu01 LILA== 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=QacupsFZGNVPJSGTJC6YypXeluEyL82tnZkM1VlhIdc=; b=Xw39V96zrYMyPkmssvPrvCmFQudfuwjH3ex0kjkmz1VDbME7U1/83FT/otUUrEl0cs xQxgFc4Ux9EmBtsctKY+VYznsW/WtkJFd3ZGYHt4EH7CydAaMtYKF+yA23QKwRetGzNf 26hyUa+KmFQjx5L3viBL6fomnaVcwHjT6bBrH4f9ag0AfgQJO8pw3VDKgw7l9IX1ZkYR iH0Ac/dXiVMx4VkjToqF+OXWJqkkcQw/8FJvt7oltxKq543Z6hDa5gWlUg+xuEZf0x1Q LzNyjszyCIef0jQr7nmci2+vg6SQElaig+AyAD5TvnH+5GIgiOKWhRPt/+L4sr5ABEUH 1Xpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=kWaOfIm3; 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 w7-20020a170902a70700b0019e87f429d7si8433183plq.376.2023.04.03.15.06.06; Mon, 03 Apr 2023 15:06:17 -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=kWaOfIm3; 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 S233472AbjDCWEP (ORCPT + 99 others); Mon, 3 Apr 2023 18:04:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233710AbjDCWEG (ORCPT ); Mon, 3 Apr 2023 18:04:06 -0400 Received: from mail-pl1-x649.google.com (mail-pl1-x649.google.com [IPv6:2607:f8b0:4864:20::649]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26D704C38 for ; Mon, 3 Apr 2023 15:03:49 -0700 (PDT) Received: by mail-pl1-x649.google.com with SMTP id kp6-20020a170903280600b001a2945a7fdeso7307272plb.18 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=N/1EeCqEP8sAxMV3gidKJXraGnARu385DVHj1FqTMasW+20kDigaVYyubyR9Wvc+Nc 3WU+5YVucuoeuBuJOgse68ZSoX0Y3D+pjvJDncLdUGYV4VNSqCNqAtSNpN5j/4SSyjev Yl96WO+ikhZNmNbKXDUh3fAiTFqDg4kYnRZxOb+l0wKme8ZFuOm3bEkCzTHJW8SGEauS +sR0NeeXAposWkROnVbm/Od6l+FP8E1brYXCMk6i/BggtKcwkL41BL+ClIb/YVBy73DZ m+c2sL6KvUDd2GDRqI3ROEP2zI0Snngv1d59KbDmJxh/jZChHRfkVXgElpDSMEjs0Sgl AsYA== X-Gm-Message-State: AAQBX9fZxoq+Qyr7Q88pFcwoRwcFAjY2QIZT36WrNltemL+QtXER3TMh XvfXEQd77UW0sD/hkukGUxMZGcxh9ABQ1YT/ 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 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 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); } /** -- 2.40.0.348.gf938b09366-goog