Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2202412iof; Tue, 7 Jun 2022 23:04:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxTCeFMeK/MgGVppMK2A1I8Q4uFyBKD12cgIx9mdaGQIU680Kvfvl53A8T7T0NAAFGslHzR X-Received: by 2002:a17:902:f688:b0:163:ee37:91c5 with SMTP id l8-20020a170902f68800b00163ee3791c5mr33405411plg.86.1654668296812; Tue, 07 Jun 2022 23:04:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654668296; cv=none; d=google.com; s=arc-20160816; b=uZkwP84vfaFOdYoUCz2H4MS/Pv3hD0woM6ZnOirA4/Q1iKzvV86YSyN/pMu6ByQYPm NXExBFb2ZJ1hd+ZcSYJ1UV8kUbUVsppSUd7kSUxjp0gPfhkoFwnm3NYT52R81Zmxen5C IVdDDnZdfjO7tG+/VrUuDacyPgQzYciNmMEUBsZZMQhjZYMOb9BXiuGvcIeKiliXmQ9t yoFo4Yr1tyPbeNoRFdh98kO47jSghwi25XSvo3MT4UzEZbHmnu8OGbcMWNqMA3QLq1hy DarcUFu0AG4RxkXZIBAYqmdHjk5o5YplP+4eCdJLawRinnpQb0TCVpki4Lns4ZQ0tHck jfRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=bKgNJdV4VB9iqgNp3YPWxIaw/cz2EfSPlT7w0FFt0CM=; b=iWT8rbpq/CRsx7OlysGO2AoIdgMvBKV4dcxp9Y5I+oGySQn7VHKfij6044EpWCxcR7 Cd6kHZ2pzettJAfMQaTxzbOl07EMkDxzA5J/vtvihm3isroFtOrmIVu4UnvoY4CufJdB ddU1A8KXZzRN51polbmC+o98f9kFDmGyfNQnUWtiVLXG3wpvuBcifyZeiPXV/n3jNOED LeK1swq5VvRsuyM324LTGU250mMggyqTc0U40Rd+ibaIOIsVIUlG4JqzYctU1vr9BHN/ q4VW4qewIPz3RmJx7wvGKRJsANc0AsLmVKRcp2hV3I4cBeCFSHXBmF/hLZw38NXZtMyx NoAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xxrvjCEf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id bb22-20020a17090b009600b001dc54892bcbsi23919726pjb.147.2022.06.07.23.04.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 23:04:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xxrvjCEf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 87E75439185; Tue, 7 Jun 2022 22:33:42 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382421AbiFHBkw (ORCPT + 99 others); Tue, 7 Jun 2022 21:40:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1383959AbiFGWMP (ORCPT ); Tue, 7 Jun 2022 18:12:15 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23C6225A827; Tue, 7 Jun 2022 12:19:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A2D5D61956; Tue, 7 Jun 2022 19:19:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B444CC385A2; Tue, 7 Jun 2022 19:19:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654629552; bh=7z/LJZ+JUfk/CoOc11G3rJSu0+44RrtrKYssjymRpGI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xxrvjCEfky61S5wGXrSFy/zuNQHnzuMKkClXDg5ypuBnJDxI4d+1xPARz8SCExzt4 P7srWfX+sPW1Lu0YDBx1ARLtuZax6AJ67NbT4KkaRDLM8AiBnJf333o7zKv/OzxtIB JwGQF8S/d5UlkTQlAZRcrqhhj9oV4j5c+ACWgxMc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "yukuai (C)" , Jan Kara , Christoph Hellwig , Jens Axboe Subject: [PATCH 5.18 733/879] bfq: Track whether bfq_group is still online Date: Tue, 7 Jun 2022 19:04:11 +0200 Message-Id: <20220607165024.133157498@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE 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 From: Jan Kara commit 09f871868080c33992cd6a9b72a5ca49582578fa upstream. Track whether bfq_group is still online. We cannot rely on blkcg_gq->online because that gets cleared only after all policies are offlined and we need something that gets updated already under bfqd->lock when we are cleaning up our bfq_group to be able to guarantee that when we see online bfq_group, it will stay online while we are holding bfqd->lock lock. CC: stable@vger.kernel.org Tested-by: "yukuai (C)" Signed-off-by: Jan Kara Reviewed-by: Christoph Hellwig Link: https://lore.kernel.org/r/20220401102752.8599-7-jack@suse.cz Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- block/bfq-cgroup.c | 3 ++- block/bfq-iosched.h | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) --- a/block/bfq-cgroup.c +++ b/block/bfq-cgroup.c @@ -557,6 +557,7 @@ static void bfq_pd_init(struct blkg_poli */ bfqg->bfqd = bfqd; bfqg->active_entities = 0; + bfqg->online = true; bfqg->rq_pos_tree = RB_ROOT; } @@ -603,7 +604,6 @@ struct bfq_group *bfq_find_set_group(str struct bfq_entity *entity; bfqg = bfq_lookup_bfqg(bfqd, blkcg); - if (unlikely(!bfqg)) return NULL; @@ -979,6 +979,7 @@ static void bfq_pd_offline(struct blkg_p put_async_queues: bfq_put_async_queues(bfqd, bfqg); + bfqg->online = false; spin_unlock_irqrestore(&bfqd->lock, flags); /* --- a/block/bfq-iosched.h +++ b/block/bfq-iosched.h @@ -929,6 +929,8 @@ struct bfq_group { /* reference counter (see comments in bfq_bic_update_cgroup) */ int ref; + /* Is bfq_group still online? */ + bool online; struct bfq_entity entity; struct bfq_sched_data sched_data;