Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp701594rwd; Mon, 12 Jun 2023 21:58:36 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ60QQOsTNZZHQeETS101kapwP9vZCbN6DmEozXIGQQNouHZB5qQv1wTawTKplTBfAmf4YeG X-Received: by 2002:a17:90a:1db:b0:25b:ba7e:9ea with SMTP id 27-20020a17090a01db00b0025bba7e09eamr8092468pjd.47.1686632316208; Mon, 12 Jun 2023 21:58:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686632316; cv=none; d=google.com; s=arc-20160816; b=BgYzkAtXbm5+KysOsGpqpQJ6Q08jV6bqbzzEnk0b5QDYai6Lynylj5JnX3ImuFxCxg ybsnrNiGnDZV2qHHMu/XnU8Lw9dbZaKJyY52P+0H0edO8wKe+JSkqu6Ggk1LMtue0q6M /psGkF6vaEZv2IS4ehN38hUfLVH3cL6ZfVkbBogKOUGTwUIquBDWsguKkHzBUOpW+Vhl tmHn2418MOXvfd7iLTGKksCI+svFK+Iyx28+g41gjH0izT1jCIFVXY00pEEYVKGf8W2g S6ZrxIvaXsrAk/2XcUZgJeBjWHiqqFzhe375M2wRkpJQnWEnds2D/FKm8otuhiznREAj BjUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=ExQyBP66W+T2GXe1cG9qSTDXXyquaUIPVc+16SrYFSU=; b=TA/k9dUk8el2eiqW5NlyqIZCrNeQnhdTj/6OuQuLAbrAE9/IhrORYVOpdW3j7OL6p5 0LYN1dYOGS+MlUK3BNKfLoCG9Yhc6u8Uq5ru21GSP/WXvXe1E/mVkSGI+eOnTpSHLWB6 n1xk7J66T62zhR8qzX+LyIRSw3TR0CYlVXdCwU9voNJRS0vqG0xSiw3/iU2aW1fMuqDf Kld3DAE1/uw5l4F8Hd6L9v8Q+wPwhawEIgKhWdIUN5CCxnf3Oxgn8Q+hGthJOZqCkvQo TziMxokRhBBfEOv8JBkUXeYXrD0ikOEaCBqtwhVIP8GrCaJvXVWHjoySDlRv8itgRQ7l IwrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=cw8fJ7dm; 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=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 93-20020a17090a0fe600b0025bc1728a83si4092022pjz.26.2023.06.12.21.58.23; Mon, 12 Jun 2023 21:58: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; dkim=pass header.i=@intel.com header.s=Intel header.b=cw8fJ7dm; 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=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239419AbjFMEZC (ORCPT + 99 others); Tue, 13 Jun 2023 00:25:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239412AbjFMEX5 (ORCPT ); Tue, 13 Jun 2023 00:23:57 -0400 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D6342122; Mon, 12 Jun 2023 21:22:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686630128; x=1718166128; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=t17FqAhGdxt78i227uUsMAyQGoFX7gC6V9+9xUvlqks=; b=cw8fJ7dm2IkYXTUGRdF06uoKm7vBrYB7wLh5ROagYUOkbyGz2pLqKTuM Jxj+d2QGHWWR0KEvuO4gYvSvXzNpVwaBzJlJ8un8c+ma3lU2bLK6qawM4 XOfWk0UapCEYggK2l5UwxM9VEzGdnFnP6vZoJFHMthAso84fUQ7wMico9 +hk76Q++a2PPxAiae1FJBzZcg6y71ObVfdkQhzlni2Y0AV5cxkVJJ2hRO mvJd4x+KR0gLGwinQs1q5RBVCKyfzBxpduVOzfEiCkcAfUqEsgNIvyPWy Mqwytn/GT9x+ShT2Z6PXuWiBZp8hONg1lH1+Qo+Js5dviO/HVUdv8qiwL g==; X-IronPort-AV: E=McAfee;i="6600,9927,10739"; a="358222240" X-IronPort-AV: E=Sophos;i="6.00,238,1681196400"; d="scan'208";a="358222240" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2023 21:21:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10739"; a="661854987" X-IronPort-AV: E=Sophos;i="6.00,238,1681196400"; d="scan'208";a="661854987" Received: from ranerica-svr.sc.intel.com ([172.25.110.23]) by orsmga003.jf.intel.com with ESMTP; 12 Jun 2023 21:21:57 -0700 From: Ricardo Neri To: "Peter Zijlstra (Intel)" , Juri Lelli , Vincent Guittot Cc: 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 , Ionela Voinescu , Zhao Liu , "Yuan, Perry" , x86@kernel.org, "Joel Fernandes (Google)" , linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Ricardo Neri , "Tim C . Chen" , Zhao Liu Subject: [PATCH v4 18/24] sched/task_struct: Add helpers for IPC classification Date: Mon, 12 Jun 2023 21:24:16 -0700 Message-Id: <20230613042422.5344-19-ricardo.neri-calderon@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230613042422.5344-1-ricardo.neri-calderon@linux.intel.com> References: <20230613042422.5344-1-ricardo.neri-calderon@linux.intel.com> X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 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 /* -- 2.25.1