Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2583581rwl; Mon, 27 Mar 2023 02:12:48 -0700 (PDT) X-Google-Smtp-Source: AKy350aCdSjI8WhYnoRfheRCBBKV1RoPdU24Rlsg9ihbyQwq/xQ/+1iAX+JOI/ItvYbwmw2sCA9y X-Received: by 2002:aa7:d39a:0:b0:4fd:2b05:aa2 with SMTP id x26-20020aa7d39a000000b004fd2b050aa2mr12055661edq.42.1679908368749; Mon, 27 Mar 2023 02:12:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679908368; cv=none; d=google.com; s=arc-20160816; b=U15fkXU0o0wzqjiuDBQoe+O7snKEiY6yBdEwtqibmi+3Gn33LreH1JMPyjqyDgoGRv IaUcx7YDIBxzrcyFF+EBXUrsG3iNowaF1FS0vXyGe0Nql94aCGXfamG8Due3T8Kly01K Ex8/PrUVaYiGLu3MN8/y3VnAwcouv+NLqkw9dTvhG0IX833kW+LPuT7r/gt/cZVyUUA3 l666hozw3rn1rsaAf466FiXrHGEVqxK6Y8nFnvZbLgMDKcMATVMPdYBU3G98ciyVX4KA GfEFif2mFAk+kTLqHVcmaYyjnQpX6qfaSYoxRGSlEF6X8zTZtt0GtjWPknef8N1mNnb/ ySyg== 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=QJ/+S72sneQ1arByLzds1SxtxaeNSoR/H2lA4VdoWd4=; b=QfLLt9HQzdS/VvarES6posJGCGXlx8DUL8EFkoxmXUpPfsJltiLrbT+J3rFKMv1jL8 KfNH3ApA8wBfE+rZVdutjQrk0GDl00Q10C84ZjFoz4nsLrxOdLx/RovhqZ10vGGW/CaZ poOioHG6ZhHQU3FUOZ25C7iDGOJc4impuuKMn8dMjvL1ULTd+JTbK5gbfgbtho7x6X+T 5k5U/NGoAPCsVncYBMrHIUSLNHtaKH4q/EdLdwkgZoPH1L4ot4HrqtBtw+6F11eSwYrk ZjU/HUM0ehjdm1zReTTjR85Y1o/+TsgW/EtM20EbnYcBMk4XlZjw9vgRy8+9xKHItAzy uxGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=W7lU0SU8; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hs28-20020a1709073e9c00b0093defbd6287si6786872ejc.1038.2023.03.27.02.12.24; Mon, 27 Mar 2023 02:12:48 -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=@infradead.org header.s=casper.20170209 header.b=W7lU0SU8; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232739AbjC0JKZ (ORCPT + 99 others); Mon, 27 Mar 2023 05:10:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232814AbjC0JKF (ORCPT ); Mon, 27 Mar 2023 05:10:05 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E75B10CE for ; Mon, 27 Mar 2023 02:10:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=QJ/+S72sneQ1arByLzds1SxtxaeNSoR/H2lA4VdoWd4=; b=W7lU0SU8Hz3A3puErWzvo/6kE/ x27IoR58v3fDIhf3ItOASUCwZvt3xYobeAadGpnWuyknotoK7X8WgT+BmvYh9fx0jm7NyELof9HVf p0MoW7YFtdd126imBuDXAOUz2mRVkoGFsTtsohNEaQI4dTV1qC4RB6vaSo36wW+owFdi0wsPQb8lo tvF081afuhDTlE8vmtiQfwD7rZmZG7MxBrbJY22x1tiB5tyGxLFFtlHB9xGMFT1M2xC+NJ5UrDjeu Y8T4KnJbR6YLgPPzpg0sLbdUYWK/7rStUI4Y6p4G1ghihBc6PpxphJcMCoR0KcOonjak0G0ahsmYd Am2S+/Sw==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1pgirR-007GLa-EM; Mon, 27 Mar 2023 09:09:53 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id F08663001E5; Mon, 27 Mar 2023 11:09:51 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id B002E20F4A288; Mon, 27 Mar 2023 11:09:51 +0200 (CEST) Date: Mon, 27 Mar 2023 11:09:51 +0200 From: Peter Zijlstra To: Aaron Lu Cc: Mathieu Desnoyers , linux-kernel@vger.kernel.org Subject: Re: rq lock contention due to commit af7f588d8f73 Message-ID: <20230327090951.GA4253@hirez.programming.kicks-ass.net> References: <20230327080502.GA570847@ziqianlu-desk2> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230327080502.GA570847@ziqianlu-desk2> X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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 Mon, Mar 27, 2023 at 04:05:02PM +0800, Aaron Lu wrote: > Hi Mathieu, > > I was doing some optimization work[1] for kernel scheduler using a > database workload: sysbench+postgres and before I submit my work, I > rebased my patch on top of latest v6.3-rc kernels to see if everything > still works expected and then I found rq's lock became very heavily > contended as compared to v6.2 based kernels. > > Using the above mentioned workload, before commit af7f588d8f73("sched: > Introduce per-memory-map concurrency ID"), the profile looked like: > > 7.30% 0.71% [kernel.vmlinux] [k] __schedule > 0.03% 0.03% [kernel.vmlinux] [k] native_queued_spin_lock_slowpath > > After that commit: > > 49.01% 0.87% [kernel.vmlinux] [k] __schedule > 43.20% 43.18% [kernel.vmlinux] [k] native_queued_spin_lock_slowpath Unlike what the subject says, if it is due to that commit, then it's not rq lock but that new cid_lock thing. Can you frob init/Kconfig and make SCHED_MM_CID user configurable and disable it to confirm? (also, mathieu, when you do the below, you'll see it is in a weird spot) diff --git a/init/Kconfig b/init/Kconfig index 1fb5f313d18f..f2661f73f3dd 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -1042,7 +1042,8 @@ config RT_GROUP_SCHED endif #CGROUP_SCHED config SCHED_MM_CID - def_bool y + bool "RSEQ Concurrency ID" + default y depends on SMP && RSEQ config UCLAMP_TASK_GROUP