From mboxrd@z Thu Jan 1 00:00:00 1970 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 C902FC4332F for ; Mon, 12 Dec 2022 14:58:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1F73A8E0003; Mon, 12 Dec 2022 09:58:36 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 181928E0002; Mon, 12 Dec 2022 09:58:36 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EEDA98E0003; Mon, 12 Dec 2022 09:58:35 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id D9B298E0002 for ; Mon, 12 Dec 2022 09:58:35 -0500 (EST) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id A249740A3F for ; Mon, 12 Dec 2022 14:58:35 +0000 (UTC) X-FDA: 80233960590.26.B551B4B Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf26.hostedemail.com (Postfix) with ESMTP id 49832140007 for ; Mon, 12 Dec 2022 14:58:33 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=PoxhFC8B; spf=pass (imf26.hostedemail.com: domain of longman@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=longman@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1670857114; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=GkbQCXweWiVyxQliOP1BrMo+NMG+D0texQS/7HCzGIk=; b=14mG3Ua0GZvuDWfOASqzzAdQTKVViHB3JHGBfZrWXFmPCKp9a+wR8pP+2qxCA+wHqUZcgf lPDyMeCrt7IYmYnm8+mwxqZik+pMMeQqkXPV4CzJxMj/xd/mJv9MB7AviMKB4VZ3PuI9qr k6qwdsd0LqHvDOB8AvrnAF4DfJhlut8= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=PoxhFC8B; spf=pass (imf26.hostedemail.com: domain of longman@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=longman@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1670857114; a=rsa-sha256; cv=none; b=CkRRkgZhdXlqcRudB4fEXJlNOZkwVFGiQYtieC7HedpDcotYP3s8mmR1E7ZYJANIhYp9p6 9RB7h3gJlWXw5FJthcMMKXemKxwTS9ngMUojy69BPLVJalgJ5jD/RWK18W9TPdnm1g3vFq 5KANrQjWpqW0aH2htsbdaUnm0uK626g= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1670857112; 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=PoxhFC8BeKJue55vmdB9kUsodDJnzFnHpuyHrMcrP8kg5quN3E2K0+TjeK9M+ibQSrXuQn 0qXN0DjUXW/CiG3UCNWDEJnuLlr7sjRpaebepnxwU/FYticzy5vjViwO8cmqadqIdRcVpB WrzZHygXCnnjLayeZ6FEGWomQ6Lh00k= 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-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 49832140007 X-Stat-Signature: bigp7pur6h5ids3be1oc5dfqnt9to636 X-HE-Tag: 1670857113-981025 X-HE-Meta: U2FsdGVkX1/r3k6YDwdW2pAtg0UnLZ/v6xc7/91NTuGa4ZsJJq1njYHgzWxBE+f4Q+cVBGRFmY0IwJifsyHc/B7TSXEUi1hk2Ybqgx1nX/2lw6/DZz9mCmJ8oOa/omhBy4nbHqTGBsNQZnyURUa0FEQOyI0+2fQFOi3i6A2T5L+QoS3CzFIM+8INIVlLYwXlf27VaB2o/vbSyedLNCZE1CbvpYCjn/YJy1Kolp6veZS35gdiEM/45MPu15FThnppV22cmJ+t+Od6O6b7dUQebieUuBtnL8nfPtOMIdRdLMlUwzlYmh/kQO9jmX8UISzX0GXq+vBcALZlXdSEx4xR4xcR6/UOIUUHnAK2QjUtAcaowGWd/6pCBQuKLlIocSRBf4fFVXB1ZvyrbySbswLMxD7UEZdALaDSkeRVcZisXc686gIenciSS1bLQK0M1HCf9lZvD7YrhctN38mXAwzw6Sccof38iyFsgJs92p7/ufOSRWcOdgqVSqdE8x4JEGwOYTvi25CBXKOPNWM/CxkD/U6UQf5KwYFJANaweWtku6Tjig0fLjiSNUOAACmnXM7MXr48fzQW4lZyOPP/yKirBIkrs282MzKvQbe84n+ER0J7s/Tm7nZNB9zHr8op6u4rQcGFgYuTghTTyPwxnUKN4JWJYpRCr63TPe7soz6uIba3zQCfYXe7rykBNx4fRgiCYYSZoBkS42V9CzDPeZ+Rvn5YiBgwnBKcdPOaNXkJYbQVMobADePjvzyWLPoWLZaNV4i9a+jj1NY9Yo69Be4PTJGDz4xBpnaBlPsheTxHahQ/+8/ezQaKv3ozuuWf6i+has048A+Q4xbRehbxjeFI6Tc2j76EHC6K2A4iIfK4dGOFzp1uDc/i+onUewd7Hb5c 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: 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