Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2205146imm; Mon, 28 May 2018 03:55:44 -0700 (PDT) X-Google-Smtp-Source: ADUXVKK8c45F2DEGAyDyLTEg0kbRtFWPCTZVRsZJ+FHJQn+k4uTiKHStrR26s8sKCJ1UdeB3H39O X-Received: by 2002:a17:902:7c83:: with SMTP id y3-v6mr8614411pll.51.1527504944807; Mon, 28 May 2018 03:55:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527504944; cv=none; d=google.com; s=arc-20160816; b=cnsS5bFwJ8wUb6esHB80mE1q/NmqeAjw1Zz+B0EOjR+wsMSXWJZM+ZaHjov+HY5TEw BrKNTlJ/W647pqRdKb7pKCm71QgeTGY4aGxyXNeIT0jJkjY5DLWZIIMM3YzO76/E0jt8 J6XpRNWcuGWNKVCbInJzseGRJWNuhJWvDyj46W7TyQP4a4X9LuZI9WQ9l9UavYmVt8py BWB00Z1rLQSovidsIOLKO1ey7CKowY9zaiYSs9ZDR7thZ4nOsVkkJgNk5eMJh0LEHsmr nnqFzfMNkDDLiZMzkHcDXT4nbQi49tG2WkiFGSyuaM/ul5rqXMIqGyTimQJVxWeT7Tvz QhAA== 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 :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=ylu9WVwweeNcCH2dL3oyeEhCG0PEix/2qs1nmgf3X2M=; b=n2xPnKSKOLBTlwnH4QyutCeKuLIIGVrnmCsk6vb42JtuMt22ada5LhpNoWWQrwbW36 3wO9Lqs8P6g+sTXrYomdamjPWO4h7BvYv8LSL0R7TRFSCTxE0nd8QdolzaPZ3a53v4aN WUlsQETbscEm8pgH6R9WZzs/5lNvP8AEc9bQnkzeBcrXhStKy/nFrna1Mrm8tkVZbgSh CV4Yc47gvVWu5Q3hXVsVyAvckdOHsmZWVmVsw2b4lc2vrUScewdo+4hYuGJbZcdw3mvv /dVB+ub+M00oB8ndBwUIxX3n4uLQtKHyhDRua/DSvcH9RXd8j0yBz18EGkdEzv+X2zOB dzQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=mCyqUZsb; 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 a4-v6si29934125plp.219.2018.05.28.03.55.30; Mon, 28 May 2018 03:55:44 -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=@kernel.org header.s=default header.b=mCyqUZsb; 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 S1164376AbeE1KzV (ORCPT + 99 others); Mon, 28 May 2018 06:55:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:43876 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1164369AbeE1KzP (ORCPT ); Mon, 28 May 2018 06:55:15 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0635E2089E; Mon, 28 May 2018 10:55:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527504914; bh=5VP891G15OZiGLQb/v1NBqiwRZqmiPOAVtFqZIadCUw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mCyqUZsbKCrAGZSlpPpOXGpp8Jdkyk8CRWqQMP2QwSiX6jJOZJPhiHcHutc78+wUQ x7IE4EHbnPSk1UT6Hp/w+2YDL/zEErkvIPPVHclMMXuEsAOeLuFI563titJo9hT5CL jbCoOVXy/85CR8KbnC0SvXMSz1T3H6oUGMVFvh2E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shakeel Butt , Tejun Heo , Vladimir Davydov , Greg Thelen , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Johannes Weiner , Michal Hocko , Andrew Morton , Linus Torvalds , Sasha Levin Subject: [PATCH 4.14 308/496] mm, slab: memcg_link the SLABs kmem_cache Date: Mon, 28 May 2018 12:01:33 +0200 Message-Id: <20180528100332.776782008@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180528100319.498712256@linuxfoundation.org> References: <20180528100319.498712256@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Shakeel Butt [ Upstream commit 880cd276dff17ea29e9a8404275c9502b265afa7 ] All the root caches are linked into slab_root_caches which was introduced by the commit 510ded33e075 ("slab: implement slab_root_caches list") but it missed to add the SLAB's kmem_cache. While experimenting with opt-in/opt-out kmem accounting, I noticed system crashes due to NULL dereference inside cache_from_memcg_idx() while deferencing kmem_cache.memcg_params.memcg_caches. The upstream clean kernel will not see these crashes but SLAB should be consistent with SLUB which does linked its boot caches (kmem_cache_node and kmem_cache) into slab_root_caches. Link: http://lkml.kernel.org/r/20180319210020.60289-1-shakeelb@google.com Fixes: 510ded33e075c ("slab: implement slab_root_caches list") Signed-off-by: Shakeel Butt Cc: Tejun Heo Cc: Vladimir Davydov Cc: Greg Thelen Cc: Christoph Lameter Cc: Pekka Enberg Cc: David Rientjes Cc: Joonsoo Kim Cc: Johannes Weiner Cc: Michal Hocko Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- mm/slab.c | 1 + 1 file changed, 1 insertion(+) --- a/mm/slab.c +++ b/mm/slab.c @@ -1283,6 +1283,7 @@ void __init kmem_cache_init(void) nr_node_ids * sizeof(struct kmem_cache_node *), SLAB_HWCACHE_ALIGN); list_add(&kmem_cache->list, &slab_caches); + memcg_link_cache(kmem_cache); slab_state = PARTIAL; /*