Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757376Ab2FRKbA (ORCPT ); Mon, 18 Jun 2012 06:31:00 -0400 Received: from mailhub.sw.ru ([195.214.232.25]:9616 "EHLO relay.sw.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757329Ab2FRKa5 (ORCPT ); Mon, 18 Jun 2012 06:30:57 -0400 From: Glauber Costa To: Cc: Pekka Enberg , Cristoph Lameter , David Rientjes , , , , , Frederic Weisbecker , Suleiman Souhlal , Glauber Costa , Pekka Enberg Subject: [PATCH v4 03/25] slab: move FULL state transition to an initcall Date: Mon, 18 Jun 2012 14:27:56 +0400 Message-Id: <1340015298-14133-4-git-send-email-glommer@parallels.com> X-Mailer: git-send-email 1.7.10.2 In-Reply-To: <1340015298-14133-1-git-send-email-glommer@parallels.com> References: <1340015298-14133-1-git-send-email-glommer@parallels.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2165 Lines: 68 During kmem_cache_init_late(), we transition to the LATE state, and after some more work, to the FULL state, its last state This is quite different from slub, that will only transition to its last state (previously SYSFS), in a (late)initcall, after a lot more of the kernel is ready. This means that in slab, we have no way to taking actions dependent on the initialization of other pieces of the kernel that are supposed to start way after kmem_init_late(), such as cgroups initialization. To achieve more consistency in this behavior, that patch only transitions to the UP state in kmem_init_late. In my analysis, setup_cpu_cache() should be happy to test for >= UP, instead of == FULL. It also has passed some tests I've made. We then only mark FULL state after the reap timers are in place, meaning that no further setup is expected. Signed-off-by: Glauber Costa Acked-by: Christoph Lameter CC: Pekka Enberg CC: David Rientjes --- mm/slab.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mm/slab.c b/mm/slab.c index e174e50..2d5fe28 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -1643,9 +1643,6 @@ void __init kmem_cache_init_late(void) BUG(); mutex_unlock(&slab_mutex); - /* Done! */ - slab_state = FULL; - /* * Register a cpu startup notifier callback that initializes * cpu_cache_get for all new cpus @@ -1675,6 +1672,9 @@ int __init __kmem_cache_initcall(void) */ for_each_online_cpu(cpu) start_cpu_timer(cpu); + + /* Done! */ + slab_state = FULL; return 0; } @@ -2120,7 +2120,7 @@ static size_t calculate_slab_order(struct kmem_cache *cachep, static int __init_refok setup_cpu_cache(struct kmem_cache *cachep, gfp_t gfp) { - if (slab_state == FULL) + if (slab_state >= UP) return enable_cpucache(cachep, gfp); if (slab_state == DOWN) { -- 1.7.10.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/