Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp4186056ybz; Tue, 28 Apr 2020 07:10:25 -0700 (PDT) X-Google-Smtp-Source: APiQypKxjWKn4/LIwphf6lzZKW2WBQ8AvoYf94tbtQOy0iBhoH+svK0Sw33x8eaTcrENaHsTfAyd X-Received: by 2002:a17:906:704c:: with SMTP id r12mr24311994ejj.105.1588083025683; Tue, 28 Apr 2020 07:10:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588083025; cv=none; d=google.com; s=arc-20160816; b=p3ZEPzDwTMsUnIFagsBfv8GSCF3KDcJS8TfzS0pDkCaVIo6KIgYYTN8M4jOD7o23pU wXelNJj4JyxseNM3zFs2RxXXBMmB1MXs9i4AvJ/jthScBsmCIL2dVtL5P1+a6ZOBIaQR wV49Dm5m1F5ix9EyGUZZzVBol1q+xXjUPRnarv69638ebCtt28lMrolryZnqCbx5xI+b DdIix1nVcsBy7q2QIPTGvz6RsS+M7miZXHP6IUXLs5uEQo1LYbEqiM1+ZA/zxOQ2qrmP P/ofzA+C6uIGBUsrPYiiGXbah3kLedWFisSslgWtoqhbea/niTJJWIj1kXITRlXXNwu5 Da6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject :dkim-signature; bh=EalMZto1mc2jYDESRAloX1UBpj60CFWLwUGGzQdq+d4=; b=QANEIEoRjppRMOIRn0A0/Ek7ATY3WUJ+qu0cp3HuilA042w0Sh8pIfMxc76jxRCvW7 tmRYRveeSZMePaL6+H2Zu8nENvtVIOmMeR0xrLkFdkgDjmcmbn3ankcmsTdDiqKmWKoO MwG+GnIkMUvabCwJiwr4YeR263wmMZz8yAfufIPzSP+YGmU6YIpdD18L2wpmcxzWgN/0 NKmku5Ko61sI7OcAfEDYInhJNqsOE5L/8tAlKFr77RpHwwyK14XrIkluSKgjk468sr2n ugmto4v3KQk+AyZhiWAKgu0E4a8EVQ4XgajQplQRjctn3t7vMCOkQT1mrno+EkIJakdD OWsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Cqvf7PgM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e17si1861861edr.16.2020.04.28.07.09.53; Tue, 28 Apr 2020 07:10:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Cqvf7PgM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1728015AbgD1OHE (ORCPT + 99 others); Tue, 28 Apr 2020 10:07:04 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:46484 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727891AbgD1OHC (ORCPT ); Tue, 28 Apr 2020 10:07:02 -0400 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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