Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp278123ybp; Thu, 3 Oct 2019 13:27:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqw0uM+QZ9rFlT2nNEldYLroNOa4I8r+hLo2+u5uybQlZW+4YKlAOsKp4qlOurN/QKi+XSJT X-Received: by 2002:a17:906:c742:: with SMTP id fk2mr9465174ejb.44.1570134469063; Thu, 03 Oct 2019 13:27:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570134469; cv=none; d=google.com; s=arc-20160816; b=mPN8uD0a68ydA4xySh1VuRHc71mr+u24xQag+Pk6YVnJMpqkebVR00FWh5NpUbNp1X MQ9VCqYirG8LarjoXQknYs0LMiimkDccUEU38dL5+Q+HjHwC5TFhgczwm7AlU0wwfkDo j1qh4y9Z+N4BQDc1uUGlegL7FRIrEGEl3uyVhlLeFuTywOtOEKBS1eBAhuXgAg0iHY1t 5eWiek3SpU5Y+WQK5NvUpugVfuc4lCPl6XgGhRi82TW0t9RTU2lPO+knD9y+ZhcHTKqI wrFyAfKqAxgPgE2TA75ppofS3Aw3rPOKxNzQ8+3fSWTMppwPYubZTCSvmujH9ZIMgM+l b0Rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date:dkim-signature; bh=3cFri6KVLIQj5EYoYgPownlzc5LktQs3mtDCkT6lDwg=; b=SOnsiT05yrpRWe32pj5W+RK0QO3lGTkzZ6R9dm+os6VnwobwK32DJgw+hKmcOQF8JK MUp0JRzBuInu8wIOyav/cxwqv0ffrcLj/Sm5D8uGKdZ9rPE5XgQflHUciaYRuLuuP2yi h2o3wOzaPQtYqX/trNqOkNG7UhWYet1jI4iUZIDZD8/ABtcM3dgL1xWcf5K6T79pdmL4 JImijLhkd6rRBNiri9OrrNGDpXTIH2EFeqovQ6tL5u0WJGip62Hy6ztm35exk9d+dJrF sq6F09iPBot1u3Xt1Rh2WaDAwbHf05XWJikYHlCiEWrgwo9cPE0QFxS3u2FZP78lmPg+ 1y4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="ZZg/pcZk"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ch10si1718797ejb.89.2019.10.03.13.27.23; Thu, 03 Oct 2019 13:27:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="ZZg/pcZk"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732468AbfJCU1N (ORCPT + 99 others); Thu, 3 Oct 2019 16:27:13 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:38754 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729557AbfJCU1N (ORCPT ); Thu, 3 Oct 2019 16:27:13 -0400 Received: by mail-pl1-f195.google.com with SMTP id w8so2037037plq.5 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=YGKXok3nQv6basmrYhXLnVCk1IlHhX+L9bCf8BNzOF3MNHYBICApaGYqmwdF3syjFr GkWtn9ZkuRz6DencxdWsBoXf3eBItlBL7H9iiKnVJDZJaqZuHJqR0EYhq7xMzgMPvCwM 4/yygnPKUtAvcCC1ng1Qx1zsSFl8EFPSKOXPcw13tsZpYL8MWWgXgMbnaVc71Muq/A5f otTijCK9elh1IFeco3NZ9AN7zax94mGj1j3jzCDhpFQ/34yFkZfxb+CQ6JxwjfSXv4wy b+NFJIa3XR6Bwmv1gQDyu+JtMe5ZQTCWcDFh6KE+S5ZqTjrM6dkVq4GoV2iYwDyw773f gJQg== X-Gm-Message-State: APjAAAWIhjTO1f8hoSmh2uURokn47ic0cf7/94+gDjiMeyxHQZlqc5cm DBfXytKkB/IXI/NNnVosfjSuyw== 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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?