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=-12.9 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1, USER_IN_DEF_DKIM_WL autolearn=ham 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 01DACC10F14 for ; Thu, 3 Oct 2019 20:27:14 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B636820862 for ; Thu, 3 Oct 2019 20:27:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="ZZg/pcZk" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B636820862 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 4646B6B0005; Thu, 3 Oct 2019 16:27:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3EFD76B0006; Thu, 3 Oct 2019 16:27:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2DCA66B0007; Thu, 3 Oct 2019 16:27:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0125.hostedemail.com [216.40.44.125]) by kanga.kvack.org (Postfix) with ESMTP id 05A986B0005 for ; Thu, 3 Oct 2019 16:27:12 -0400 (EDT) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with SMTP id 9B9ED6D78 for ; Thu, 3 Oct 2019 20:27:12 +0000 (UTC) X-FDA: 76003607904.06.crow97_3ee2408db7637 X-HE-Tag: crow97_3ee2408db7637 X-Filterd-Recvd-Size: 4473 Received: from mail-pl1-f194.google.com (mail-pl1-f194.google.com [209.85.214.194]) by imf47.hostedemail.com (Postfix) with ESMTP for ; Thu, 3 Oct 2019 20:27:11 +0000 (UTC) Received: by mail-pl1-f194.google.com with SMTP id s17so2036086plp.6 for ; Thu, 03 Oct 2019 13:27:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=3cFri6KVLIQj5EYoYgPownlzc5LktQs3mtDCkT6lDwg=; b=ZZg/pcZkrAn18xs44NRqTsfTOgRc8tDeRn6GXpfnV5RfV1IDJncidXWJ36mhRDrrvG wLghcIFfEbv3CJDMKBi2IMFUkPq0eog7BRNcePIby+w+C3H/mFNR5I0xk0Wrgl8kEetO ZcH/J7hVauOnYbV54wlo47uYcBky65U2yW1XjvH/ivgnlTFw7p+d3f2yoAyA0WDNGoh8 FxRxlMW54QXIsGFg3aKxj+pjVYaNgkQn6TjM+Zm3uYAgZ7WTxPZ3I5cEibwd5Klm01xN 9aYDkVVPOz1qMyTR+5QoXSxGQTtgVVHHGwoZqaP7jXxkekFTVpJ0Xb2E0i0+JIztUPx6 P2Jg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=3cFri6KVLIQj5EYoYgPownlzc5LktQs3mtDCkT6lDwg=; b=gv+2ZHFPexrUTh+8QnW1sGJ8z0AvWfNXtYANb1TBlTqlZnnJ5JZb/plXO3hnBNLYIA 8cVAGgna1WTr19BIG8VkRYorKfWDeoT49HpnhtvyfhAZ9l8ng/mY+tYZGl0DRiKZVmtP 8tS98Hch4p6xALipMU1s2/84o5vn+TM+y2LtCLcN4xEXbsTt/d3Gch70gjDoZSJOozmy NCIMHTScbDjUk7Slroyq3fXycpIuPP8K6OoOkZMy/sNCLjjy+k2CIS2klXPQJUgMJrT0 qHZkMHUIjuTilReKoNkvSLXUKFjmhNPKdXG39Y2fLViIF4g1bVHholmVHtZj+RKAwUZd rHjg== X-Gm-Message-State: APjAAAWyN+Xust5NhuEyF4P8gTFlODAhr09w1mftmJex+giG1IoRTE5p Z1sl40KJ3HMm1SOzox3UuiJRCoqE/oo= X-Google-Smtp-Source: APXvYqzOECKLDrd4zEtu7lIKga+pne3GfsvhH/PKAKecsYmJFZX/rLNcQbkhgtroS2kUWeV2LhKb0A== X-Received: by 2002:a17:902:6bcc:: with SMTP id m12mr770333plt.280.1570134430571; Thu, 03 Oct 2019 13:27:10 -0700 (PDT) Received: from [2620:15c:17:3:3a5:23a7:5e32:4598] ([2620:15c:17:3:3a5:23a7:5e32:4598]) by smtp.gmail.com with ESMTPSA id 195sm4812630pfz.103.2019.10.03.13.27.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Oct 2019 13:27:09 -0700 (PDT) Date: Thu, 3 Oct 2019 13:27:09 -0700 (PDT) From: David Rientjes X-X-Sender: rientjes@chino.kir.corp.google.com To: Qian Cai cc: akpm@linux-foundation.org, cl@linux.com, penberg@kernel.org, tj@kernel.org, vdavydov.dev@gmail.com, hannes@cmpxchg.org, guro@fb.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm/slub: fix a deadlock in show_slab_objects() In-Reply-To: <1570133266.5576.268.camel@lca.pw> Message-ID: References: <1570131869-2545-1-git-send-email-cai@lca.pw> <1570133266.5576.268.camel@lca.pw> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII 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 Thu, 3 Oct 2019, Qian Cai wrote: > > > diff --git a/mm/slub.c b/mm/slub.c > > > index 42c1b3af3c98..922cdcf5758a 100644 > > > --- a/mm/slub.c > > > +++ b/mm/slub.c > > > @@ -4838,7 +4838,15 @@ static ssize_t show_slab_objects(struct kmem_cache *s, > > > } > > > } > > > > > > - get_online_mems(); > > > +/* > > > + * It is not possible to take "mem_hotplug_lock" here, as it has already held > > > + * "kernfs_mutex" which could race with the lock order: > > > + * > > > + * mem_hotplug_lock->slab_mutex->kernfs_mutex > > > + * > > > + * In the worest case, it might be mis-calculated while doing NUMA node > > > + * hotplug, but it shall be corrected by later reads of the same files. > > > + */ > > > #ifdef CONFIG_SLUB_DEBUG > > > if (flags & SO_ALL) { > > > struct kmem_cache_node *n; > > > > No objection to removing the {get,put}_online_mems() but the comment > > doesn't match the kernel style. I actually don't think we need the > > comment at all, actually. > > I am a bit worry about later someone comes to add the lock back as he/she > figures out that it could get more accurate statistics that way, but I agree it > is probably an overkill. > Maybe just a small comment that follows the kernel coding style?