Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp3630001rdg; Wed, 18 Oct 2023 00:44:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGAdAwNNJGUv6LsgIOmOKmIvtztZ1fDntKCmeX8vdWw5sZVjnopl83sUIy/a0PfNfqos9h7 X-Received: by 2002:a17:903:23c3:b0:1c7:398c:a437 with SMTP id o3-20020a17090323c300b001c7398ca437mr4044889plh.69.1697615093380; Wed, 18 Oct 2023 00:44:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697615093; cv=none; d=google.com; s=arc-20160816; b=XyFoUWoiiXc48az/Q8yzDMuPcmOK3iIunL8ECDbxbORKb9GPjgy6zOfkmG/jpdfazL hFwEcOR+h1oPk9HQNlq0tfY5/VswqbH4JZNYN/n1YFfb1/aZ0E9S3Cpydh9dBtJ+UfXw VCbyPCct1TbFWC7F1tQNABSFF5JIAktM0MN6vYFqkBT6ISbfcJYD31kvWtVehNl7+USc o+BWHDEVCWR9Z1EsleRWvjUPOYz8IeTCCWrnYnTJBTkTxhgusngtKxQ2qfa8I4fvhvJw SZUu9eRkOlUEuWfD483g62JWx+B6v/GkOJR6F31yJ3zWr1YfwHR22HsOdb1pyHIJcYi5 CJow== 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:mime-version:date :dkim-signature:message-id; bh=9bMgqpjKJctONHZa51iGAlmtZ2Iy4OZNrzOKRecYBwM=; fh=GnaRsSR8MqpoX6pqCGSBVPp037uG8jDLEugSOUr8blQ=; b=BMs6t0GGXeSaadDiHEExgqLuUcBxyu00n2IZvkB3w/uLcXZga5e8d1jZCr21O4xrN3 zpCssgEvcj9fEmUklcQFLQDVRVo//MBXzjMqoXQEBmPzQ+ladMOdvbsH7revOUE7rW6K hnl5+Zo/rVLY3syAu6mNvVDzwctdYEMjvQoLbweXwyoxTlfkajPeQED0cVaMy5zbgLXb pDbu1SjB2Gw0yiGvx+PAvWlxlqU8aInyP9oNtdHHmzGnXhNSOmOm6OLYfBJK5kfD24+q 5x/ecT06vbhvEy4LnXeMRTI/Pd/jW2Zzb/syUV90wOS0kCkNBAyUstcLf+RsbviK9hgI W5xQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=AnzxZLNE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id i10-20020a170902eb4a00b001c9ed124cd7si3413819pli.650.2023.10.18.00.44.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 00:44:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=AnzxZLNE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 9410C80BD77E; Wed, 18 Oct 2023 00:44:50 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229853AbjJRHol (ORCPT + 99 others); Wed, 18 Oct 2023 03:44:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229638AbjJRHok (ORCPT ); Wed, 18 Oct 2023 03:44:40 -0400 Received: from out-204.mta1.migadu.com (out-204.mta1.migadu.com [95.215.58.204]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27391B6 for ; Wed, 18 Oct 2023 00:44:38 -0700 (PDT) Message-ID: <8cff8994-28a3-4a7e-8a6e-217c4da49ca1@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1697615075; h=from:from: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; bh=9bMgqpjKJctONHZa51iGAlmtZ2Iy4OZNrzOKRecYBwM=; b=AnzxZLNEyZMWE71XrW9O12ISDXjmlBUDBvfft5mO1leMCK6hyuSW9SjQbr3rfOVLx+/VHp /VwVvNQQHyuHoJsRBXYoRfHR2Hub1OckrJ7JYlt8KHNYFHVKN1gQoXTp3n3vwhLyADfFSn QUxmRIuvnWh0LC1Bi/3Rr7/q3kJcsKA= Date: Wed, 18 Oct 2023 15:44:29 +0800 MIME-Version: 1.0 Subject: Re: [RFC PATCH 0/5] slub: Delay freezing of CPU partial slabs Content-Language: en-US To: Hyeonggon Yoo <42.hyeyoo@gmail.com> Cc: cl@linux.com, penberg@kernel.org, rientjes@google.com, iamjoonsoo.kim@lge.com, akpm@linux-foundation.org, vbabka@suse.cz, roman.gushchin@linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Chengming Zhou References: <20231017154439.3036608-1-chengming.zhou@linux.dev> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Chengming Zhou In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Wed, 18 Oct 2023 00:44:50 -0700 (PDT) On 2023/10/18 14:34, Hyeonggon Yoo wrote: > On Wed, Oct 18, 2023 at 12:45 AM wrote: >> 4. Testing >> ========== >> We just did some simple testing on a server with 128 CPUs (2 nodes) to >> compare performance for now. >> >> - perf bench sched messaging -g 5 -t -l 100000 >> baseline RFC >> 7.042s 6.966s >> 7.022s 7.045s >> 7.054s 6.985s >> >> - stress-ng --rawpkt 128 --rawpkt-ops 100000000 >> baseline RFC >> 2.42s 2.15s >> 2.45s 2.16s >> 2.44s 2.17s >> >> It shows above there is about 10% improvement on stress-ng rawpkt >> testcase, although no much improvement on perf sched bench testcase. >> >> Thanks for any comment and code review! > > Hi Chengming, this is the kerneltesting.org test report for your patch series. > > I applied this series on my slab-experimental tree [1] for testing, > and I observed several kernel panics [2] [3] [4] on kernels without > CONFIG_SLUB_CPU_PARTIAL. > > To verify that this series caused kernel panics, I tested before and after > applying it on Vlastimil's slab/for-next and yeah, this series was the cause. > > System is deadlocked on memory and the OOM-killer says there is a > huge amount of slab memory. So maybe there is a memory leak or it makes > slab memory grow unboundedly? Thanks for the testing! I can reproduce the OOM locally without CONFIG_SLUB_CPU_PARTIAL. I made a quick fix below (will need to get another better fix). The root cause is in patch-4, which wrongly put some partial slabs onto the CPU partial list even without CONFIG_SLUB_CPU_PARTIAL. So these partial slabs are leaked. diff --git a/mm/slub.c b/mm/slub.c index d58eaf8447fd..b7ba6c008122 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -2339,12 +2339,12 @@ static void *get_partial_node(struct kmem_cache *s, struct kmem_cache_node *n, } } +#ifdef CONFIG_SLUB_CPU_PARTIAL remove_partial(n, slab); put_cpu_partial(s, slab, 0); stat(s, CPU_PARTIAL_NODE); partial_slabs++; -#ifdef CONFIG_SLUB_CPU_PARTIAL if (!kmem_cache_has_cpu_partial(s) || partial_slabs > s->cpu_partial_slabs / 2) break; > > [1] https://git.kerneltesting.org/slab-experimental/ > [2] https://lava.kerneltesting.org/scheduler/job/127#bottom > [3] https://lava.kerneltesting.org/scheduler/job/131#bottom > [4] https://lava.kerneltesting.org/scheduler/job/134#bottom > >> >> Chengming Zhou (5): >> slub: Introduce on_partial() >> slub: Don't manipulate slab list when used by cpu >> slub: Optimize deactivate_slab() >> slub: Don't freeze slabs for cpu partial >> slub: Introduce get_cpu_partial() >> >> mm/slab.h | 2 +- >> mm/slub.c | 257 +++++++++++++++++++++++++++++++----------------------- >> 2 files changed, 150 insertions(+), 109 deletions(-) >> >> -- >> 2.40.1 >>