From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 94535C433FE for ; Thu, 24 Nov 2022 12:12:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2FD8D6B0071; Thu, 24 Nov 2022 07:12:16 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2ADA06B0072; Thu, 24 Nov 2022 07:12:16 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 14FE06B0074; Thu, 24 Nov 2022 07:12:16 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 05A436B0071 for ; Thu, 24 Nov 2022 07:12:16 -0500 (EST) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id CA39AC0302 for ; Thu, 24 Nov 2022 12:12:15 +0000 (UTC) X-FDA: 80168223030.01.734FC84 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf10.hostedemail.com (Postfix) with ESMTP id 19980C0005 for ; Thu, 24 Nov 2022 12:12:14 +0000 (UTC) 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-out1.suse.de (Postfix) with ESMTPS id 9E01D218E9; Thu, 24 Nov 2022 12:12:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1669291933; 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=DJVmOWQbiMAmWnWW4hlsAe4eeK/zWKppLW8xti306l8=; b=C3UPthb+tD9RGQ86R6MIG3nJNUfLpmtD8GzpC0MULOIMRvXck3rGJ7N8WvDuWRchFXatXT ULasH5JgLkCdzxDxk7Q5GrEK+ruHD5YYxSCXQPdfYmOaxzpn1XrbxwejNNSaqUtxu1aqxw 3Flj/3W9ATaZ45Pv+U2mpPNmzTPwuqQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1669291933; 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=DJVmOWQbiMAmWnWW4hlsAe4eeK/zWKppLW8xti306l8=; b=9XLkuKC8yJHZDxVcaB5ZpfD0f920D7i+Gcssv1hh335LdEK2mc/ILRj0MWGsQCS2OSo8lk 72c75DcYoI8hErCg== 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 66CEE13488; Thu, 24 Nov 2022 12:12:13 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id EFQ4GJ1ff2M7egAAMHmgww (envelope-from ); Thu, 24 Nov 2022 12:12:13 +0000 Message-ID: <4fb214a4-0535-2d4a-fcde-bc2ab71329e3@suse.cz> Date: Thu, 24 Nov 2022 13:12:13 +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: Hyeonggon Yoo <42.hyeyoo@gmail.com> Cc: Christoph Lameter , David Rientjes , Joonsoo Kim , Pekka Enberg , 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: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1669291935; a=rsa-sha256; cv=none; b=YMxtnSsib6w1ynoTQiF8eo/cgwaxL8UI9ay9I+cxZtTaGxwI6jvdx+oMGwoqwhHYfpiuZ/ 4l4FMZ1aE2b15Q1HfX1Itp1+JRQA+x95iSI3HqO+U46G9TtMt4KXk9tqZ7lGJw8/pwp7Hv 2HBYmaDGzHJXyc2Pi4oZuGKnK/AGVek= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=C3UPthb+; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=9XLkuKC8; spf=pass (imf10.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.28 as permitted sender) smtp.mailfrom=vbabka@suse.cz; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1669291935; h=from:from:sender:reply-to:subject:subject: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:dkim-signature; bh=DJVmOWQbiMAmWnWW4hlsAe4eeK/zWKppLW8xti306l8=; b=4G+GKBpGlimPTdkJv0WPnN0TUTDipYryJwuWOf+GeQ9pD36WJiYryuEicRszteVKtm2yvp epIjKM9xYt0dM9UpI83AN6KdY7Jo7ldIrz+PyOtfbs9QxC5dJvoRT8JFQJUENWurCmyb8D j/gR7CA3ba3c1ag8wXSjBQf/VSW3HSw= X-Rspamd-Queue-Id: 19980C0005 X-Rspam-User: Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=C3UPthb+; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=9XLkuKC8; spf=pass (imf10.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.28 as permitted sender) smtp.mailfrom=vbabka@suse.cz; dmarc=none X-Rspamd-Server: rspam07 X-Stat-Signature: kesekctb897ob8izjyy797d3nd8jory6 X-HE-Tag: 1669291934-130414 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 11/24/22 13:06, Hyeonggon Yoo wrote: > On Wed, Nov 23, 2022 at 02:53:43PM +0100, Vlastimil Babka wrote: >> 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 >> }; > > Can you please elaborate what the lkp report was about > and how you fixed it? I'm not getting what the problem of previous > version is. Report here: https://lore.kernel.org/all/202211231949.nIyAWKam-lkp@intel.com/ Problem is that if the preprocessing results in e.g. KMALLOC_NORMAL = 0, KMALLOC_DMA = KMALLOC_NORMAL KMALLOC_CGROUP, KMALLOC_RECLAIM = KMALLOC_NORMAL, NR_KMALLOC_TYPES then NR_KMALLOC_TYPES is not 2, but 1, because the enum's internal counter got reset to 0 by KMALLOC_RECLAIM = KMALLOC_NORMAL. A common gotcha :/