Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp302482pxu; Tue, 1 Dec 2020 11:38:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJxeZ2hrkZqTRmQmm4Qxz6hECKjzuvbzp2JdrdpnPjHLdpfdkDw2odmMua55yR/bmPNFZY2J X-Received: by 2002:a17:906:3b56:: with SMTP id h22mr764499ejf.491.1606851499855; Tue, 01 Dec 2020 11:38:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606851499; cv=none; d=google.com; s=arc-20160816; b=nE29nkQsEy7Os4x2Pzcxqxo84e/lTabf+hMD/j0EJeItV/u8MYTmIScrnrqajl33rt yFte/O/2WkYjgD9D7j78BNlcbbTA11eb2wcNfBHTqdVLS5V3PQ0kzhuy9plWfKjtsqpc GVGPpwUcI9WEywZUDGYmCS+3gFG5P/1qPrWX1VIMPkUWd3g8Qz4aArmwWWIgBk/N/qq9 0wEv12xpQwG5UQrGRmcKLSsT8pwgRj8CevG2kdhrfZUExZRg/SN4qE9pZXSNmeIJgS0k b4SnF2SICa8ynjc3/z/sJAly4M3Gk+Z2qmvqxfHTfZzCZLwI0rZmfCBrP4P0AcO1cGwy TATw== 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=R5SUCHQ8/qMgiIJHmUJrStDsWioTT1j3yJ0DpJ9zmSU=; b=byYHSUi35v78k0/RaP2FiL3kI9xnycXhXhDzhVk2dIei6TCvaqnVBizHP9r0vJf8jX UigIH+apiTI+PXCHJvUb6uRRbRcvu9wqtLL4yDrQT02V5U2LGyS1GLXf/B7lZvFmlkas 4CFBA42LcJ27/n/tpgKO6DFGbH3O3uAfNe1BHlSC1beplP2Tpte3J9CEKLmzav8kyB2N iQxjODXR2nIaTMeQEVMtoLnmcivwgCPftc6cuVWWqxN0AUX/NTssowjR+X1qDafhWG6P e95ReNMLSHFqA27mh4gZ4k8WaRMP7qX/pf0h1vQ9yT4oeJgHUKrMKYiCJTR/tk1fm6pR BwGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=merlin.20170209 header.b=HdBRnDEQ; 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 v4si659250edj.57.2020.12.01.11.37.56; Tue, 01 Dec 2020 11:38:19 -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=HdBRnDEQ; 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 S2392318AbgLATg3 (ORCPT + 99 others); Tue, 1 Dec 2020 14:36:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387432AbgLATg2 (ORCPT ); Tue, 1 Dec 2020 14:36:28 -0500 Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2DDBAC0613D4 for ; Tue, 1 Dec 2020 11:35:48 -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=R5SUCHQ8/qMgiIJHmUJrStDsWioTT1j3yJ0DpJ9zmSU=; b=HdBRnDEQiteQwPVOHhvT3zvcDy mmCd0JGSpuH3LgwPwv8wUiImHZ9c3fUx6J5JQGONMjRmUCYg+mp0ggmOFNXzTBtKV3A3/uxWoDI6q EJvdI+NRylkY/tO4JWqkheL8iiOaG9TzWexLWfFY02ksuf74WvnNrLSF0QjssuscWebSidmsaifiY 4Ck6iZITkMLoIsP3OhepTBOBIAMK5Aj7xRGKNiiRSNQvcy1N/CMvsEXRoKPhuJcIc0FiAOpw7oh1r qcmhuQgHexEWpc4gwu8ZegZXVO5HPjZJwogtGMDLJlD6SWWQPDJavQFy7gynigSZXLfz2dXwR96bg tGcWMGfA==; 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 1kkBQM-00068c-O6; Tue, 01 Dec 2020 19:34:55 +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 AD853302753; Tue, 1 Dec 2020 20:34:51 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 981022C55544B; Tue, 1 Dec 2020 20:34:51 +0100 (CET) Date: Tue, 1 Dec 2020 20:34:51 +0100 From: Peter Zijlstra To: Joel Fernandes Cc: 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, chris.hyser@oracle.com, Ben Segall , Josh Don , Hao Luo , Tom Lendacky , Aubrey Li , "Paul E. McKenney" , Tim Chen Subject: Re: [PATCH -tip 22/32] sched: Split the cookie and setup per-task cookie on fork Message-ID: <20201201193451.GY3040@hirez.programming.kicks-ass.net> References: <20201117232003.3580179-1-joel@joelfernandes.org> <20201117232003.3580179-23-joel@joelfernandes.org> <20201125111014.GS2414@hirez.programming.kicks-ass.net> <20201201192028.GA222419@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201201192028.GA222419@google.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Dec 01, 2020 at 02:20:28PM -0500, Joel Fernandes wrote: > On Wed, Nov 25, 2020 at 12:10:14PM +0100, Peter Zijlstra wrote: > > On Tue, Nov 17, 2020 at 06:19:52PM -0500, Joel Fernandes (Google) wrote: > > > +void sched_core_tag_requeue(struct task_struct *p, unsigned long cookie, bool group) > > > +{ > > > + if (!p) > > > + return; > > > + > > > + if (group) > > > + p->core_group_cookie = cookie; > > > + else > > > + p->core_task_cookie = cookie; > > > + > > > + /* Use up half of the cookie's bits for task cookie and remaining for group cookie. */ > > > + p->core_cookie = (p->core_task_cookie << > > > + (sizeof(unsigned long) * 4)) + p->core_group_cookie; > > > > This seems dangerous; afaict there is nothing that prevents cookie > > collision. > > This is fixed in a later patch by Josh "sched: Refactor core cookie into > struct" where we are having independent fields for each type of cookie. So I don't think that later patch is right... That is, it works, but afaict it's massive overkill. COOKIE_CMP_RETURN(task_cookie); COOKIE_CMP_RETURN(group_cookie); COOKIE_CMP_RETURN(color); So if task_cookie matches, we consider group_cookie, if that matches we consider color. Now, afaict that's semantically exactly the same as just using the narrowest cookie. That is, use the task cookie if there is, and then, walking the cgroup hierarchy (up) pick the first cgroup cookie. (I don't understand the color thing, but lets have that discussion in that subthread) Which means you only need a single active cookie field. IOW, you're just making things complicated and expensive.