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 X-Spam-Level: X-Spam-Status: No, score=-2.4 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B744AC83000 for ; Tue, 28 Apr 2020 14:07:03 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 77B672072A for ; Tue, 28 Apr 2020 14:07:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Cqvf7PgM" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 77B672072A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 20CFE8E0006; Tue, 28 Apr 2020 10:07:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1964A8E0001; Tue, 28 Apr 2020 10:07:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 085578E0006; Tue, 28 Apr 2020 10:07:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0018.hostedemail.com [216.40.44.18]) by kanga.kvack.org (Postfix) with ESMTP id DEA1D8E0001 for ; Tue, 28 Apr 2020 10:07:02 -0400 (EDT) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 934A6180AE816 for ; Tue, 28 Apr 2020 14:07:02 +0000 (UTC) X-FDA: 76757440284.25.end56_77a96d6928b47 X-HE-Tag: end56_77a96d6928b47 X-Filterd-Recvd-Size: 3696 Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by imf14.hostedemail.com (Postfix) with ESMTP for ; Tue, 28 Apr 2020 14:07:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588082821; 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=EalMZto1mc2jYDESRAloX1UBpj60CFWLwUGGzQdq+d4=; b=Cqvf7PgM9Sx0kBAqxrqGZhwTJph1/KXXlayRiBpQgh6js4qLELNRtIjH78cZ/WrZ6ZBtJZ HyLpg2ej849lQt56znB/C0L47dTeQNsdKXd0jYuIjMUs66gppmzJ6RlE68aykknhb3zjr9 GJT6myKMqYeUG/dcuSD426lUTctjxrQ= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-503-sUfjVckgPIqi01aWVs2SQw-1; Tue, 28 Apr 2020 10:06:57 -0400 X-MC-Unique: sUfjVckgPIqi01aWVs2SQw-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 55CFD1899522; Tue, 28 Apr 2020 14:06:55 +0000 (UTC) Received: from llong.remote.csb (ovpn-118-148.rdu2.redhat.com [10.10.118.148]) by smtp.corp.redhat.com (Postfix) with ESMTP id 50B1819C58; Tue, 28 Apr 2020 14:06:49 +0000 (UTC) Subject: Re: [PATCH v2 4/4] mm/slub: Fix sysfs shrink circular locking dependency To: Qian Cai Cc: Andrew Morton , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Johannes Weiner , Michal Hocko , Vladimir Davydov , linux-mm@kvack.org, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, Juri Lelli References: <28BB8A1C-CFDF-4F5A-8686-537C3CE04818@lca.pw> From: Waiman Long Organization: Red Hat Message-ID: <56327de0-fa44-d5f3-2409-69cf2b97a209@redhat.com> Date: Tue, 28 Apr 2020 10:06:49 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: <28BB8A1C-CFDF-4F5A-8686-537C3CE04818@lca.pw> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Content-Transfer-Encoding: quoted-printable 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 4/27/20 10:11 PM, Qian Cai wrote: > >> On Apr 27, 2020, at 9:39 PM, Waiman Long wrote: >> >> The sequence that was prevented by this patch is "kn->count --> mem_ho= tplug_lock.rwsem". This sequence isn't directly in the splat. Once this l= ink is broken, the 3-lock circular loop cannot be formed. Maybe I should = modify the commit log to make this point more clear. > I don=E2=80=99t know what you are talking about. Once trylock succeed o= nce, you will have kn->count =E2=80=94> cpu/memory_hotplug_lock. > Trylock is handled differently from lockdep's perspective as trylock can=20 failed. When trylock succeeds, the critical section is executed. As long=20 as it doesn't try to acquire another lock in the circular chain, the=20 execution will finish at some point and release the lock. On the other=20 hand, if another task has already held all those locks, the trylock will=20 fail and held locks should be released. Again, no deadlock will happen. Regards, Longman