Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2131695rwl; Thu, 30 Mar 2023 06:30:14 -0700 (PDT) X-Google-Smtp-Source: AK7set8O04JHeQmb8KO7helviuQprpeucCBbM8OhhewaYKJbd0Qrrc2bWa7o2HBmM+gT1YrJgi0k X-Received: by 2002:a05:6a20:914b:b0:dc:e387:566b with SMTP id x11-20020a056a20914b00b000dce387566bmr24753331pzc.1.1680183014465; Thu, 30 Mar 2023 06:30:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680183014; cv=none; d=google.com; s=arc-20160816; b=Eoak+fH40S56cGLP8wKPo5wAGkQ/MIPSl6CeVOpuoUnuw1zkD4ZrznaJub+Lewh1Qe 8cHEkn43tHfZPlNbGGcdxdFBeQBbwey0da2cksECiyNbzRgvIv1XtxpBrbTQZk7/Q+4W vw6lFf5vcV1NKnTjuATNiMiRENfiobfHTqKAvmSwFUGAliM+YiN6rVitu6eGBliN4YIk enHCHZiBVDJ1xHg0uUr4W10nARjWYU09XF9Wxb/19B4kyed0mHJB5ty2z7YxX1g/lYYu K75lYd2e4lNpuXWfYHBaiNNAhxQUncFLKTkz3h/sM9SnVKHwsIR/F0+8a1WX8jZhDyn1 uk5Q== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=3wzkcoa7Mihtj9UNRxQh22SXDR3QABl+wSSlCghODgg=; b=fx1otG6tYRks+yEZQilzzLk2gxHjjJUFq2RaXzUVctNwg4ellFnh/4+1M49lYMGgMb 7ZndS+i9+Hv9QbpuIVrODsf/r34Xn9H5c7lOaLvrlelxfirh7R61Hh/LXkV2Ybeh6cRT KvXl5bIocVp9jCjKF5izgzL6LR/4xGd6xFJ+J/hECKQnho56RxGe5aW1FdLENvS9KGG9 5RlzTBQpT1SQ4RRMRaO17q/QunJe7rm/H8hhk7APqCFbxevLfXBhj9MLy+OqqO+0F0Wn 5utHZo37in7/62IHYWNxy1vpFA0FPIyX8qXHc1rP4eXme2JFAeCd/Bk0s4H/GHJ0TxEF RM9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=gvETP0ew; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s187-20020a632cc4000000b00502f237fc07si33876822pgs.657.2023.03.30.06.30.01; Thu, 30 Mar 2023 06:30:14 -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=@suse.com header.s=susede1 header.b=gvETP0ew; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231977AbjC3N3J (ORCPT + 99 others); Thu, 30 Mar 2023 09:29:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231998AbjC3N3E (ORCPT ); Thu, 30 Mar 2023 09:29:04 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85E92A5FE for ; Thu, 30 Mar 2023 06:28:54 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 15FC321A4E; Thu, 30 Mar 2023 13:28:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1680182933; h=from:from:reply-to: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=3wzkcoa7Mihtj9UNRxQh22SXDR3QABl+wSSlCghODgg=; b=gvETP0ewtc0Ul0ZpGOqUt9Yp3FS7/2Q0XqMw9CaX97ZRMz3tveUL7AOHe7jahtIcVRoeHP oXO228EQnaPtNCFbTD8sXDAbdHwiMtiyH+9O5eM9Mah6lg6Evz4V+m+g4blsQm2+V/Lr9s 4IG5CQxIeBNlxSc5enE6unLkLQU9nQs= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id E4FF01348E; Thu, 30 Mar 2023 13:28:52 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id b3m5NZSOJWTuCQAAMHmgww (envelope-from ); Thu, 30 Mar 2023 13:28:52 +0000 Date: Thu, 30 Mar 2023 15:28:52 +0200 From: Michal Hocko To: Marcelo Tosatti Cc: Frederic Weisbecker , Frederic Weisbecker , Andrew Morton , Leonardo Bras , Peter Zijlstra , Thomas Gleixner , Johannes Weiner , Roman Gushchin , Shakeel Butt , Muchun Song , LKML , linux-mm@kvack.org Subject: Re: [PATCH 1/2] sched/isolation: Add cpu_is_isolated() API Message-ID: References: <20230317134448.11082-1-mhocko@kernel.org> <20230317134448.11082-2-mhocko@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: 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_PASS 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 Wed 29-03-23 11:20:21, Marcelo Tosatti wrote: > On Tue, Mar 28, 2023 at 01:48:02PM +0200, Michal Hocko wrote: > > On Mon 27-03-23 07:24:54, Marcelo Tosatti wrote: > > > On Fri, Mar 24, 2023 at 11:35:35PM +0100, Frederic Weisbecker wrote: > > > > Le Sat, Mar 18, 2023 at 09:04:38AM +0100, Michal Hocko a ?crit : > > > > > On Fri 17-03-23 15:35:05, Marcelo Tosatti wrote: > > [...] > > > > > > Actually introducing cpu_is_isolated() seems fine, but it can call > > > > > > housekeeping_test_cpu(cpu, HK_TYPE_TICK) AFAICS. > > > > > > > > > > This is not really my area. Frederic, could you have a look please? > > > > > > > > The point is to have a function that tells if either nohz_full= or > > > > isolcpus=[domain] has been passed for the given CPU. > > > > > > > > Because I assumed that both would be interested in avoiding that flush > > > > noise, wouldn't it be the case? > > > > > > Yes, that is the case. But as a note: for the two main types of > > > configuration performed (one uses isolcpus=[domain] and the other > > > cgroups, for isolating processes) nohz_full= is always set. > > > > > > So just testing for nohz_full= would be sufficient (which perhaps would > > > make the code simpler). > > > > I do not see any mention about that assumption under Documentation/. > > Documentation/admin-guide/kernel-per-CPU-kthreads.rst > > SCHED_SOFTIRQ > ------------- > > Do all of the following: > > 1. Avoid sending scheduler IPIs to the CPU to be de-jittered, > for example, ensure that at most one runnable kthread is present > on that CPU. If a thread that expects to run on the de-jittered > CPU awakens, the scheduler will send an IPI that can result in > a subsequent SCHED_SOFTIRQ. > 2. CONFIG_NO_HZ_FULL=y and ensure that the CPU to be de-jittered > is marked as an adaptive-ticks CPU using the "nohz_full=" > boot parameter. This reduces the number of scheduler-clock > interrupts that the de-jittered CPU receives, minimizing its > chances of being selected to do the load balancing work that > runs in SCHED_SOFTIRQ context. Quite hidden and easy to miss if you are only aware of isolcpus. > > Is this a best practice documented anywhere or it just happens to be > > the case with workloads you deal with? > > Option 2. However Frederic seems interested in matching the exported > toggles with the known use-cases classes. > > For example, for this guide: > http://www.comfilewiki.co.kr/en/doku.php?id=comfilepi:improving_real-time_performance:index > > Using nohz_full= would be a benefit (and its not being currently set, > perhaps due to not knowing all the options?). > > http://www.comfilewiki.co.kr/en/doku.php?id=comfilepi:improving_real-time_performance:index > > > AFAIU the workloads for which disabling nohz_full= is a benefit are those > where the switching between nohz full mode and sched tick enabled mode > and vice-versa (which involve programming the local timer) happens > often and is therefore avoidable? For example switching between 1 > runnable task and more than 1 runnable task (and vice versa). The patch from Frederic is testing for both. You seem to be arguing to reduce the test and I still do not understand why. Sure some workloads (following the above) will likely use nohz_full= as well but does it make sense to build that expectation into the higher level logic? What is an actual benefit? -- Michal Hocko SUSE Labs