Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp91451ybl; Tue, 27 Aug 2019 16:25:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqx9Lot/ySMefj0nB3mnOAN8DfmXbMAJUPJDB9d5phZfTHxfApGjG1pG4a/uyrCuGv5xL2Tl X-Received: by 2002:a62:31c3:: with SMTP id x186mr1145973pfx.97.1566948330990; Tue, 27 Aug 2019 16:25:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566948330; cv=none; d=google.com; s=arc-20160816; b=E+5BWX/fz4fYHwsLCXea/Mf9brlSELvKCYjqAlK3p9kg1pm4f5xXq+C6hYS9MeqCNl y7aFk+rN0lRCHneES5a7RZphM2u9JfFF9joYNJSVhOsptxNK6Hy6vKfYGF44Vkvz0LzE KZxXR2dd+wvWG2m+RcZ7h81BPDum1W1v7xe7dR/AyX0UCtLuvj6NV1YDSQfvuNit218s Zkh76tzT/bdzNbw3FknjFtHuy32sH8PkvjBBFLBcLfoMJ8rN9wk4xIPpZc6AH/lMqwCY r+iL5+7VRShIxv3Ob521UeMvDo5gPcoMxA4nh4PZ0YtRUj6CUylUmlWJ/xuYauEXFT9V /IXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=cHg8GFr+9ZLzMMJHsvNHHov8vbKz3Whz26E/ZLxuKA8=; b=vhZuCnmqbhl1ghxqm2iPa51gowwYgrogOiKhX4eLX/qdzVvwMRrCBNW6QqBXTAGRFn vhWEQl4LtMXvA/BdkL28x+EGqvO5c4GmUAEqJei0RqdTRuOYq0XHtb+gIaeZUS+NHxVR YL004D/Z2dbj3KoCLfgh2CNaZAYC7BJL4n6MEHD3iEiwIC47xMZ7fNBvGicaVNFYp+3j gXUqny0/9R9YFLIeW9+/Bd9Pzl/m8uCUKnFx0OV8TB60WjSb+zAncNZQAQru3ykgEWcJ wh15PbiFxA7leTLnC1VSTGcH+TfrCGr1lP8+IPC9YmV41PfzjIi5Hi5czZC7S8MpmuDA QvKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=iX+HDWfm; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f8si631582pgi.191.2019.08.27.16.25.12; Tue, 27 Aug 2019 16:25:30 -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=@gmail.com header.s=20161025 header.b=iX+HDWfm; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726096AbfH0XYT (ORCPT + 99 others); Tue, 27 Aug 2019 19:24:19 -0400 Received: from mail-lj1-f195.google.com ([209.85.208.195]:45471 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725997AbfH0XYT (ORCPT ); Tue, 27 Aug 2019 19:24:19 -0400 Received: by mail-lj1-f195.google.com with SMTP id l1so792360lji.12 for ; Tue, 27 Aug 2019 16:24:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=cHg8GFr+9ZLzMMJHsvNHHov8vbKz3Whz26E/ZLxuKA8=; b=iX+HDWfmnaBb46CDRKHFXgE++7V892uyzQG2a2Arn8P7n3x1TVmXI1UBDIOxvNoVsZ vTvkURufC5eQN/hJlhLxs6BDYLZ0RHg6A2x+e4YRZ4c6vswP50JqKB9rBpeTZF4tHN7w DDEem62jlZZ7rWjYmqKbDJg0Q2BS+F8b4Lr2E6wFwXCf9kkWqpzGu2oy3dTPgGULBFk8 LL2zCJpX2GYXqA387DlXwohraUo74Wotv8dMoSnQbAFW4zEr/wGExZDhBGr8jLGEiB+6 RleqUUoy+AX2bzmTFqwtY0tPCGwrLGMV8LdMx+uM2reGhqj/OeJ3+OZ2+/akdcsNjuys QM3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=cHg8GFr+9ZLzMMJHsvNHHov8vbKz3Whz26E/ZLxuKA8=; b=UusF4JWSxEiYJlVFbZW39m+ZQsqpcw15zNnxJA+vYmWNfg7/VBUQPoQGgJE4FFQCVI OW/7ZRpycKjAWoKszlVZiksRCIjA6a9hdg0oTc59RZEORkhbUY91Ufg1P7y60pz5NTpM zIoxcpaX1BcPtZY/kRw7ooPqIfxbzS/nGBgI4dDNglphxGdLPPoqmCSPVOiIeDodzW5k jnotGzoONF25sfxHhAEJUiQbHJUQ445DbE7WBWtcoZtydZuf8xd8OdvXDkd0RLRy+BYq IshtDRoouxvIMGJbt0tHop+WWkF7Sqg6rnY/vWr1Q2iw/tzDB2Oo5cfId/FtuzukEYkp PjRw== X-Gm-Message-State: APjAAAXK4RScUY2WaQoultAqZwwSNAoIbFjGiw6o6HyXupI/fOAev8+B LFlvN1lvekmdnGyeWyiep+8CtGfFRlcn7Ak9hX5gn7LP X-Received: by 2002:a2e:81c3:: with SMTP id s3mr415016ljg.70.1566948257736; Tue, 27 Aug 2019 16:24:17 -0700 (PDT) MIME-Version: 1.0 References: <20190827211417.snpwgnhsu5t6u52y@srcf.ucam.org> In-Reply-To: <20190827211417.snpwgnhsu5t6u52y@srcf.ucam.org> From: Aubrey Li Date: Wed, 28 Aug 2019 07:24:06 +0800 Message-ID: Subject: Re: [RFC PATCH v3 00/16] Core scheduling v3 To: Matthew Garrett Cc: Vineeth Remanan Pillai , Nishanth Aravamudan , Julien Desfossez , Peter Zijlstra , Tim Chen , Ingo Molnar , Thomas Gleixner , Paul Turner , Linus Torvalds , Linux List Kernel Mailing , Subhra Mazumdar , =?UTF-8?B?RnLDqWTDqXJpYyBXZWlzYmVja2Vy?= , Kees Cook , Greg Kerr , Phil Auld , Aaron Lu , Valentin Schneider , Mel Gorman , Pawan Gupta , Paolo Bonzini Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 28, 2019 at 5:14 AM Matthew Garrett wrote: > > Apple have provided a sysctl that allows applications to indicate that > specific threads should make use of core isolation while allowing > the rest of the system to make use of SMT, and browsers (Safari, Firefox > and Chrome, at least) are now making use of this. Trying to do something > similar using cgroups seems a bit awkward. Would something like this be > reasonable? Having spoken to the Chrome team, I believe that the > semantics we want are: > > 1) A thread to be able to indicate that it should not run on the same > core as anything not in posession of the same cookie > 2) Descendents of that thread to (by default) have the same cookie > 3) No other thread be able to obtain the same cookie > 4) Threads not be able to rejoin the global group (ie, threads can > segregate themselves from their parent and peers, but can never rejoin > that group once segregated) > > but don't know if that's what everyone else would want. > > diff --git a/include/uapi/linux/prctl.h b/include/uapi/linux/prctl.h > index 094bb03b9cc2..5d411246d4d5 100644 > --- a/include/uapi/linux/prctl.h > +++ b/include/uapi/linux/prctl.h > @@ -229,4 +229,5 @@ struct prctl_mm_map { > # define PR_PAC_APDBKEY (1UL << 3) > # define PR_PAC_APGAKEY (1UL << 4) > > +#define PR_CORE_ISOLATE 55 > #endif /* _LINUX_PRCTL_H */ > diff --git a/kernel/sys.c b/kernel/sys.c > index 12df0e5434b8..a054cfcca511 100644 > --- a/kernel/sys.c > +++ b/kernel/sys.c > @@ -2486,6 +2486,13 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3, > return -EINVAL; > error = PAC_RESET_KEYS(me, arg2); > break; > + case PR_CORE_ISOLATE: > +#ifdef CONFIG_SCHED_CORE > + current->core_cookie = (unsigned long)current; Because AVX512 instructions could pull down the core frequency, we also want to give a magic cookie number to all AVX512-using tasks on the system, so they won't affect the performance/latency of any other tasks. This could be done by putting all AVX512 tasks into a cgroup, or by AVX512 detection the following patch introduced. https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?id=2f7726f955572e587d5f50fbe9b2deed5334bd90 Thanks, -Aubrey