Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754206AbdIFM4o (ORCPT ); Wed, 6 Sep 2017 08:56:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57684 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753484AbdIFM4m (ORCPT ); Wed, 6 Sep 2017 08:56:42 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com A4D0FC057F93 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=longman@redhat.com Subject: Re: [PATCH] cgroup/cpuset: remove circular dependency deadlock To: Prateek Sood , tj@kernel.org, lizefan@huawei.com, cgroups@vger.kernel.org, mingo@kernel.org Cc: linux-kernel@vger.kernel.org, sramana@codeaurora.org References: <1504698535-8187-1-git-send-email-prsood@codeaurora.org> From: Waiman Long Organization: Red Hat Message-ID: <3992b0d5-947c-e343-5c07-8da43af5646d@redhat.com> Date: Wed, 6 Sep 2017 08:56:41 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 In-Reply-To: <1504698535-8187-1-git-send-email-prsood@codeaurora.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 06 Sep 2017 12:56:42 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1126 Lines: 33 On 09/06/2017 07:48 AM, Prateek Sood wrote: > Remove circular dependency deadlock in a scenario where hotplug of CPU is > being done while there is updation in cgroup and cpuset triggered from > userspace. > > Example scenario: > kworker/0:0 => kthreadd => init:729 => init:1 => kworker/0:0 > > kworker/0:0 - lock(cpuhotplug.mutex) [held] > flush(work) [no high prio workqueue available on CPU] > wait_for_completion() > > kthreadd - percpu_down_read(cgroup_threadgroup_rwsem) [waiting] > > init:729 - percpu_down_write(cgroup_threadgroup_rwsem) [held] > lock(cpuset_mutex) [waiting] > > init:1 - lock(cpuset_mutex) [held] > lock(cpuhotplug.mutex) [waiting] > > Eliminate this dependecy by reordering locking of cpuset_mutex > and cpuhotplug.mutex in following order > 1. Acquire cpuhotplug.mutex > 2. Acquire cpuset_mutex > > Signed-off-by: Prateek Sood Is this patch for the latest upstream kernel or 4.4? There is no cpuhotplug.mutex anymore in upstream kernel. It is a per-cpu rwsem cpu_hotplug_lock. Cheers, Longman