From patchwork Mon Nov 28 13:20:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Neri X-Patchwork-Id: 26766 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp5659329wrr; Mon, 28 Nov 2022 05:17:37 -0800 (PST) X-Google-Smtp-Source: AA0mqf5yTS5CNj55RutEVLtMDceNPSgyB5VkQ07ZvKEpMspAHsN7N9iZXeOybs2Bb1wQEb2ZtWNA X-Received: by 2002:a63:e609:0:b0:458:cfe7:8dd with SMTP id g9-20020a63e609000000b00458cfe708ddmr26230899pgh.548.1669641457398; Mon, 28 Nov 2022 05:17:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669641457; cv=none; d=google.com; s=arc-20160816; b=z7UdAhbyjZgMAbgloA8dB1MgadiNbZzvn4L1szBnyRCyc4K0lGk5oLhlORBXL8Gv90 LroF31Od0SjzzK6lkVuAu0Nm5jEHsNUZsNE9nlJcsQRyyu8wJk8+Ev4QaE43fwxbJ9vB EDwtmpnvsM/AGNYvFpz/T9zSDHl+9TnkTzjR48ctqBHz6bPefs/au+Sr9EwRLdhPdndE PBCehO3DjsJ22jgM8n0SC0C7RVo/0zItJorVGFUWu/OQhLt5mg/bIkm7CxXY+YdrY8r8 stQAH6/MqkyJAmCSE4MyBLQd1pvnB2fezstbww8l7m34Z3hXpqmtfNQW1b8p5UNTc5DW RgcA== 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=29bHJ1Wccr4/+o8KHsWHLu5LnAYdcyCoQxsYlavoVwM=; b=bGGWp8JWwZLz50o0nb7wgxw71jZ2RRN5kfCjxXUqiQD6fj3Tjps5iRNqwDAID1l/cb uCT1JgGs/WID6xTEOZhKZoTB77m3ybcmWAYgmXxtG50BuReBzc9I260JOeymvYwZz+YM 080hbjZRgzyTnMK2jjfWBhNwuARGkisCmLVJARJqh/A2/Eg6QfqdBQuaGxKFKWfdPxqd Kf2F1K0HWNccXsdW6Nluz4tWYfjhshlhQQeAFjYaufaNd5Navn1o1RyluYQERV0GjRUq Vpr7zIhOl/07QdzYIkW8RMlChkiaJKpbiudfwoTBI73nwSz/qv2sMdGtVip5PtGlGXxv Llhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=gSFrBgEq; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s195-20020a6377cc000000b00438f77814b2si12694711pgc.124.2022.11.28.05.17.23; Mon, 28 Nov 2022 05:17:37 -0800 (PST) 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=gSFrBgEq; 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 S231891AbiK1NOo (ORCPT + 99 others); Mon, 28 Nov 2022 08:14:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231599AbiK1NNl (ORCPT ); Mon, 28 Nov 2022 08:13:41 -0500 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF74122D; Mon, 28 Nov 2022 05:13:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669641220; x=1701177220; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=p7BCBvy/ijiGArW5gb4LxSYPxM/Arci+QhS/bMOw9bo=; b=gSFrBgEqXr5rBXnI3IFSYy+cx+9uhnT4QhrkD3L0uF9xdrzRceWmNDjh ZKMKJJarF4v+ACLXe8Sh03JqoLVY8TjXdK2yU0sQZONt8nuVXGDSe4apo rMCVuxYe9m8XJw9xn4W49uNfPB2J2Sk9DZ0V6QfNNjlR37RAMisrOlJST iWwWrHksfFikdxNVa8UqgYtvEXKkVh2EaXDlzCMrFVJ3eLAYqq6KZqXws c5xI2L11dv4buBjsJwsTvn0AyDd0VoIaq6Vz4is3dg1nQBE+rKPV+VXBV 2h9YaQnS9bR5/oDopZ3nPh2pflANk57kPXVFFnnMCKzINW1Zl8GrG2FFQ Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10544"; a="401117226" X-IronPort-AV: E=Sophos;i="5.96,200,1665471600"; d="scan'208";a="401117226" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Nov 2022 05:13:35 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10544"; a="749381387" X-IronPort-AV: E=Sophos;i="5.96,200,1665471600"; d="scan'208";a="749381387" Received: from ranerica-svr.sc.intel.com ([172.25.110.23]) by fmsmga002.fm.intel.com with ESMTP; 28 Nov 2022 05:13:35 -0800 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 , x86@kernel.org, "Joel Fernandes (Google)" , linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Ricardo Neri , "Tim C . Chen" Subject: [PATCH v2 17/22] sched/task_struct: Add helpers for IPC classification Date: Mon, 28 Nov 2022 05:20:55 -0800 Message-Id: <20221128132100.30253-18-ricardo.neri-calderon@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221128132100.30253-1-ricardo.neri-calderon@linux.intel.com> References: <20221128132100.30253-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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750745960914471023?= X-GMAIL-MSGID: =?utf-8?q?1750745960914471023?= The unprocessed classification that hardware provides for a task may not be usable by the scheduler: the classification may change too frequently or architectures may want to consider extra 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 post- process the classification that hardware provides. Cc: Ben Segall Cc: Daniel Bristot de Oliveira Cc: Dietmar Eggemann Cc: Joel Fernandes (Google) Cc: Len Brown Cc: Mel Gorman Cc: Rafael J. Wysocki Cc: Srinivas Pandruvada Cc: Steven Rostedt Cc: Tim C. Chen Cc: Valentin Schneider Cc: x86@kernel.org Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Ricardo Neri --- 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 ddabc7449edd..8a99aa316c37 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -1532,7 +1532,17 @@ struct task_struct { * A hardware-defined classification of task based on the number * of instructions per cycle. */ - unsigned int 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 the candidate classification + * of a task + */ + unsigned int ipcc_cntr : 14; #endif /*