Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp5041257ybb; Tue, 24 Mar 2020 09:53:00 -0700 (PDT) X-Google-Smtp-Source: ADFU+vugwtE8Y7PWi/qqcec0VIvmgGIGjnEL0K5UDwkhiY+LZhG68KbD5481XipkG69PA2R8A1iu X-Received: by 2002:aca:210c:: with SMTP id 12mr3946496oiz.0.1585068779974; Tue, 24 Mar 2020 09:52:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585068779; cv=none; d=google.com; s=arc-20160816; b=yINNBBfbaukFZcifdAJCbbHvIs08Sh0dC9n2nGhUOkgNBcAl6jRckxmtNP8QZHWkQ2 CS3L7O4zd5hbDy4Zu5n7QXPmIVWEBOcz/FKcbiuVnhRfYjGNwCQw7pWxZz166R8pqZJq cKHvecUh+PWE21DWT7BHsFMrmSFjun1zg77/RxuxKkc4S2Kg9S//3Xq7Iaa0CpmriFRL Vpm0ee32FwKIj5PTVlYWEb127vL2PQS4w55gMKm9BjWHoRMMt2ArSgf5q5zxW8LZ/mB4 Sn9EOfJnS6JAwC7jnZsqyOb4pT3A1w2j7V4BZewoFoxQZjnhd/wabQOX6/m/qF4s25rF 2VbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=C9gMDFB2HJVjkxFZiVND++RiRLHVYSLveb/P83c2txc=; b=OGgxuPeIjDwjOL5SKeFwjpanjJB2Y1uscaKqy/x3Efa23rp5ehxxvIPG5JDGW/X1wa saujqEcpfCRWrRZOrswPQs58+p7tDcBwv3bBnxzqFobudgS0HpFnhCPNwYFDYHc02gx3 acjyTXM48rEV+xueb5a0HW2Zl7WXahmotZJYDBd79FUj9TnfycNbyl14+vhXSZnZZC9u XjY+HrhUK0E9XbqdjR7Mu1qFhM1IPskmFR1+2reiAB+DNYVGfSwX781JBQejbRXamnd0 kde03a7VFMlhXjGQizCDMA+FJHf4xSKgyP9NoPyEizBhInpwvYZc4+zi1ZaAkKuvOWJ+ XeTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=VEC+fdhP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h10si8803960oih.231.2020.03.24.09.52.47; Tue, 24 Mar 2020 09:52:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=VEC+fdhP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727581AbgCXQvH (ORCPT + 99 others); Tue, 24 Mar 2020 12:51:07 -0400 Received: from us-smtp-delivery-74.mimecast.com ([216.205.24.74]:23982 "EHLO us-smtp-delivery-74.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725767AbgCXQvH (ORCPT ); Tue, 24 Mar 2020 12:51:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585068665; 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=C9gMDFB2HJVjkxFZiVND++RiRLHVYSLveb/P83c2txc=; b=VEC+fdhPY3NLUkRend7ahE8cppIcmc0zKoMALKwffIr0T1YuiQce7GUMsbKwJ2TsecmWtR ek3mU0bO6myJXrH4uoRkkDDFqQ4K1nSc26fX9jsmKAaMQC4cn7K1Zz9WDvBmIqIfTXTSgj dkxGNKm0g3G2/NgiHZUjyYhBaGmq6xQ= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-339-oN5UDPahNBivlkgZxvvcjQ-1; Tue, 24 Mar 2020 12:51:00 -0400 X-MC-Unique: oN5UDPahNBivlkgZxvvcjQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E9805801E5C; Tue, 24 Mar 2020 16:50:58 +0000 (UTC) Received: from fuller.cnet (ovpn-116-9.gru2.redhat.com [10.97.116.9]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D2EDE5C1B2; Tue, 24 Mar 2020 16:50:57 +0000 (UTC) Received: by fuller.cnet (Postfix, from userid 1000) id 61FDC4198B3C; Tue, 24 Mar 2020 13:50:36 -0300 (-03) Date: Tue, 24 Mar 2020 13:50:36 -0300 From: Marcelo Tosatti To: Chris Friesen Cc: Thomas Gleixner , linux-kernel@vger.kernel.org, Christoph Lameter , Jim Somerville , Andrew Morton , Frederic Weisbecker , Peter Zijlstra Subject: Re: [PATCH v2] isolcpus: affine kernel threads to specified cpumask Message-ID: <20200324165036.GC28165@fuller.cnet> References: <20200323135414.GA28634@fuller.cnet> <87k13boxcn.fsf@nanos.tec.linutronix.de> <87imiuq0cg.fsf@nanos.tec.linutronix.de> <20200324152016.GA25422@fuller.cnet> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 24, 2020 at 09:56:26AM -0600, Chris Friesen wrote: > I hadn't been keeping up with all the changes to the "isolcpus" boot arg. > Given how it's been extended, I agree that it seems the logical place to > deal with this. Patch seems okay to me, but I've got a couple of nits in > the message portion. > > If I want to specify both no_kthreads and managed_irq it then something like > "isolcpus=managed_irq,no_kthreads,2-16" would work? Yes. > On 3/24/2020 9:20 AM, Marcelo Tosatti wrote: > > > > This is a kernel enhancement to configure the cpu affinity of kernel > > threads via kernel boot option isolcpus=no_kthreads,, > > https://github.com/torvalds/linux/blob/master/Documentation/admin-guide/kernel-parameters.txt > says that "isolcpus" is deprecated. Are we un-deprecating it? Or is it > only really deprecated for the "domain" option? I don't think its deprecated (see the recent inclusion of managed_irq, and the suggestion from Thomas to extend it). Will send another patch to remove that sentence. > > When this option is specified, the cpumask is immediately applied upon > > thread launch. This does not affect kernel threads that specify cpu > > and node. > > > > This allows CPU isolation (that is not allowing certain threads > > to execute on certain CPUs) without using the isolcpus=domain parameter, > > making it possible to enable load balancing on such CPUs > > during runtime (see > > I think you're missing the rest of the sentence here. Right. > > Note-1: this is based off on Wind River's patch at > > https://github.com/starlingx-staging/stx-integ/blob/master/kernel/kernel-std/centos/patches/affine-compute-kernel-threads.patch > > > > Difference being that this patch is limited to modifying > > kernel thread cpumask: Behaviour of other threads can > > be controlled via cgroups or sched_setaffinity. > > > > Note-2: MontaVista's patch was based off Christoph Lameter's patch at > > https://lwn.net/Articles/565932/ with the only difference being > > the kernel parameter changed from kthread to kthread_cpus. > > Wind River, not MontaVista. I know all us embedded linux folks look the > same... Doh^2. > > > > > Signed-off-by: Marcelo Tosatti > > > > --- > > > > v2: use isolcpus= subcommand (Thomas Gleixner) > > > > Documentation/admin-guide/kernel-parameters.txt | 8 ++++++++ > > include/linux/cpumask.h | 5 +++++ > > include/linux/sched/isolation.h | 1 + > > init/main.c | 1 + > > kernel/cpu.c | 13 +++++++++++++ > > kernel/kthread.c | 4 ++-- > > kernel/sched/isolation.c | 6 ++++++ > > 7 files changed, 36 insertions(+), 2 deletions(-) > > > > diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt > > index c07815d230bc..7318e3057383 100644 > > --- a/Documentation/admin-guide/kernel-parameters.txt > > +++ b/Documentation/admin-guide/kernel-parameters.txt > > @@ -1959,6 +1959,14 @@ > > the CPU affinity syscalls or cpuset. > > begins at 0 and the maximum value is > > "number of CPUs in system - 1". > > + When using cpusets, use the isolcpus option no_kthreads > > + to avoid creation of kernel threads on isolated CPUs. > > + > > + no_kthreads > > + Adjust the CPU affinity mask of unbound kernel threads to > > + not contain CPUs on the isolated list. This complements > > + the isolation provided by the cpusets mechanism described > > + above. > > It also complements the "managed_irq" option below. In many cases I'd > expect the same set of CPUs to be isolated from both irqs and kernel > threads. > > > Chris Agree, will fix in -v3.