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 05421C433FE for ; Thu, 24 Nov 2022 12:55:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6FF746B0074; Thu, 24 Nov 2022 07:55:24 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6AE996B0075; Thu, 24 Nov 2022 07:55:24 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 576496B0078; Thu, 24 Nov 2022 07:55:24 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 475496B0074 for ; Thu, 24 Nov 2022 07:55:24 -0500 (EST) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 116E0ABC76 for ; Thu, 24 Nov 2022 12:55:24 +0000 (UTC) X-FDA: 80168331768.15.9AC407A Received: from mail-pg1-f173.google.com (mail-pg1-f173.google.com [209.85.215.173]) by imf19.hostedemail.com (Postfix) with ESMTP id AD4331A0011 for ; Thu, 24 Nov 2022 12:55:23 +0000 (UTC) Received: by mail-pg1-f173.google.com with SMTP id q1so1483713pgl.11 for ; Thu, 24 Nov 2022 04:55:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=9gtzrOrsoNCV5o2QC8fgzxtE8ANXsxJSKoxo24IyFcc=; b=RINqxyHQ1+PlMbJe7syJQm04IztogY5hCRUwRAOi2i6WrIByZqpDK/LPRjeplsTdtt KmV0QCeI7hNtnElUTudG0rFIOCSmDz0TIEzLxL0dqiMXf5WqexjgDYpG04EqvRDOKN+A hHGG54Gxkoxp5bX1FZuVUR+ZL2jp60VVAzJmgruSqKBm2U9UWswEHBwaNGnPpy3yScY3 Nd7FcA4BcRX0No/2vhLV0sttRpn69iZeRUtlXCFRXC8W0Vgz6kL1WigkyZ5Gr0mMT1KF H6fK8w5WDLioJaJWJZcuGwt3lfRGfKbscQfk4Fq85TjYkZ7SOBS67RgtSGY7Fvdbb/uT hFUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=9gtzrOrsoNCV5o2QC8fgzxtE8ANXsxJSKoxo24IyFcc=; b=cKYXlLLQjk+DDATeGOhixNw84Urqrvs0YPtxEy8aOPXkFMrYhTSxxo1iGNxH0y+L9T EmNjtNHeJx4dlMuLeZW3vue/BodBMAYhoBIiTHChpi2CK3YnJ9qU2KfWd1Ogfow9OvLj MQ1jN7qNtD3/8g6FTDzoqKMnHJ2I6fMSdv2nosGV0e1AE/NJj/1NvvunHDRdqqVdA1o6 prztTCRsmxd/5mg+XvcSsRBHsMp472a0yxbMWO2hpWxl1QzA2cNtikkUawPTTGAKI88a Xx1hBNk+ZCK+v3ZY6eJ4FF5BwcGb9fJD4O3px0RNLvnUteUQYuWSm9Wm3ncjwtaQf9mz GNmQ== X-Gm-Message-State: ANoB5pkS86YKQLV0Jnojg/CgMpbOY/d5NJ57AehXrtzA+B/feUSXygB3 q7CBNj2EvBShfV4EqOBYeXQ= X-Google-Smtp-Source: AA0mqf4rEBDF5wX9BJnHhW0nfowVburVfHmQhsIXGzqgWOWAmaPXelMP15ZuJXhvQFBMs9Sb+5x4Pg== X-Received: by 2002:a63:ea52:0:b0:46f:9c0c:8673 with SMTP id l18-20020a63ea52000000b0046f9c0c8673mr13642591pgk.154.1669294522593; Thu, 24 Nov 2022 04:55:22 -0800 (PST) Received: from hyeyoo ([114.29.91.56]) by smtp.gmail.com with ESMTPSA id y8-20020a17090a390800b0020d48bc6661sm3120211pjb.31.2022.11.24.04.55.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Nov 2022 04:55:21 -0800 (PST) Date: Thu, 24 Nov 2022 21:55:15 +0900 From: Hyeonggon Yoo <42.hyeyoo@gmail.com> To: Vlastimil Babka 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 Subject: Re: [PATCH 06/12] mm, slub: don't create kmalloc-rcl caches with CONFIG_SLUB_TINY Message-ID: References: <20221121171202.22080-1-vbabka@suse.cz> <20221121171202.22080-7-vbabka@suse.cz> <4fb214a4-0535-2d4a-fcde-bc2ab71329e3@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4fb214a4-0535-2d4a-fcde-bc2ab71329e3@suse.cz> ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1669294523; a=rsa-sha256; cv=none; b=TScXZxSkP2xCqSdrRDDN0RC8/0ZjlO1SqCwhc213OZhWVewdQzUItcVLZ8XSNX3mCZQ5kO XN8MTSp6X0TX/dBZglgwsksQN4hvO4XeFugalxHfzWqoQ6BfsHz9DHxlJ4XrcfS6CC1BoE EgPIShqUrKsjMdofJ4meuELQLQYfftI= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=RINqxyHQ; spf=pass (imf19.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.215.173 as permitted sender) smtp.mailfrom=42.hyeyoo@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1669294523; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=9gtzrOrsoNCV5o2QC8fgzxtE8ANXsxJSKoxo24IyFcc=; b=3p6Xp/9yg8KThCEumGKoqn0qmCs39xbv4M3VilpmxvGyudS5XKmfiGoeMY1C0rtpPsX+ZY gOGKCAf3hffaefszAsPOT5+JFBht0gBz3OLPnGJ/LRwYzrSGW7Q6xyCU6o8Wltl5M0jik8 Pp73CpxzXkgs9mFjKIYCNemY5rx1+cs= X-Stat-Signature: xpndhqwa7o4umjphme9ead569sun6oib X-Rspamd-Queue-Id: AD4331A0011 X-Rspam-User: Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=RINqxyHQ; spf=pass (imf19.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.215.173 as permitted sender) smtp.mailfrom=42.hyeyoo@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspamd-Server: rspam02 X-HE-Tag: 1669294523-360414 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 Thu, Nov 24, 2022 at 01:12:13PM +0100, Vlastimil Babka wrote: > 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 :/ Thanks for quick and kind explanation :) That was easy to be missed. -- Thanks, Hyeonggon