Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 90232C678D5 for ; Tue, 7 Mar 2023 20:10:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231489AbjCGUJr (ORCPT ); Tue, 7 Mar 2023 15:09:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229535AbjCGUJo (ORCPT ); Tue, 7 Mar 2023 15:09:44 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3B819BA71 for ; Tue, 7 Mar 2023 12:09:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678219739; 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=aTa3k5Nu5kG9KD5q86aaFluSTkM03P8RErYO6vqZrgw=; b=a+S5frqsy0xcjWd+zJfWlzo1o3Q3ZVPfsFEgmaOKSE/vMnt8s1tK1UwvtcpEZUWYeqUBP7 3b9vLy7ZTjLABj/8gxPpND2v+Oo5iQNmcj54tnoZpMUshl6KfoR05QezyDuyNX8yglbtk2 lpfpMuviefbpyXRI+KNXKxAnwCUTQrU= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-353-ehAYRET4MjCI1UEAKGa0dw-1; Tue, 07 Mar 2023 15:08:56 -0500 X-MC-Unique: ehAYRET4MjCI1UEAKGa0dw-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 21F643C0F675; Tue, 7 Mar 2023 20:08:55 +0000 (UTC) Received: from [10.22.9.63] (unknown [10.22.9.63]) by smtp.corp.redhat.com (Postfix) with ESMTP id EA5D2140EBF4; Tue, 7 Mar 2023 20:08:52 +0000 (UTC) Message-ID: Date: Tue, 7 Mar 2023 15:08:52 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 Subject: Re: [PATCH v3] sched: cpuset: Don't rebuild root domains on suspend-resume Content-Language: en-US To: Hao Luo , Qais Yousef Cc: Peter Zijlstra , Ingo Molnar , Juri Lelli , Steven Rostedt , tj@kernel.org, linux-kernel@vger.kernel.org, luca.abeni@santannapisa.it, claudio@evidence.eu.com, tommaso.cucinotta@santannapisa.it, bristot@redhat.com, mathieu.poirier@linaro.org, Dietmar Eggemann , cgroups@vger.kernel.org, Vincent Guittot , Wei Wang , Rick Yiu , Quentin Perret , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Sudeep Holla , Zefan Li , linux-s390@vger.kernel.org, x86@kernel.org References: <20230206221428.2125324-1-qyousef@layalina.io> From: Waiman Long In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/7/23 14:56, Hao Luo wrote: > On Mon, Feb 6, 2023 at 2:15 PM Qais Yousef wrote: >> Commit f9a25f776d78 ("cpusets: Rebuild root domain deadline accounting information") >> enabled rebuilding root domain on cpuset and hotplug operations to >> correct deadline accounting. >> >> Rebuilding root domain is a slow operation and we see 10+ of ms delays >> on suspend-resume because of that (worst case captures 20ms which >> happens often). >> >> Since nothing is expected to change on suspend-resume operation; skip >> rebuilding the root domains to regain the some of the time lost. >> >> Achieve this by refactoring the code to pass whether dl accoutning needs >> an update to rebuild_sched_domains(). And while at it, rename >> rebuild_root_domains() to update_dl_rd_accounting() which I believe is >> a more representative name since we are not really rebuilding the root >> domains, but rather updating dl accounting at the root domain. >> >> Some users of rebuild_sched_domains() will skip dl accounting update >> now: >> >> * Update sched domains when relaxing the domain level in cpuset >> which only impacts searching level in load balance >> * update sched domains when cpufreq governor changes and we need >> to create the perf domains >> >> Users in arch/x86 and arch/s390 are left with the old behavior. >> >> Debugged-by: Rick Yiu >> Signed-off-by: Qais Yousef (Google) >> --- > Hi Qais, > > Thank you for reporting this. We observed the same issue in our > production environment. Rebuild_root_domains() is also called under > cpuset_write_resmask, which handles writing to cpuset.cpus. Under > production workloads, on a 4.15 kernel, we observed the median latency > of writing cpuset.cpus at 3ms, p99 at 7ms. Now the median becomes > 60ms, p99 at >100ms. Writing cpuset.cpus is a fairly frequent and > critical path in production, but blindly traversing every task in the > system is not scalable. And its cost is really unnecessary for users > who don't use deadline tasks at all. The rebuild_root_domains() function shouldn't be called when updating cpuset.cpus unless it is a partition root. Is it? Cheers, Longman