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 CF849C4332F for ; Wed, 14 Dec 2022 01:59:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1E9458E0003; Tue, 13 Dec 2022 20:59:51 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1995C8E0002; Tue, 13 Dec 2022 20:59:51 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 088B78E0003; Tue, 13 Dec 2022 20:59:51 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id EEB4E8E0002 for ; Tue, 13 Dec 2022 20:59:50 -0500 (EST) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id C30B5406BE for ; Wed, 14 Dec 2022 01:59:50 +0000 (UTC) X-FDA: 80239255740.07.144AF10 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf16.hostedemail.com (Postfix) with ESMTP id DD690180003 for ; Wed, 14 Dec 2022 01:59:48 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=VXjdG25o; spf=pass (imf16.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=1670983189; 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=w8Ekv64Hnz3Pzaf7wbnhuAkFb+qhBlnUSB0ADt/wreE=; b=LJ9ly/tyRzD35wwyV+G3RUDrfvwP8uD1xdafauZrxhy4RhQ7H55lUfIQn46PDJhiKAtfb6 ND16b9Gw3yK9RLgFbXE4GwV6EujnmohadApQcGvTgcTWKUwXL2L1SaDTBuaw4TrTEeipYu 6y2LdbckkboZ/aa3HeLGIe11yWSDulw= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=VXjdG25o; spf=pass (imf16.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=1670983189; a=rsa-sha256; cv=none; b=hHW1nfmW79N+fEVX/nTOUAOjyCnGv+Vb0T9NLHEYf4dki6gVQFTqCWY5je9uANzs+iIwkP MW/Sqf+167m1QgtaLP1gl89TjL49KQPEYUaf7PqHnEf+eUkPAr3ohZmfofzD5EBN71RH60 vYYz9dIRUMRPqGJLUBX8oa6qqkydnJA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1670983188; 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=w8Ekv64Hnz3Pzaf7wbnhuAkFb+qhBlnUSB0ADt/wreE=; b=VXjdG25oGaLeCxF89nbyBhI6NoEqSYCsCwQ7xM4GiA56f6SVSJ3kWjJs7rOtcsyWl6ggug LimDjYJgR4HTlRq+bo937SkTGN2hvko8jP1bDtmIi7Ol2AoQAxgmlKkKL8wAGnp9tmF7dr sVhsdJriAJgJv7/xSxeB2QWO+qhUlak= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-251-ilEFFrkzO3qCiPUOWk815g-1; Tue, 13 Dec 2022 20:58:57 -0500 X-MC-Unique: ilEFFrkzO3qCiPUOWk815g-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2AF94185A78F; Wed, 14 Dec 2022 01:58:57 +0000 (UTC) Received: from [10.22.32.205] (unknown [10.22.32.205]) by smtp.corp.redhat.com (Postfix) with ESMTP id 15AE02026D68; Wed, 14 Dec 2022 01:58:56 +0000 (UTC) Message-ID: <72fa1665-966a-76e6-be0c-e7fb288b1610@redhat.com> Date: Tue, 13 Dec 2022 20:58:53 -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 v3 2/2] blk-cgroup: Flush stats at blkgs destruction path Content-Language: en-US To: Tejun Heo Cc: Jens Axboe , 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, =?UTF-8?Q?Michal_Koutn=c3=bd?= , "Dennis Zhou (Facebook)" References: <20221213184446.50181-1-longman@redhat.com> <20221213184446.50181-3-longman@redhat.com> From: Waiman Long In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: DD690180003 X-Stat-Signature: o57hmyyrjxzxfoxsaq1q86bnioswnzd1 X-HE-Tag: 1670983188-865187 X-HE-Meta: U2FsdGVkX1+FJG68iysm39a6AUSe2CVbuRrSdHGff1IhgAuiq2PJOmu090MTJL7lqMcGrMdDwjozCvMCH/Jf5FHe4chVAhvsIa89mfGVzUGYtoWpRcSYPTFHn/GgCd000sIAseFDDYLCGzz3WyohvfCiHMqVkHvYHlk++O3y4xOiqH7w392ClT6c9fZ9Iu99duOn1mh5ptzWgiKAdAnY2PH9TqqXhnHo1qXcogT2QXZSwlWj5/ftDfvuJlCZsOaaMdzt+8Ngh1zWNjweClE3ogqFgZEzQoSoNZCsf3h5pzGB4yRXp6Uqdtm590MAo7yARM+tRWhDEWxrkJdMNZTUNCqQ8ISP7Ai1sghL837zO/OWhJaeQeemY1IBS3akadtQjUK/qtql7ZUlo1HGPnHoPA1K6cZ0jTHpWuJh3dcp9udOwnb8DAt/B44eEqT9KWp1okfy0U+RgniW4oMQisTxrVsMo4JFdd7N8O35wP8xVrF7w7VbCAFh3rkSct1grWzk0JzlXHgXnQSIffZypUmA4ob/rzH1K2zM1szwRlyQjuOuoXBOEphKDo0UTUz0eRvAtKn4/Ioc3IptdZrNbnNvLWE4fgp0C1w/IwXviofX45PvYapKv97zaN2pI0UdrNSOg+PVoFrSRsSYUeNCEApbmv0lj0vmGdmwnjJBGcSYd6sPhJE+TbVueuoFgJqXeoQe9AnTDLgwfv+BBdp2ei7aZWAOx716XY9Y4GH2CcZCpSKoK6X+jh1tMbvZJUz82A/PY9ZAPfzLwVuruNrZF6Bm7qfFd/1Ozl1pAWbZ3eqERSDEl1GEUTLvuSAHOJDFcwKkn/YDPbrWn8BNslRZ5PMPhk4Zzz7ysJ4a5K5+gLHZciBh1HqFbuo/ZlJMydTkZAp3 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/13/22 14:30, Tejun Heo wrote: > On Tue, Dec 13, 2022 at 01:44:46PM -0500, Waiman Long wrote: >> + /* >> + * Flush all the non-empty percpu lockless lists so as to release >> + * the blkg references held by those lists which, in turn, may >> + * allow the blkgs to be freed and release their references to >> + * blkcg speeding up its freeing. >> + */ > Can you mention the possible deadlock explicitly? This sounds more like an > optimization. I am mostly thinking about the optimization aspect. Yes, deadlock in the sense that both blkgs and blkcg remained offline but not freed is possible because of the references hold in those lockless list. It is a problem if blkcg is the only controller in a cgroup. For cgroup that has both the blkcg and memory controllers, it shouldn't be a problem as the cgroup_rstat_flush() call in the release of memory cgroup will clear up blkcg too. Right, I will update the comment to mention that. Cheers, Longman