Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5602085imu; Mon, 26 Nov 2018 02:51:00 -0800 (PST) X-Google-Smtp-Source: AJdET5dAlbyHwL862O04ojaPYizc4f57cexc5kKxKRz0vW4iyVVdILRk+Piu/aXjpJYOT6n3l+Z2 X-Received: by 2002:a63:5722:: with SMTP id l34mr24241598pgb.118.1543229460031; Mon, 26 Nov 2018 02:51:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543229460; cv=none; d=google.com; s=arc-20160816; b=vkBgi59XV6saWtqb9d8by5dahryyIkwbbxlCQiGmPinKCvrzz8zyRX96mqnuP3YGK7 Ak3Vkyf1Hb3SpbEp6xVM+GBvVJKmIcXofZcfB74dgH9nlgnPUh0LWh63DVCtHHAz9TKE IUG/4jU5KC8VxAlesrDPAge0nJcR1+wt3sd5oWkjyh5I0Sg3BGujX0hp8ddzVvIimA/t EmOjN+CkPHN4VL/iG1n9mkuEh5laP8TDhCKb5StubtuT0uPrfJWnD4H9la/tPqMN0r38 XCoG9LAVwS7UgkC2QRk4yLn9IQy9z5lY7Ya4/KR4U2r7rm6w1MP4FpItdF+U6CKtYHMD YnoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=4ZSi1AombESkhu+W6EnuIFuI1kqbCApLuv75//UNDLA=; b=yjdTlFASQKxmbUva8GUCFdCbLvkgqXRP23flfRUQittcwKAyLPuNk7BY5wGBoCLN/h 0Fxmhs8hBoe3388Dz331mFEN4qMDo4YcxN4EQHwmuCAZxuyi4HXfad8q8lSnWa8L2XpW 7c5bP0ansK/lKYIBx0DR4mDt5KgvHDoJ2fehGRNTIBSuPOjwaGigeznESGnLaPvDMLJB MX1sYA0oIiyI5daTHOoa1PfUMxDcoH/OXwxrieuLUClyKwYIaScYQlnbfO36nKn+0WtF se0/3hZs9+yxKZX9rkO1Xj2aZxf48JMnO/U/kxVOwn1bYU0eDJQLwtlGEYKZD92IhQZ8 pnRA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z8si16271514pgk.183.2018.11.26.02.50.44; Mon, 26 Nov 2018 02:51:00 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726206AbeKZVnx (ORCPT + 99 others); Mon, 26 Nov 2018 16:43:53 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:59694 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726138AbeKZVnx (ORCPT ); Mon, 26 Nov 2018 16:43:53 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id DDB1F351D; Mon, 26 Nov 2018 02:50:09 -0800 (PST) Received: from arrakis.emea.arm.com (arrakis.cambridge.arm.com [10.1.196.113]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 636DE3F5AF; Mon, 26 Nov 2018 02:50:08 -0800 (PST) Date: Mon, 26 Nov 2018 10:50:05 +0000 From: Catalin Marinas To: Qian Cai Cc: Waiman Long , Thomas Gleixner , Andrew Morton , Yang Shi , arnd@arndb.de, linux kernel Subject: Re: [PATCH v4] debugobjects: scale the static pool size Message-ID: <20181126105005.GA33554@arrakis.emea.arm.com> References: <20181120232810.2503-1-cai@gmx.us> <20181121021157.3061-1-cai@gmx.us> <211af3b2-bc56-2d1b-c6c2-f6853797a7a1@gmx.us> <473f6a6e-1a14-d07c-b0f0-4d96e3232d1a@redhat.com> <5abb31e1-b5f2-718d-3a48-b0d8a73d6e5c@gmx.us> <0cba9054-99dd-9dbe-3da8-e10d25752c5b@gmx.us> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <0cba9054-99dd-9dbe-3da8-e10d25752c5b@gmx.us> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 26, 2018 at 04:45:54AM -0500, Qian Cai wrote: > On 11/25/18 11:52 PM, Qian Cai wrote: > > BTW, calling debug_objects_mem_init() before kmemleak_init() actually > > could trigger a loop on machines with 160+ CPUs until the pool is filled > > up, > > > > debug_objects_pool_min_level += num_possible_cpus() * 4; > > > > [1] while (obj_pool_free < debug_objects_pool_min_level) > > > > kmemleak_init > > ? kmemleak_ignore (from replaced static debug objects) > > ??? make_black_object > > ????? put_object > > ??????? __call_rcu (kernel/rcu/tree.c) > > ????????? debug_rcu_head_queue > > ??????????? debug_object_activate > > ????????????? debug_object_init > > ??????????????? fill_pool > > ????????????????? kmemleak_ignore (looping in [1]) > > ??????????????????? make_black_object > > ????????????????????? ... > > > > I think until this is resolved, there is no way to move > > debug_objects_mem_init() before kmemleak_init(). > > I believe this is a separate issue that kmemleak is broken with > CONFIG_DEBUG_OBJECTS_RCU_HEAD anyway where the infinite loop above could be > triggered in the existing code as well, i.e., once the pool need be refilled > (fill_pool()) after the system boot up, debug object creation will call > kmemleak_ignore() and it will create a new rcu debug_object_init(), and then > it will call fill_pool() again and again. As the results, the system is > locking up during kernel compilations. > > Hence, I'll send out a patch for debug objects with large CPUs anyway and > deal with kmemleak + CONFIG_DEBUG_OBJECTS_RCU_HEAD issue later. I haven't hit this before but I can see why it happens. Kmemleak uses RCU for freeing its own data structures to avoid a recursive call to sl*b (kmem_cache_free()). Since we already tell kmemleak to ignore the debug_objects_cache allocations, I think we could as well add SLAB_NOLEAKTRACE to kmem_cache_create() (I haven't tried yet, this was not a documented API for kmemleak, rather used to avoid kmemleak tracking itself). -- Catalin