Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp8789474rwb; Thu, 24 Nov 2022 04:26:51 -0800 (PST) X-Google-Smtp-Source: AA0mqf7ofayd0Q/n6Q/Nv2rm2WGU/CcKIwROcJvnbL+jUcHINPWos0Xb6KvlgTRAO02M7s0F8J9n X-Received: by 2002:a17:90a:b298:b0:212:f923:2f90 with SMTP id c24-20020a17090ab29800b00212f9232f90mr34554622pjr.93.1669292810822; Thu, 24 Nov 2022 04:26:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669292810; cv=none; d=google.com; s=arc-20160816; b=XBynYS0vscrzC8JQk9v7kmzu9FAJY0d4qBDOPLDuDNpqJTOaw3MPnHAEUoiop42r52 ly6w5aqbUmGJLvKsZEBehoG44CgmmRjHBLsZjuS3Q38tGraE9jlO/mk6gHZD6oAz/gou BzaAHN5iajJfxLlMzrnZyBst0Gfhql7MtW/gjGp7cb91hhItSoPloT5VyHfBA8VtFMWE 6mGYcd+J0zQ6ghqZY4XUqJnSkEmyxzPd0v6zIkCZYmJA9OLRTI0cwvNChpZ21EIKClMb 3Q4BoW9UQHRHhYc8QAp7M7SfOpGV2Czkm/e+Kjjq4ggXhL7Y4Ob+hHjRtO81Q3vzYhyB K1XQ== 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=IAX5cjv3FV+pwILnpnHsO44lgFo9KZIJeSsheZZLVIg=; b=QcB8CId/r0LFkeja+AfOKqJbekxffZ1rlVjj+ZmsMiwcvxsncqdhE7zaXqaZSXFnHA hZbeGvednYHmi5r38m/eZjEHRmYIrgsqYzDv1HkDeHrFKdaO9MomTY2CnayJV8fbb5GN bNmv9vlt7zacadO7UZCF7RsUkbZuEA2TTtaH34cGsvJaWG8XRvcJEUIKdq+47lMQfD8p RvfwXQ+t/Dsk2DkDtk+4ycCR3WLHGjZkqg91n3TwOrvP4pD5cB8r5wOOL9Ek5tTr/LDh JHcOCXMbrXdiRomjUrOtSngMnRB8LaygailcE8gOktK+7WCTukYxoQA5/yGJlRPNjMMj aX/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=hvY1uDyL; 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 r31-20020a63fc5f000000b004704320edbcsi1113386pgk.437.2022.11.24.04.26.39; Thu, 24 Nov 2022 04:26:50 -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=hvY1uDyL; 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 S229535AbiKXMHc (ORCPT + 86 others); Thu, 24 Nov 2022 07:07:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230143AbiKXMHL (ORCPT ); Thu, 24 Nov 2022 07:07:11 -0500 Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3BB72A28B8 for ; Thu, 24 Nov 2022 04:06:13 -0800 (PST) Received: by mail-pj1-x1035.google.com with SMTP id y14-20020a17090a2b4e00b002189a1b84d4so1470490pjc.2 for ; Thu, 24 Nov 2022 04:06:13 -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=IAX5cjv3FV+pwILnpnHsO44lgFo9KZIJeSsheZZLVIg=; b=hvY1uDyL0ey9sUdH1VlAPTnxAQ6Z4wMH2cJPwB39IuOLSrbbwT6J/MPAr422yfgWLc 5WGaaaTTywlbrL3NoU1/EHsbe9MiwUOq2TpFeUEOQSN6X4ePtVOgRn294LHwnYb7ycL4 NoCmjKIE+2tOJjJFVlEattu1U1hGXPJL/ffS1GurdZM0VamAPKr9iWm7xyDk+vnh8JwP Uh86JffdWQSnDgAmeRDZ09uwsBEXgvcIFmqj+UvRb8SohnfsfpUTybWWgoLD0vcVLLHG Cu9aX1FLr0ptzWJLb3D212Mt5U+dTjKS3mucKL3wZALgrFmBOqqORl+JPrLHOX1MwMW8 O8zQ== 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=IAX5cjv3FV+pwILnpnHsO44lgFo9KZIJeSsheZZLVIg=; b=TypOyKV+jOdl5ZbyedPo5+7dZlqGjberBc5vBA8Oq3AHs9x1LawelDF9rTQwMGDbby tBvm8JDhMbHvfrgWxtNnZYiQOi/iIa3i4Dg3bp7qHBjXsyP/wqcsCwIF7hjlKssZkMAp HKaRMO/yCDXhTAasKxWu8Ix9kDkf9R5TPkWB2wzKbrYUs0A5Kp2RKKIuCbFo/eW5RRAb oH9SbdvKy1GT5RGDKip7KIn45N6HXQdSooYBun+lfQqVbKeHd1Nf/jqkvkA5ReU+fuJI LRwOYzlJR6WvpVBF3HTf6qKSoqM/+LExWKUOeVgj0006EqKR13LqjixtuTKb443Om2An froA== X-Gm-Message-State: ANoB5pkzvU1pkVx03ieDz7R5CsetkEyXgPwKz5+K7TJgSc34wSKYaqOU uwHKlgKVBj0ngnN3RruCxjc= X-Received: by 2002:a17:90b:2d8b:b0:202:f88d:587 with SMTP id sj11-20020a17090b2d8b00b00202f88d0587mr36177116pjb.232.1669291572617; Thu, 24 Nov 2022 04:06:12 -0800 (PST) Received: from hyeyoo ([114.29.91.56]) by smtp.gmail.com with ESMTPSA id s1-20020a625e01000000b0056cea9530b6sm1028976pfb.202.2022.11.24.04.06.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Nov 2022 04:06:11 -0800 (PST) Date: Thu, 24 Nov 2022 21:06:05 +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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 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. > 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 > Otherwise looks fine to me. -- Thanks, Hyeonggon