Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1841219pxb; Fri, 5 Feb 2021 02:51:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJy2MM2QIgL0bKESlUyMoUEBoVjYZx0NdhP6LTpxqal6tlQkQGO2hcLP2ht6RlEqfVTJ5x/B X-Received: by 2002:a17:906:43d7:: with SMTP id j23mr3451126ejn.519.1612522317141; Fri, 05 Feb 2021 02:51:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612522317; cv=none; d=google.com; s=arc-20160816; b=dvHO57Y3feMRFOrBbD8bgMrmn1wbadYbBY931TEjQswo0ALT1rWmPQMHmrC19T7iu4 P0KYDUxdIHbzw2RQ2keO8UFx7qzIg9v0KoeqFFqm2zI1Kor2XXZMs54+Ryz/ki2TKRrV akicgR81eu+/ARGmIyNM6gIv7xS51Xyby9Yol+mN+dJfUU3XCaCLI60zl8HwzAH5ef2d 6b8lb7Fut/oKZWFARR2wm8NXQ+SI0hlP+/eYlz/WBmvoCR9/3gNIZhGwZvhVMyqkJLU4 z8ig8qUvLAQ4oLcbCs1WsfMEJDrWRLvsqZkLVi8mPIJDqUDJxud/776+KywDJSGX7Nfc byng== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=AZTrsdIgEHD7KFjMJJWY83JzN98tigxEzZxfCzeUzSI=; b=JHNJToiv8l94GpiJSdmP855XpzuMBnrqgNGkAcp//jJs0IfdqMDunqnLyR5SRzgpo3 /xfUjOtTA48dPuque+Lcsh7sYJ5xRKnMWUOtAnw63Zpw5tte6adHCw3fQX4ylCbR8DS8 0iidRL0Q8ezUaxORsvz4d0QlS5U/3FH3AL842YcbURBWvwjw5fEpu9KOzuh7Qatzl4o8 0DdVksI5xVG5BS0LN4b69qx3zoCI5auFeODxlmo7iqh/73tSbrlSADG8PSXh+PUpWJRr oktVaAnpMDdwNIUwps2Pe5+uEBx72heAvB/7UxxVblrhAqcCHtrD7bw40G2v2DArQ+Kb GZkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=merlin.20170209 header.b=L3nRt+3T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cm20si4701092edb.371.2021.02.05.02.51.31; Fri, 05 Feb 2021 02:51:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=merlin.20170209 header.b=L3nRt+3T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231724AbhBEKsK (ORCPT + 99 others); Fri, 5 Feb 2021 05:48:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229763AbhBEKoy (ORCPT ); Fri, 5 Feb 2021 05:44:54 -0500 Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70A41C061786 for ; Fri, 5 Feb 2021 02:44:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=AZTrsdIgEHD7KFjMJJWY83JzN98tigxEzZxfCzeUzSI=; b=L3nRt+3TAeaRteiVZDzGWTUV8h 7v0OHOuv/hp1rSAtqPpcvda/thx4Kk4sy5tSZXPFbZ0f+9YjyXwZxTBVUYF3jvAnm5icdYINefK6C 1mqKuOqODiTDEYZ3sOOrzr51DqaFj3cIgwlFdLTQYZcDJCXSDitLtJs+/bZK6pgSvsdz9HlOR1ZEP bGhM4qA6VYrsVm/UYLm7qE9qlKIqGzXkw4D2jBAWZ83p0mqswUPrCop92bWPUuw+M+5uQKWwHItvv PyD4GNpkz7x4Et+7y4Zgjfz/nmTMPQ+yxDBxCrr0kcOwriYnGNwEMJTPTtLtsJxL4Aay8UfJ4XBqg U4mope0g==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1l7yZx-0001nm-K0; Fri, 05 Feb 2021 10:43:09 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 9FBCD3013E5; Fri, 5 Feb 2021 11:43:03 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 7DC112BBE1CB0; Fri, 5 Feb 2021 11:43:03 +0100 (CET) Date: Fri, 5 Feb 2021 11:43:03 +0100 From: Peter Zijlstra To: Chris Hyser Cc: "Joel Fernandes (Google)" , Nishanth Aravamudan , Julien Desfossez , Tim Chen , Vineeth Pillai , Aaron Lu , Aubrey Li , tglx@linutronix.de, linux-kernel@vger.kernel.org, mingo@kernel.org, torvalds@linux-foundation.org, fweisbec@gmail.com, keescook@chromium.org, kerrnel@google.com, Phil Auld , Valentin Schneider , Mel Gorman , Pawan Gupta , Paolo Bonzini , vineeth@bitbyteword.org, Chen Yu , Christian Brauner , Agata Gruza , Antonio Gomez Iglesias , graf@amazon.com, konrad.wilk@oracle.com, dfaggioli@suse.com, pjt@google.com, rostedt@goodmis.org, derkling@google.com, benbjiang@tencent.com, Alexandre Chartre , James.Bottomley@hansenpartnership.com, OWeisse@umich.edu, Dhaval Giani , Junaid Shahid , jsbarnes@google.com, Ben Segall , Josh Don , Hao Luo , Tom Lendacky Subject: Re: [PATCH v10 2/5] sched: CGroup tagging interface for core scheduling Message-ID: References: <20210123011704.1901835-1-joel@joelfernandes.org> <20210123011704.1901835-3-joel@joelfernandes.org> <94bb9424-008e-6d3c-dff6-a1329c16551f@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <94bb9424-008e-6d3c-dff6-a1329c16551f@oracle.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 04, 2021 at 03:52:55PM -0500, Chris Hyser wrote: > A second complication was a decision that new processes (not threads) do not > inherit their parents cookie. Thus forking is also not a means to share a > cookie. Basically with a "from-only" interface, the new task would need to > be modified to call prctl() itself. From-only also does not allow for > setting a cookie on an unmodified already running task. This can be fixed by > providing both a "to" and "from" sharing interface that allows helper > programs to construct arbitrary configurations from unmodified programs. Do we really want to inhibit on fork() or would exec() be a better place? What about those applications that use fork() based workers? > > Also, how do I set a unique cookie on myself with this interface? > > The v10 patch still uses the overloaded v9 mechanism (which as mentioned > above is if two tasks w/o cookies share a cookie they get a new shared > unique cookie). Yes, that is clearly an inconsistency and kludgy. The > mechanism is documented in the docs, but clearly not obvious from the I've not seen a document so far (also, I'm not one to actually read documentation, much preferring comments and Changelogs). > So based on the above, how about we add a "create" to pair with "clear" and > call it "create" vs "set" since we are creating a unique opaque cookie > versus setting a particular value. And as mentioned, because one can't > specify a cookie directly but only thru sharing relationships, we need both > "to" and "from" to make it completely usable. > > So we end up with something like this: > PR_SCHED_CORE_CREATE -- give yourself a unique cookie > PR_SCHED_CORE_CLEAR -- clear your core sched cookie > PR_SCHED_CORE_SHARE_FROM -- get their cookie for you > PR_SCHED_CORE_SHARE_TO -- push your cookie to them I'm still wondering why we need _FROM/_TO. What exactly will we miss with just _SHARE ? current arg_task -EDAFT current gets cookie arg_task gets cookie -EDAFTER (I have a suspicion, but I want to see it spelled out). Also, do we wants this interface to be able to work on processes? Things like fcntl(F_SETOWN_EX) allow you to specify a PID type. > An additional question is should the inheritability of a process' cookie be > configurable? The current code gives the child process their own unique > cookie if the parent had a cookie. That is useful in some cases, but many > other configurations could be made much easier with inheritance. What was the argument for not following the traditional fork() semantics and inheriting everything?