Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp12051934rwd; Fri, 23 Jun 2023 00:15:30 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4dS3xBqyja5wUiGjcoOh3akU7LX+oMe9z1dlWgoZqiA4rlGGMkrnVmoiLjSe2vwJWgAy9s X-Received: by 2002:a05:6a20:8f06:b0:122:a808:dbbe with SMTP id b6-20020a056a208f0600b00122a808dbbemr12157244pzk.29.1687504530654; Fri, 23 Jun 2023 00:15:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687504530; cv=none; d=google.com; s=arc-20160816; b=GvYFuqlQ76VwZz1FxUEAEh8yojQhQdVkPOZx+q+SOHVUZttxzOSi2QwlcrUw6yMOOK gkXXdRVJaNBJUe/rxQRcVYS4kRQXdbR9VyTWzjUcFoLH3s7fXEAgmOEOSkfWySSU+Utt +09W5QJwCJXv1CmSd/2MdktVVUz8pnU8HdsT1vYqN95zGKvQj5IwXrtNJ5V74+XFVTQS ZKFKF2t/dUmm3/KVQBYNBHk7weLF907QSvTFWCowZ6AqTKI49MN38L4FBSyDSRIWtz9c Fz8g2X5eDMkrUYZM7EhdpcSmLC2pOHALr80MQfnbfnxkZR54ZirWVRNu10A5bvIEBmCD 2UDw== 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:dkim-signature :dkim-signature:date; bh=EXDCmApZYIXhauiHZvO9b8B9cF94NGTvK79mRRcojkM=; b=m5PDlIqEPRBTQUYE9TeOvziUSP0EQys11Z/1FReeNRCdmEK3Wm+xRGIVv1/Vxwd9Tq c/Yo6VHRMzxOnm7Cyja1aymE1a1HIIggHPfn/5MobBPCXefgnu5jQWvujUajg99wIkqQ 50siXxyw8Y39N7GvfSh5CbSf2nTcHG+EUu7aJBLa+UcL6MdaW8l1HEM8hel2dLE5xZaV L+Y0yxXd1YUycws0/La3vVLrMxeH1C2IF9KLuPyHP5/CnKhrtxI9NUF7adwBj2BA+0xI qBveljnv0noZKuw5K7LvP9Rb9jlpx6VJoScNxDR43l79gyY1dOWKC2Nd0JzUdJi37/3x +Ppw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=UNVu1Q6J; dkim=neutral (no key) header.i=@linutronix.de header.b=ek25QD0f; 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=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 141-20020a630193000000b005538d402ad9si8545419pgb.589.2023.06.23.00.15.18; Fri, 23 Jun 2023 00:15:30 -0700 (PDT) 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=@linutronix.de header.s=2020 header.b=UNVu1Q6J; dkim=neutral (no key) header.i=@linutronix.de header.b=ek25QD0f; 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=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230280AbjFWGwl (ORCPT + 99 others); Fri, 23 Jun 2023 02:52:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230010AbjFWGwi (ORCPT ); Fri, 23 Jun 2023 02:52:38 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E0E71FF2; Thu, 22 Jun 2023 23:52:38 -0700 (PDT) Date: Fri, 23 Jun 2023 08:52:34 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1687503156; 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: in-reply-to:in-reply-to:references:references; bh=EXDCmApZYIXhauiHZvO9b8B9cF94NGTvK79mRRcojkM=; b=UNVu1Q6Je/RntFqUbMDzihb0H0rxQbrISystMkb+ZcndUfbErA78A0J5qftymTU8t+0FA/ sPxPoqtR5IcGktjuKDvzr5RthdYwT9W/8KJnNVBtxhW6ltQERmYE4/lgg2BkHOvxyBdODh 2OnVhcJxHI49uCCCiUTgRD9Vnksg8r9RjfD+jg9TpIugv8WnCNibUwzpMTYvivgLxbjOko Cno13VbApcdL1GA6/5LuvZ0S257s+7Y2V00V/MArQf0u/UNjjJX4urXyS4QpAis1b/cIao 26p/WS9gRF6nPz2BHchhRc0WY2k/scU187ppAoEoH9AceADjISh9ycuP8Dn6OA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1687503156; 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: in-reply-to:in-reply-to:references:references; bh=EXDCmApZYIXhauiHZvO9b8B9cF94NGTvK79mRRcojkM=; b=ek25QD0fgBtQBhg0cKoqK4zFNR/Y8XwIGXF/xeSzp8EaHSObOrDgwmSyfFGU5WfjEL/0SE M5yFPBZmNvVQZTCA== From: Sebastian Andrzej Siewior To: Mathieu Desnoyers Cc: John Johansen , Swapnil Sapkal , Peter Zijlstra , linux-kernel@vger.kernel.org, linux-tip-commits@vger.kernel.org, Aaron Lu , x86@kernel.org, Andrew Morton , Thomas Gleixner Subject: Re: [tip: sched/core] sched: Fix performance regression introduced by mm_cid Message-ID: <20230623065234.ci6_7ob6@linutronix.de> References: <168214940343.404.10896712987516429042.tip-bot2@tip-bot2> <09e0f469-a3f7-62ef-75a1-e64cec2dcfc5@amd.com> <20230620091139.GZ4253@hirez.programming.kicks-ass.net> <44428f1e-ca2c-466f-952f-d5ad33f12073@amd.com> <3e9eaed6-4708-9e58-c80d-143760d6b23a@efficios.com> <6c693e3b-b941-9acf-6821-179e7a7fe2b8@efficios.com> <287c33e1-acb7-62db-7267-227cbcc54707@efficios.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <287c33e1-acb7-62db-7267-227cbcc54707@efficios.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham 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 2023-06-22 10:33:13 [-0400], Mathieu Desnoyers wrote: > > What was fundamentally wrong with the per-cpu caches before commit > df323337e50 other than being non-RT friendly ? Was the only purpose of that > commit to reduce the duration of preempt-off critical sections, or is there > a bigger picture concern it was taking care of by introducing a global pool > ? There were memory allocations within preempt-disabled sections introduced by get_cpu_ptr(). This didn't fly on PREEMPT_RT. After looking at this on 2 node, 64 CPUs box I didn't get anywhere near complete usage of the allocated buffers per-CPU buffers. It looked wasteful. Based on my testing back then, it looked sufficient to use a global buffer. > Introducing per-cpu memory pools, dealing with migration by giving entries > back to the right cpu's pool, taking into account the cpu the entry belongs > to, and use a per-cpu/lock-free data structure allowing lock-free push to > give back an entry on a remote cpu should do the trick without locking, and > without long preempt-off critical sections. > > The only downside I see for per-cpu memory pools is a slightly larger memory > overhead on large multi-core systems. But is that really a concern ? Yes, if the memory is left unused and can't be reclaimed if needed. > What am I missing here ? I added (tried to add) an people claimed that the SLUB allocated got better over the years. Also on NUMA systems it might be better to use it since the memory is NUMA local. The allocation is for 8KiB by default. Is there a test-case/ benchmark I could try this vs kmalloc()? > Thanks, > > Mathieu Sebastian