Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp6868699rwb; Mon, 12 Dec 2022 07:22:08 -0800 (PST) X-Google-Smtp-Source: AA0mqf5KLqk1OvPlust8007oMdmoVfNc07Zr6Sj8SekyukLBjwHpZGQnJc497NrTege6b6iJyV3d X-Received: by 2002:a17:90b:396:b0:219:1509:fb14 with SMTP id ga22-20020a17090b039600b002191509fb14mr17088389pjb.33.1670858527944; Mon, 12 Dec 2022 07:22:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670858527; cv=none; d=google.com; s=arc-20160816; b=nozsxVLGXNEaoG1cILa8YHg2BHzjV2mqdt9eMFIsoJgM33HwLYg+fbTBMpdpQ39BDQ e1U76cpacY/0LbTfcnHBdwvs3I4lRmU7MJFpw6/S9hWcyC++zu7Z9p/3sRPsm+agAYb+ jl9O655iZPd6cZUdYaQbe+4Mg6zucvo7BOZ4sPNNsKGKCXg6zVudtQr6Y+47caA7jUrc 7jfgpG3B3tKu8OK8VjqQMIF+jZRzIhaURucAuxwOaJmyP7yB7BOqEZGdEdQ911wmBujG Vy3gRlDj+d6QVt45TA4RKdNQtFIchPB7AtWZMIah2s3O4JBuJdzgSTTHM7K35XXDjBD4 N1GQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=GkbQCXweWiVyxQliOP1BrMo+NMG+D0texQS/7HCzGIk=; b=WAPiOtszFntRw/AnyZzFOFzttA8aa9fV0lPPF70DNfIxOY1Bk1js+pHTblv7TetVLG BB51eLvP9rGT5ywFBjeYqimHP9EGu8xZCo6RDQpOlVz+1slDQkF8ol6HTBhdK8IBHG8u VSuHJBBdp3RrUHpw+2qordFtic+sOKIbcR53g0jYGaMA+28z/HpweJLTf4/YAOGvErxl 5QkdG3jDcnlYA5o6ncxBsKvlEgxUcOdfxLAyCnFFAuCEcKZtg/ID7/+IX/J9NR5oL8JP 0qkLrsVBP86Y1Hx91ubqXhyXQCttbHMcJxA6849pOmhzT8CAoZzMg/BNRgaRRbw9hjR6 fZ4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=iavd982N; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k5-20020a632405000000b00478e15039c0si9586360pgk.779.2022.12.12.07.21.58; Mon, 12 Dec 2022 07:22:07 -0800 (PST) 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=@redhat.com header.s=mimecast20190719 header.b=iavd982N; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232450AbiLLO7e (ORCPT + 74 others); Mon, 12 Dec 2022 09:59:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232238AbiLLO7c (ORCPT ); Mon, 12 Dec 2022 09:59:32 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C1C8DF4A for ; Mon, 12 Dec 2022 06:58:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1670857114; h=from:from: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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GkbQCXweWiVyxQliOP1BrMo+NMG+D0texQS/7HCzGIk=; b=iavd982NdMl66Cwh2YkOfXITq2hmic+9WCUN1ek+7v0r+CEvHbgWFk8pbi+Hfne/QJvRF4 t9Vz6apeOuONkQJ3qKwSsAppE8Xe48VN8aMT/AxZwCcLQe0qcx588tM7rtFsImDm6VDibX 0wkGIS71VL/loLsktQIUAjggtMPLqpc= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-215-7kbTmcn2MbORoJ9Q6BS7PQ-1; Mon, 12 Dec 2022 09:58:30 -0500 X-MC-Unique: 7kbTmcn2MbORoJ9Q6BS7PQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0C3CA29AB409; Mon, 12 Dec 2022 14:58:30 +0000 (UTC) Received: from [10.22.34.84] (unknown [10.22.34.84]) by smtp.corp.redhat.com (Postfix) with ESMTP id 46545C15BAD; Mon, 12 Dec 2022 14:58:29 +0000 (UTC) Message-ID: Date: Mon, 12 Dec 2022 09:58:27 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.0 Subject: Re: [PATCH-block v2 2/3] blk-cgroup: Don't flush a blkg if destroyed Content-Language: en-US To: =?UTF-8?Q?Michal_Koutn=c3=bd?= Cc: Jens Axboe , Tejun Heo , Josef Bacik , Zefan Li , Johannes Weiner , Andrew Morton , cgroups@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, "Dennis Zhou (Facebook)" References: <20221211222058.2946830-1-longman@redhat.com> <20221211222058.2946830-3-longman@redhat.com> <20221212125953.GE16456@blackbody.suse.cz> From: Waiman Long In-Reply-To: <20221212125953.GE16456@blackbody.suse.cz> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE 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 On 12/12/22 07:59, Michal Koutný wrote: > Hello. > > On Sun, Dec 11, 2022 at 05:20:57PM -0500, Waiman Long wrote: >> Before commit 3b8cc6298724 ("blk-cgroup: Optimize blkcg_rstat_flush()"), >> blkg's stats is only flushed if they are online. > I'm not sure I follow -- css_release_work_fn/cgroup_rstat_flush may be > called on an offlined blkcg (offlined!=released). There's no invariant > ensuring offlined blkcg won't be flushed. (There is only current > situation when there is no reader of io data that'd need them flushed > [1].) The original cgroup_rstat_flush() iterates the list of blkg's in the blkg_list. A blkg will be removed from the list when it is offlined. This patch just reverts its behavior to that previous behavior. > >> In addition, the stat flushing of blkgs in blkcg_rstat_flush() >> includes propagating the rstat data to its parent. However, if a blkg >> has been destroyed (offline), the validity of its parent may be >> questionable. > Parents won't be freed (neither offlined) before children (see > css_killed_work_fn). It should be regularly OK to pass data into a > parent of an offlined blkcg. I guess it is likely to be safe to flush an offline blkg. I am just being conservative in case there is any corner case where it may be a problem which I haven't foreseen. > >> For safety, revert back to the old behavior by ignoring offline >> blkg's. > I don't know if this is a good reasoning. If you argue that offlined > children needn't be taken into parent's account, then I think it's more > efficient to exclude the offlined blkcgs from update. (With the caveat I > have in [1].) It is possible that a blkg may be updated before it becomes offline, but the flush isn't done in time before that happens. The next patch will catch some of that. Cheers, Longman