Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp1136024rdg; Fri, 13 Oct 2023 11:13:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEXSXYM1PZaK/ariD4ValXMuStA9/MIw26N2pZUH6xCEf5FKCWJ6MVtRw6oXWv2/pdr+drA X-Received: by 2002:a17:903:230a:b0:1c7:7e00:8075 with SMTP id d10-20020a170903230a00b001c77e008075mr34043304plh.66.1697220789565; Fri, 13 Oct 2023 11:13:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697220789; cv=none; d=google.com; s=arc-20160816; b=E9MLMPOrreAnB15BJ6brTYMoNidTddKNPbyww/tGG6qXbiyERhPPSpdMvkomh6GRog tL+OT6jARneJ9ytMPAzSK6yDxjaASG+bxhBj3PDkaWuDYrnclhP3IAEb2m8YGQ5w2Y+E uQl9ACUWE0D3hdE/exuWJIHcxf5whd3FUboDLNoX0BoeI3IFrV3BfAdYExtaDdy36OBd wG5xAiOUtJnJgjMrY2iaWAenKC/8dLB4L9XsZSRenFS4/sk+z3CWPjRXVimaGE57u4qd 9vFeL/nX44tIYZZHn4DWbOnV86cMgT5dW0YlmNr5vUKDABiyv/YefY+iuGm8UrotdRIZ TfeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=XIlRT028Oilu2T1armBjKk281LICHF+uokOf7ejKB88=; fh=WtChsC+0EI+1/eSiIgFQ5D1guPsE7RYkY8dznzSoQyw=; b=Dt2Lj9obFXQEkFnyyAfHj4gf4ONEM3ohumM6uiJgJNiM2QFFF665RLk8KrQYISsUR+ xt90Zi2td1PXLfWwdP6K0mizBAZwsJ6HBbTtHrWtiSpHRBn+6sWAUFpLDNIqyEjuWpxW yRqxnjDJfX5xCWI55QIVuEywF5phYL7nkEPQn9pzSqNuiC4r017zA5IHchdBuJaqOeTz lMXGBpbwz0jyLDJIYZQw/dUZfrBAm2rmNLvbb/ybUaExURPjSwfccyPIxKabEs8DmNX6 N0sVTH2ZF2Pn+H5aE+WCKN1pOI3xpE9KilZ334cxzAJ2W+6H60FOgsZy3ehoTm20ATZO vyCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="Ng3wW6/7"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id h6-20020a170902748600b001c3e9170068si4636751pll.61.2023.10.13.11.13.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 11:13:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="Ng3wW6/7"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 29CAB8301484; Fri, 13 Oct 2023 11:13:01 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231447AbjJMSMm (ORCPT + 99 others); Fri, 13 Oct 2023 14:12:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50836 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231336AbjJMSMl (ORCPT ); Fri, 13 Oct 2023 14:12:41 -0400 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 13D4D91 for ; Fri, 13 Oct 2023 11:11:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697220715; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=XIlRT028Oilu2T1armBjKk281LICHF+uokOf7ejKB88=; b=Ng3wW6/7ZrJ9rc4tRm5VYgk78GL5Ouk0eTcrQK+TOEmblSa1CPj0OmKh2RsrzbE+A6KWq+ pBEMYRMGkPNy3f+a2YzDiKsHV4e8VjD/9MvYsasRxwBVzD4Ns3R0VDcuJU9B11+2KtoprF VctEgwsp4VGz+mKcCSr5cTrPSRQYdAg= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-41-AhnJ3bsNPlSj1UTHtQz4mg-1; Fri, 13 Oct 2023 14:11:48 -0400 X-MC-Unique: AhnJ3bsNPlSj1UTHtQz4mg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3575F88B7A0; Fri, 13 Oct 2023 18:11:48 +0000 (UTC) Received: from llong.com (unknown [10.22.17.138]) by smtp.corp.redhat.com (Postfix) with ESMTP id 87F7C20296DB; Fri, 13 Oct 2023 18:11:47 +0000 (UTC) From: Waiman Long To: Tejun Heo , Zefan Li , Johannes Weiner , Jonathan Corbet , Lai Jiangshan , Shuah Khan Cc: cgroups@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Waiman Long Subject: [PATCH-cgroup 0/4] cgroup/cpuset: Improve CPU isolation in isolated partitions Date: Fri, 13 Oct 2023 14:11:18 -0400 Message-Id: <20231013181122.3518610-1-longman@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,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 groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Fri, 13 Oct 2023 11:13:01 -0700 (PDT) Isolated cpuset partition can currently be created to contain an exclusive set of CPUs not used in other cgroups and with load balancing disabled to reduce interference from the scheduler. The main purpose of this isolated partition type is to dynamically emulate what can be done via the "isolcpus" boot command line option, specifically the default domain flag. One effect of the "isolcpus" option is to remove the isolated CPUs from the cpumasks of unbound workqueues since running work functions in an isolated CPU can be a major source of interference. Changing the unbound workqueue cpumasks can be done at run time by writing an appropriate cpumask without the isolated CPUs to /sys/devices/virtual/workqueue/cpumask. So one can set up an isolated cpuset partition and then write to the cpumask sysfs file to achieve similar level of CPU isolation. However, this manual process can be error prone. This patch series implements automatic exclusion of isolated CPUs from unbound workqueue cpumasks when an isolated cpuset partition is created and then adds those CPUs back when the isolated partition is destroyed. There are also other places in the kernel that look at the HK_FLAG_DOMAIN cpumask or other HK_FLAG_* cpumasks and exclude the isolated CPUs from certain actions to further reduce interference. CPUs in an isolated cpuset partition will not be able to avoid those interferences yet. That may change in the future as the need arises. Waiman Long (4): workqueue: Add workqueue_unbound_exclude_cpumask() to exclude CPUs from wq_unbound_cpumask selftests/cgroup: Minor code cleanup and reorganization of test_cpuset_prs.sh cgroup/cpuset: Keep track of CPUs in isolated partitions cgroup/cpuset: Take isolated CPUs out of workqueue unbound cpumask Documentation/admin-guide/cgroup-v2.rst | 10 +- include/linux/workqueue.h | 2 +- kernel/cgroup/cpuset.c | 237 +++++++++++++----- kernel/workqueue.c | 42 +++- .../selftests/cgroup/test_cpuset_prs.sh | 209 +++++++++------ 5 files changed, 350 insertions(+), 150 deletions(-) -- 2.39.3