Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp6452808yba; Tue, 14 May 2019 07:49:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqzxOpwFujZO30iVMXBNHU5qxupAxWu31YmNXiRDQ4WqDzsfuxonPxSDAOcpYcBMP991HK3y X-Received: by 2002:a62:3381:: with SMTP id z123mr42511200pfz.42.1557845388852; Tue, 14 May 2019 07:49:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557845388; cv=none; d=google.com; s=arc-20160816; b=pyQSc/IRlKVE5ulxgGQz8PDUVA3Sx8dMLrj2kYVwCz53HD1akt4oxhk3OW0/8P6yIs qGcjrX1F3yxWjf34bdphfwMV125zuIyKePubVCzyZERwZwK59qFuGSSsbz8e6oVXO/Ez NuYPd2onAXhI4bvq1YcT55CPbCoZRFPENSSHWzl1msaHiQpu5hLIDZ690Ge0DBrGq3vY E16xxgod4G1JnsNbL0bcDQ9eZCu0op2ihT+67fa14jYWIa2MnA6ql4+Sg9ybdqCiHZWz 7fs401bNewV6nvzzbIquIl+r29YyTYd+oS3HbgfZyqvDLpekzD3bE+hcURK2rbhPUb0l 2fiA== 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:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=v9eQGAXN/pUrwyhsEw4eGQ0SnWi81FsI3CN7zGHdMUY=; b=UGJf7oY80ne6ILErasqRUIeHw5STpAOyntJxuHO9jbQotuNBGqs+cRn+X74DjBE5xL nyNdyoRI5tLZ7aEp1oKA6s02bnaNh4LWGAkuNQW/iQzokv50X5PZHRh+OLoIFTVd1acQ 9bFGnTf7lnZWhIpfI4uiDzdPJZoVLHLzxEVlJgi62Ztt8BMg+dDgtWsu4c1RLcLq3gjA OtQFU8w5T7xL6xe16YXkwc6vCln3xXSaM3T5zxBGN31c/+Z0zhRxfptjqYYxvDvQDIyv i/bwldzYOX27tpkgJwi4CPcy9pCHVqHgqTRRkwLOm6h/mqX0GnMIJnEnRzyDDhpMA2y2 taFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lca.pw header.s=google header.b=nDY82R10; 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 z1si20534666plb.48.2019.05.14.07.49.34; Tue, 14 May 2019 07:49:48 -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=@lca.pw header.s=google header.b=nDY82R10; 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 S1726717AbfENOsJ (ORCPT + 99 others); Tue, 14 May 2019 10:48:09 -0400 Received: from mail-qt1-f195.google.com ([209.85.160.195]:35833 "EHLO mail-qt1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726678AbfENOsI (ORCPT ); Tue, 14 May 2019 10:48:08 -0400 Received: by mail-qt1-f195.google.com with SMTP id a39so18492024qtk.2 for ; Tue, 14 May 2019 07:48:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lca.pw; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=v9eQGAXN/pUrwyhsEw4eGQ0SnWi81FsI3CN7zGHdMUY=; b=nDY82R10ZFExPQ1BFRb0cIsRXMz1+Mbb5gLhwYj+P7wenw+vz2PGDVO3MW1ll4xmEs gzrdZELS8S8hCF9KgzMJiVhBrijLGGB98FkA8+R5fQM4kS6TCVEKcnjnmqEENZNN2g1i MIaN+82TeYtLkyYogEUBZJs5wC36oh/Lrj/mtbiGyb+InmfWr6WcxZ5AUVWPFFlrvyBG 4/pj6sdMf1+RGHBtb7Fzr/WKYFSZbUrM0e04VzB3MN1farriSoCrf2lrxWkXLgFkKwSI ++gDxtWGnByHUiyi82arM6CP8Kw0joJB6gqMxBIk3ySoeP2uvbbsfusBhTd61y/daTbz mYOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=v9eQGAXN/pUrwyhsEw4eGQ0SnWi81FsI3CN7zGHdMUY=; b=SeRyGlB7hKzI+Q57+vZGkg5pYRV2jNUz1SdVcduGloHUlv4tzWAq6+xH0BSQfQxcB0 x2N2lSRkKDttf8qIXy6iq5wgzIbH019GZmpfBQtCgnyZkdKj4bFrWC2mUxakUAIYVuyB MRoVjUzGsbFLpgFfQP25L87Cc+kgmQku7DRbnkL5oErd811cPawiarOrDO5ig59jI4EQ 4+ad2Ci/+njwxx5Z08XzlyRGGBfNn864Du2QbMsxLI5RgG0gF26OGDAFQ6JntsgFbKN9 lXsr/tjvtABdbUVdyoHPXlTYxFSJzdwU4zk7xWr3an3YawbPTLUhyetNXrxCv7XJCtfn J0UA== X-Gm-Message-State: APjAAAU31lbOBj1m4Og2JKHl47iMtEOU7RMXVtxMZ3b1EMa9VXHWxKNU GB0/Kah9Fk9GEl3axoXDcUChRA== X-Received: by 2002:ac8:2e38:: with SMTP id r53mr30002293qta.192.1557845286967; Tue, 14 May 2019 07:48:06 -0700 (PDT) Received: from ovpn-120-85.rdu2.redhat.com (pool-71-184-117-43.bstnma.fios.verizon.net. [71.184.117.43]) by smtp.gmail.com with ESMTPSA id 124sm7905551qkj.59.2019.05.14.07.48.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 May 2019 07:48:06 -0700 (PDT) From: Qian Cai To: akpm@linux-foundation.org Cc: cl@linux.com, penberg@kernel.org, rientjes@google.com, iamjoonsoo.kim@lge.com, catalin.marinas@arm.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Qian Cai Subject: [RESEND PATCH] slab: skip kmemleak_object in leaks_show() Date: Tue, 14 May 2019 10:47:41 -0400 Message-Id: <20190514144741.39460-1-cai@lca.pw> X-Mailer: git-send-email 2.20.1 (Apple Git-117) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Running tests on a debug kernel will usually generate a large number of kmemleak objects. # grep kmemleak /proc/slabinfo kmemleak_object 2243606 3436210 ... As the result, reading /proc/slab_allocators could easily loop forever while processing the kmemleak_object cache and any additional freeing or allocating objects will trigger a reprocessing. To make a situation worse, soft-lockups could easily happen in this sitatuion which will call printk() to allocate more kmemleak objects to guarantee a livelock. Since kmemleak_object has a single call site (create_object()), there isn't much new information compared with slabinfo. Just skip it. Signed-off-by: Qian Cai --- mm/slab.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/mm/slab.c b/mm/slab.c index 20f318f4f56e..85d1d223f879 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -4285,6 +4285,15 @@ static int leaks_show(struct seq_file *m, void *p) if (!(cachep->flags & SLAB_RED_ZONE)) return 0; + /* + * /proc/slabinfo has the same information, so skip kmemleak here due to + * a high volume and its RCU free could make cachep->store_user_clean + * dirty all the time. + */ + if (IS_ENABLED(CONFIG_DEBUG_KMEMLEAK) && + !strcmp("kmemleak_object", cachep->name)) + return 0; + /* * Set store_user_clean and start to grab stored user information * for all objects on this cache. If some alloc/free requests comes -- 2.20.1 (Apple Git-117)