Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp10714021rwd; Thu, 22 Jun 2023 03:59:36 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4cVQ1JnrUOska2sYtQlhN2J4JAVKlQl+mYYoaAiLpFjS7e6X9qTKDCJKA8hjioICHkhsqA X-Received: by 2002:a05:6214:628:b0:62d:fddb:1856 with SMTP id a8-20020a056214062800b0062dfddb1856mr18885745qvx.43.1687431576435; Thu, 22 Jun 2023 03:59:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687431576; cv=none; d=google.com; s=arc-20160816; b=DrcW4DBKea6cAhma0s3Fhmpytmczqtk1UFUEjH1Kpoub9KOASzAGX7MR4r1kQYj+H7 8Kzd0GzAZHD/pSVFEL3wiFu1nz+NZnkbsV7sF6EjrtOLVWzA4HRhwlZ+RNW9j/AhXfTC ckzFlasOMdruSADJ0EV1BJIA5t3YqfQoI9jzOa+b6wO0nLJgOpQruntY4qEc2Iq6zvH7 QkcZbFI/44fv2WQD0dGG1ON4aPIArKdeWYJ4RP/QhKxpEVOwh/APtKKeh7j1mxWH1m4V PLnIj99csKSwoR869r0jEDBeq5lQqsB8ngNTzAfXaYl+2OFt/lNRudmMZByvyf3d0m4i lhjw== 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; bh=b6F7LwFjNe9LUhQCYSdfrasop9Ga3BivwWHMKsUVWm8=; b=ICvvT6iBpWbUWW9NPDAGrqyf4nd0pZvgXnMF3UGYD7aaW/irWvjO7KVk2S3h2jdEvW rflwyFb66mHMIY5aETNHm6a5hjHBR0oxJhDntPb5ulRwgOq8w+s0HQysm/Fh4+KlgCa8 kxeyLSLCsPko1O/vJPHWQhduMuWJgr6m61tIxhqi0PtmHQ+SexsWJJP77tB8yNFyvESt DVvfkitk+jTrU9gnHrI5FXzF9DzU9LjtWv5gTI0PAFeLD9CoUFpmhRx3LSuq0bZYpT+5 RiJvK5C4kbckDhQ/tKrwONfe9ONzcTI2TA6+qDHDY6+kV39IjqHOkXkyK4sR0BeA1LYH D/vw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s3-20020a637703000000b0054f9f9c744fsi3163263pgc.639.2023.06.22.03.59.24; Thu, 22 Jun 2023 03:59:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231410AbjFVKVK (ORCPT + 99 others); Thu, 22 Jun 2023 06:21:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231392AbjFVKU6 (ORCPT ); Thu, 22 Jun 2023 06:20:58 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 019A31BC5; Thu, 22 Jun 2023 03:20:49 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8AFA81042; Thu, 22 Jun 2023 03:21:33 -0700 (PDT) Received: from localhost (ionvoi01-desktop.cambridge.arm.com [10.2.78.69]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 433EF3F64C; Thu, 22 Jun 2023 03:20:49 -0700 (PDT) Date: Thu, 22 Jun 2023 11:20:47 +0100 From: Ionela Voinescu To: Ricardo Neri Cc: "Peter Zijlstra (Intel)" , Juri Lelli , Vincent Guittot , Ricardo Neri , "Ravi V. Shankar" , Ben Segall , Daniel Bristot de Oliveira , Dietmar Eggemann , Len Brown , Mel Gorman , "Rafael J. Wysocki" , Srinivas Pandruvada , Steven Rostedt , Tim Chen , Valentin Schneider , Lukasz Luba , Zhao Liu , "Yuan, Perry" , x86@kernel.org, "Joel Fernandes (Google)" , linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, "Tim C . Chen" , Zhao Liu Subject: Re: [PATCH v4 18/24] sched/task_struct: Add helpers for IPC classification Message-ID: References: <20230613042422.5344-1-ricardo.neri-calderon@linux.intel.com> <20230613042422.5344-19-ricardo.neri-calderon@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230613042422.5344-19-ricardo.neri-calderon@linux.intel.com> X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Monday 12 Jun 2023 at 21:24:16 (-0700), Ricardo Neri wrote: > The raw classification that hardware provides for a task may not > be directly usable by the scheduler: the classification may change too > frequently or architecture-specific implementations may need to consider > additional factors. For instance, some processors with Intel Thread > Director need to consider the state of the SMT siblings of a core. > > Provide per-task helper variables that architectures can use to > postprocess the classification that hardware provides. > > Cc: Ben Segall > Cc: Daniel Bristot de Oliveira > Cc: Dietmar Eggemann > Cc: Ionela Voinescu > Cc: Joel Fernandes (Google) > Cc: Len Brown > Cc: Lukasz Luba > Cc: Mel Gorman > Cc: Perry Yuan > Cc: Rafael J. Wysocki > Cc: Srinivas Pandruvada > Cc: Steven Rostedt > Cc: Tim C. Chen > Cc: Valentin Schneider > Cc: Zhao Liu > Cc: x86@kernel.org > Cc: linux-pm@vger.kernel.org > Cc: linux-kernel@vger.kernel.org > Signed-off-by: Ricardo Neri > --- > Changes since v3: > * None > > Changes since v2: > * None > > Changes since v1: > * Used bit-fields to fit all the IPC class data in 4 bytes. (PeterZ) > * Shortened names of the helpers. > * Renamed helpers with the ipcc_ prefix. > * Reworded commit message for clarity > --- > include/linux/sched.h | 12 +++++++++++- > 1 file changed, 11 insertions(+), 1 deletion(-) > > diff --git a/include/linux/sched.h b/include/linux/sched.h > index 0e1c38ad09c2..719147460ca8 100644 > --- a/include/linux/sched.h > +++ b/include/linux/sched.h > @@ -1541,7 +1541,17 @@ struct task_struct { > * A hardware-defined classification of task that reflects but is > * not identical to the number of instructions per cycle. > */ > - unsigned short ipcc; > + unsigned int ipcc : 9; > + /* > + * A candidate classification that arch-specific implementations > + * qualify for correctness. > + */ > + unsigned int ipcc_tmp : 9; > + /* > + * Counter to filter out transient candidate classifications > + * of a task. > + */ > + unsigned int ipcc_cntr : 14; > #endif > Why does this need to be split in task_struct? Isn't this architecture specific? IMO the scheduler should never make use of class information itself. It only receives the value though the call of an arch function and passes it as an argument to an arch function to get a performance score. So the way one interprets the class value (splits it in relevant and helper bits) should be defined and considered in the architecture specific code. Thanks, Ionela. > /* > -- > 2.25.1 >