Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp8827996rwb; Thu, 24 Nov 2022 04:59:33 -0800 (PST) X-Google-Smtp-Source: AA0mqf6yrfNXd8cKDZ3uF3/zjaVcDhTXpbmhfB/xZtI+7eeI+EUfsHtXh5W43SeNHKsQVcXmnAL3 X-Received: by 2002:a05:6402:3785:b0:461:e598:e0bb with SMTP id et5-20020a056402378500b00461e598e0bbmr30278564edb.21.1669294773559; Thu, 24 Nov 2022 04:59:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669294773; cv=none; d=google.com; s=arc-20160816; b=ZCfpBYGgUNNsb2XxS0WZ9/c9f4TzcgtPcb9iUm9nyuFw1aTEx6byz8ww5fJ+k9NgV9 PaNF+cE3G/92L0F8Si2NrSs1zvvVkZN6XsAUwaaAiLEbYpiOWo0ufBwSZl4+ud2RP3SB YM6CMTLraNN+1ps0oPq162Z+k8BqukgbDRIp4M8vOSNrCybx4szcCpDutQU/CmokOvC+ hftYktAXQbCUSyMSC9eChoVK2XPKOwDiyAb0vUCKbF71a01g/l84OGkHcd6/fadYtdWZ GcbfXtxU8sAyK4NMmfEIBHo7QMav5JOhoeW+QkwdYFCKZ6M9/vz3/mTcfY+BbiFh4udi 4LaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=9gtzrOrsoNCV5o2QC8fgzxtE8ANXsxJSKoxo24IyFcc=; b=CNSsLtSgEtaLmTB4qCY8LNq/bYquonKuZROLIDfOoAUbLIL8HNpcGakEVDWGkAfQcc q/Q2HHBNuggyEPvYU+gDrl1QulS87AypayyQnIBr9ct7Itk4V3JaIK/6ulHShvTaO2se ptHvFgR/2Bl8/ioXxxlj+HuGxQprxRcg/IWcc101OtyKrsrniSVfZeDosySXN7BmHznX Ej4AZzdoNnO/OYH1xw+RodrhUxK8MVRnsQl3QNKgACrwFHn+M/2Y99OoGcv3TCBBfdC3 tulTdTiK0GHP+L4XrI9lzqD4e8+ptrswaSJWmzRHVks48MCHi4Js3BCEySbutW2ZbYG2 YzZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=RINqxyHQ; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g5-20020a50d0c5000000b0046903cb5f69si325967edf.530.2022.11.24.04.59.11; Thu, 24 Nov 2022 04:59:33 -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=@gmail.com header.s=20210112 header.b=RINqxyHQ; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229733AbiKXMzz (ORCPT + 87 others); Thu, 24 Nov 2022 07:55:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229583AbiKXMzm (ORCPT ); Thu, 24 Nov 2022 07:55:42 -0500 Received: from mail-pg1-x52c.google.com (mail-pg1-x52c.google.com [IPv6:2607:f8b0:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B1B21789F for ; Thu, 24 Nov 2022 04:55:23 -0800 (PST) Received: by mail-pg1-x52c.google.com with SMTP id q71so1495720pgq.8 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=rA3nS5LuhS73Pd6cRKZivdj1Of66gI80Gu33t/lYPZFqmL4AlfqqaDyE8wJy7TOOj4 3YndRxcEmxGiSZfWcPRpEuLz4tvaemFpsppoZ+0esA09ESZny8fLmYntRG91obZ2hM/W RF30nd7pTTfnsegNqMVJs3bY/StFVXTtH2F3ZsN0r+Exu5JSjYFsw+RBtBUmVrr9S0M/ uTKf5GCerl+UqkIeSz85JkFdqlMvxI21R4bkenF3P/4MBjFCjHFuoozzcQOmPIemT036 cSvKpTHq8ldhFoCiXJFaUB+9caLRNVNJETAH7XV4bB6Tg2b2plMhtoOaJhOCHNBnOVBx /Jlw== X-Gm-Message-State: ANoB5pmCJWq9FgOGBaLwZ324qONNS13D85RChRz5epbwn4KQ+gZPzvOb ImE/f7GTenXhumhnnfMkTMQ= 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> X-Spam-Status: No, score=-0.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HK_RANDOM_ENVFROM, HK_RANDOM_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=no 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 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