Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp7419015rwb; Wed, 23 Nov 2022 06:21:40 -0800 (PST) X-Google-Smtp-Source: AA0mqf6xCPD5uZQneZ0XocKXnzKCeeL6IEWkUknzD/dmiBQwP2ptG6gxXyrx9KvKebjq+F8Ch8TD X-Received: by 2002:a17:90a:ac0f:b0:218:bc3e:95f4 with SMTP id o15-20020a17090aac0f00b00218bc3e95f4mr13532297pjq.150.1669213299824; Wed, 23 Nov 2022 06:21:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669213299; cv=none; d=google.com; s=arc-20160816; b=HhUoagRzBQGCCs4qotm2wi64CMO7y1F8k6AliJk4vr11oGZrF2JflHSZIvpGjlNK6x 04xT6LNyFHSAXBpmB+o+z1TB1s4BF3HgBChz8Xa2o0URR3AgJ2SVaDsx7v/Ewse0hpax cK6dmP9ehOvpkgWle2du4A8StRv8KBTw1jfKRBnSl64DFazTpW7FzwKMJRvVV6hdamyH 77P/pLmWnwzh/m3QXjl7Omciiq+wbI3w3jNPfPYYYwm8pR2yHdRSqZjGdUCqh2Ktu77k JSDkuQH8daze9UejVLmyXI4lDNrxunLwBBYr2V5cRKd+CbYTVxHXoB3hbocb+g5QBzW5 s+rA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature:dkim-signature; bh=aDgpM1Fdb/f/drwuUgdV96KDMG9JfLvZ62oRwB+DzNQ=; b=yejawAJsUXx0kVoN4tjgtJ/kk+rqbyOmO7B6whRClwd/hi8Sy+nu44A7CIysjWP9fG qcO025tGIggz4bM75uyVfJHWOeLhc9/OEK9K+f+r7/1VFAiCMx5Lrvw+9bKvgjLENuy2 o8VKuINskU5Ofim4PjTXZtTje4xVWLRTdibFtuihg7depO0Z0B61ygn8WHIfBnS3be7k U3Umh6nd27BOIQa7T36cxb+WDwSb4V+jOTsDjsN4NTf+A4wfHvDgVxwV3HGs2e4tSA+C tdlQQfODiQmYdS0r/CB0kHlKBDlL9+0JQUXQXDPiBt8KwodavijOjpt60cAvJu8/JCzV SfCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=FY97pWy3; dkim=neutral (no key) header.i=@suse.cz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p3-20020a170902e74300b00188a7401d89si18354370plf.481.2022.11.23.06.21.26; Wed, 23 Nov 2022 06:21:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=FY97pWy3; dkim=neutral (no key) header.i=@suse.cz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238174AbiKWN7h (ORCPT + 90 others); Wed, 23 Nov 2022 08:59:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238093AbiKWN7I (ORCPT ); Wed, 23 Nov 2022 08:59:08 -0500 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44707D2DE for ; Wed, 23 Nov 2022 05:53:45 -0800 (PST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id F3D381F88C; Wed, 23 Nov 2022 13:53:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1669211624; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aDgpM1Fdb/f/drwuUgdV96KDMG9JfLvZ62oRwB+DzNQ=; b=FY97pWy3KlkUXh8W7H7iArWxvIh2oKnF2dmqRxqze0iTTXvOe4okXWLLQ6nJXxwnUUDtgq sBhpcO2SD5QJXaUyURiKnea9HoWrkA3g44rCi3st0FG3HQfuwufCQ7OVVlZQyMocPnWSuz VX3L2p+0DqMWBo1uQ2wualCogXDaEoc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1669211624; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aDgpM1Fdb/f/drwuUgdV96KDMG9JfLvZ62oRwB+DzNQ=; b=MSdwOQbIUE6Xn8DzZ+SmjcGbXqAhqHQeTJva81j5vZXv3yaJ2j8hxtzClR6srMk5yDIx5b MEO4hRFJhCIoT5BA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id A99F713A37; Wed, 23 Nov 2022 13:53:43 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id v1r5J+clfmOxEQAAMHmgww (envelope-from ); Wed, 23 Nov 2022 13:53:43 +0000 Message-ID: Date: Wed, 23 Nov 2022 14:53:43 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 Subject: Re: [PATCH 06/12] mm, slub: don't create kmalloc-rcl caches with CONFIG_SLUB_TINY Content-Language: en-US To: Christoph Lameter , David Rientjes , Joonsoo Kim , Pekka Enberg Cc: Hyeonggon Yoo <42.hyeyoo@gmail.com>, Roman Gushchin , Andrew Morton , Linus Torvalds , Matthew Wilcox , patches@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20221121171202.22080-1-vbabka@suse.cz> <20221121171202.22080-7-vbabka@suse.cz> From: Vlastimil Babka In-Reply-To: <20221121171202.22080-7-vbabka@suse.cz> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/21/22 18:11, Vlastimil Babka wrote: > Distinguishing kmalloc(__GFP_RECLAIMABLE) can help against fragmentation > by grouping pages by mobility, but on tiny systems the extra memory > overhead of separate set of kmalloc-rcl caches will probably be worse, > and mobility grouping likely disabled anyway. > > Thus with CONFIG_SLUB_TINY, don't create kmalloc-rcl caches and use the > regular ones. > > Signed-off-by: Vlastimil Babka Fixed up in response to lkp report for a MEMCG_KMEM+SLUB_TINY combo: ---8<--- From c1ec0b924850a2863d061f316615d596176f15bb Mon Sep 17 00:00:00 2001 From: Vlastimil Babka Date: Tue, 15 Nov 2022 18:19:28 +0100 Subject: [PATCH 06/12] mm, slub: don't create kmalloc-rcl caches with CONFIG_SLUB_TINY Distinguishing kmalloc(__GFP_RECLAIMABLE) can help against fragmentation by grouping pages by mobility, but on tiny systems the extra memory overhead of separate set of kmalloc-rcl caches will probably be worse, and mobility grouping likely disabled anyway. Thus with CONFIG_SLUB_TINY, don't create kmalloc-rcl caches and use the regular ones. Signed-off-by: Vlastimil Babka --- include/linux/slab.h | 9 +++++++-- mm/slab_common.c | 10 ++++++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/include/linux/slab.h b/include/linux/slab.h index 45efc6c553b8..ae2d19ec8467 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h @@ -336,12 +336,17 @@ enum kmalloc_cache_type { #endif #ifndef CONFIG_MEMCG_KMEM KMALLOC_CGROUP = KMALLOC_NORMAL, -#else - KMALLOC_CGROUP, #endif +#ifdef CONFIG_SLUB_TINY + KMALLOC_RECLAIM = KMALLOC_NORMAL, +#else KMALLOC_RECLAIM, +#endif #ifdef CONFIG_ZONE_DMA KMALLOC_DMA, +#endif +#ifdef CONFIG_MEMCG_KMEM + KMALLOC_CGROUP, #endif NR_KMALLOC_TYPES }; diff --git a/mm/slab_common.c b/mm/slab_common.c index a8cb5de255fc..907d52963806 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c @@ -770,10 +770,16 @@ EXPORT_SYMBOL(kmalloc_size_roundup); #define KMALLOC_CGROUP_NAME(sz) #endif +#ifndef CONFIG_SLUB_TINY +#define KMALLOC_RCL_NAME(sz) .name[KMALLOC_RECLAIM] = "kmalloc-rcl-" #sz, +#else +#define KMALLOC_RCL_NAME(sz) +#endif + #define INIT_KMALLOC_INFO(__size, __short_size) \ { \ .name[KMALLOC_NORMAL] = "kmalloc-" #__short_size, \ - .name[KMALLOC_RECLAIM] = "kmalloc-rcl-" #__short_size, \ + KMALLOC_RCL_NAME(__short_size) \ KMALLOC_CGROUP_NAME(__short_size) \ KMALLOC_DMA_NAME(__short_size) \ .size = __size, \ @@ -859,7 +865,7 @@ void __init setup_kmalloc_cache_index_table(void) static void __init new_kmalloc_cache(int idx, enum kmalloc_cache_type type, slab_flags_t flags) { - if (type == KMALLOC_RECLAIM) { + if ((KMALLOC_RECLAIM != KMALLOC_NORMAL) && (type == KMALLOC_RECLAIM)) { flags |= SLAB_RECLAIM_ACCOUNT; } else if (IS_ENABLED(CONFIG_MEMCG_KMEM) && (type == KMALLOC_CGROUP)) { if (mem_cgroup_kmem_disabled()) { -- 2.38.1