From patchwork Tue Nov 7 21:57:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ankur Arora X-Patchwork-Id: 13449403 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1334CC4167D for ; Tue, 7 Nov 2023 22:00:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E4BBC8D0081; Tue, 7 Nov 2023 17:00:16 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id DFD5D8D007C; Tue, 7 Nov 2023 17:00:16 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B6F108D0081; Tue, 7 Nov 2023 17:00:16 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 99AA58D007C for ; Tue, 7 Nov 2023 17:00:16 -0500 (EST) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 7699D120B61 for ; Tue, 7 Nov 2023 22:00:16 +0000 (UTC) X-FDA: 81432527232.27.314E89D Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf13.hostedemail.com (Postfix) with ESMTP id 0DA9F2002F for ; Tue, 7 Nov 2023 22:00:12 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-03-30 header.b=0L6ZVOAP; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=pDoPnA3a; dmarc=pass (policy=none) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf13.hostedemail.com: domain of ankur.a.arora@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=ankur.a.arora@oracle.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1699394413; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=AgHZ1N5EhoaLrXsY9vyuGAOSm3SPTfgdloTSSlmu3F8=; b=fmTsaqTEz5+Zx1al7h+s1YSpEJvXI4g/sapr7lzGJk+cqhDapU+sRfT/HYTzsyd48WfwLh ZilkH4XNNJe7rcsFbK74XphIHPStCWev6/OQRmAT+n6PcjDGSmUMIfNzJsaMvw8WtTmYvf GI4mOb4c3xp7MlfIlCKkNjrBGSjKrWs= ARC-Authentication-Results: i=2; imf13.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-03-30 header.b=0L6ZVOAP; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=pDoPnA3a; dmarc=pass (policy=none) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf13.hostedemail.com: domain of ankur.a.arora@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=ankur.a.arora@oracle.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1699394413; a=rsa-sha256; cv=pass; b=uvlFcWp7GlpOe1/ESWBWDC94F3ZBpoQNNoqK0xnFGyXk8P6zr9TuEGrqvM39dGCWUFkWq4 z9UXveMLfrYzxfXm6D4g8kl1h8VgFtoXy2rouAWi1WQNHRUrSAcsp7bjzdll0S+1MhBFCD S5l+tyu5g30/FJSOc3NC2TVZy0W/kac= Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3A7LJcBH005442; Tue, 7 Nov 2023 21:59:51 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=AgHZ1N5EhoaLrXsY9vyuGAOSm3SPTfgdloTSSlmu3F8=; b=0L6ZVOAPUA1CGBIZaRIgMxgX6K7W36eeGNpQAdC8VsmwvVuoVk9XzScRg5r6OX7ndRYs UKKe0M/SOetznVjvoLkqWDnk3+LbKTM4dSkbvtqtc25hrqcVfagWETRNK2QbUFybe+ma +EaUtaGYTkRc1j20cnUWowfhGDwLVstCmfXYJroXt3FUOk30hPhJ1SVPPdKE6sHH/Tf4 JuViJdm/MFf67TS8i8zkNvoXal/s4camLXBlve+VVklgwCkfsFJdAN/sgQ2j3WcFCemh XAxkOjQKDENg48gdS1r5SsVD8HDyTLoF7hvH0XMv7AMlZhm+EbQMKFJZaW33xqKKW2bF 2w== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3u7w23g2df-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 07 Nov 2023 21:59:51 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 3A7LIhoV011115; Tue, 7 Nov 2023 21:59:50 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam02lp2041.outbound.protection.outlook.com [104.47.51.41]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3u7w1tsjqt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 07 Nov 2023 21:59:50 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HPMtOzEH9FlKHAvYi2sYd9jmnVEwIySaMAhiUhoNPqSn7FYDkPWjHzj0hHvdn/iSVoPwWdW2EfVBwxiEtJEsCSQhlv2ZY6aDcBwt7RM3z23nLspk8pbGWvf7hvMcCsT6BMO/EIBoPl+e4nN3O5r2tnItSOzTpT7ziRO0cXt1fgnF6u8KMXE9oo9ip1SNF0cibVjllmqaMG2RgTY2p+MmKy+ENxgN5CCjSi7aDy78PzU+SEXH6Y1/GECb8+v+5zS8zj6nKSQS2MBopogui+myO51LxKsRhCyNmms5aqF7lhSbCFxoYwGPYV9GkUAYM9L7uYRPcwoNGFsTUi4lmGtw3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=AgHZ1N5EhoaLrXsY9vyuGAOSm3SPTfgdloTSSlmu3F8=; b=Jz1ajQzbnqj0QN1XSpZSUpAOUWc67RXdxLZsrEFOuhDpaHORrPqlr3L4QuLi45MkUxTw0hfN6z6xou5EQ2XYN1mGZjkUMOkLfCMpKsZa6kUWA+xyishOQtCxdS6g6w99s0IXQcUZfVs3eVx0PQu0y+YhdIO1caeHZqkTEEymhE281WBn5K9ppSzQvVxT3/DmbNBjjzP26iG5fL8Mh21ZF0V06npH1ShC0cMXOmsWAJXX4QWnQJmrKmSrKHic1Z+gLhtuytvZtX/mNTYcqZ9YzHNm1oSxQXjw8fvKDLvU1uwd5NO66CpSxOwk6y3o7oGNkkq2lwGp3X9FaKrvePjkYQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=AgHZ1N5EhoaLrXsY9vyuGAOSm3SPTfgdloTSSlmu3F8=; b=pDoPnA3ahKme8JyxjMLRIWJ1UHPhEU/SCZ4heli+SmRgjgR3GhDoOpP97ceO3JpdN4pnDSycPXlq8mMnFCEiGXdDWzun/+PWz4/MJ5IOdLUExNeADHIhKfTOV6eS452GY5p2UsETPfahX+CseySN4BYuWzBOaz/g8zLVGbBQEdU= Received: from CO6PR10MB5409.namprd10.prod.outlook.com (2603:10b6:5:357::14) by PH7PR10MB6275.namprd10.prod.outlook.com (2603:10b6:510:211::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.27; Tue, 7 Nov 2023 21:59:45 +0000 Received: from CO6PR10MB5409.namprd10.prod.outlook.com ([fe80::1ce3:4a8c:4c99:acea]) by CO6PR10MB5409.namprd10.prod.outlook.com ([fe80::1ce3:4a8c:4c99:acea%7]) with mapi id 15.20.6954.028; Tue, 7 Nov 2023 21:59:45 +0000 From: Ankur Arora To: linux-kernel@vger.kernel.org Cc: tglx@linutronix.de, peterz@infradead.org, torvalds@linux-foundation.org, paulmck@kernel.org, linux-mm@kvack.org, x86@kernel.org, akpm@linux-foundation.org, luto@kernel.org, bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com, mingo@redhat.com, juri.lelli@redhat.com, vincent.guittot@linaro.org, willy@infradead.org, mgorman@suse.de, jon.grimm@amd.com, bharata@amd.com, raghavendra.kt@amd.com, boris.ostrovsky@oracle.com, konrad.wilk@oracle.com, jgross@suse.com, andrew.cooper3@citrix.com, mingo@kernel.org, bristot@kernel.org, mathieu.desnoyers@efficios.com, geert@linux-m68k.org, glaubitz@physik.fu-berlin.de, anton.ivanov@cambridgegreys.com, mattst88@gmail.com, krypton@ulrich-teichert.org, rostedt@goodmis.org, David.Laight@ACULAB.COM, richard@nod.at, mjguzik@gmail.com, Ankur Arora Subject: [RFC PATCH 40/86] context_tracking: add ct_state_cpu() Date: Tue, 7 Nov 2023 13:57:26 -0800 Message-Id: <20231107215742.363031-41-ankur.a.arora@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20231107215742.363031-1-ankur.a.arora@oracle.com> References: <20231107215742.363031-1-ankur.a.arora@oracle.com> X-ClientProxiedBy: MW2PR2101CA0029.namprd21.prod.outlook.com (2603:10b6:302:1::42) To CO6PR10MB5409.namprd10.prod.outlook.com (2603:10b6:5:357::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO6PR10MB5409:EE_|PH7PR10MB6275:EE_ X-MS-Office365-Filtering-Correlation-Id: fab9a692-4dc4-4d1e-a9b3-08dbdfdcda42 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9A2Lt71wnSewrbONGEzXnrH9IBszBCDkaIP+/jDZvqDNXk7Bd6RDt8U3J+ZR0Qcmj0iIDMxMOWFvWVcMiaSvJoPZBwXSrIrqSYyFEQprv3Jwn+KAzFz3ouX69hs7poyQVPlfzSW9HHw8jTB/t0UTx+Y+tgHRb3q+Qtrvy29f03498UuqkaPjtR3FLilcc3mlcX04Nywqg/GE3l2H9P7q3/hwPcpAgbft+i9Rmo+v+6tVswL0wsm0VYUfQY7B4o5e/tmK5P1Y21Il5jlLZ8cLNwyxo3T5zT7gtljCbrMVLHBqojy7QlPunx8n9itALomxNKxM7kbKa21Q/qZP74TQR4OS0Xgw9nY9uOYHJYTrzlyZbVV8Ma993PSYkTkD3ZBfjppKM6iDOQTk1bUrvLVd9adr7XE+ZK7KKzIitePQCiQshWF7kGX9z26TJjfjQcerk17qekzjYI/SV4DYFcptV2d9LSLJiwQv16wSFJyVrf4i8w/tbkpNvyQ/kfDb+RZnAQeVIwnVwEJkegz4Z2lNeZqDYcXFQqQTCN41hrKtr5YmnWjtJ0WOrVaveIvL2ZNh X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CO6PR10MB5409.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366004)(376002)(396003)(39860400002)(346002)(136003)(230922051799003)(64100799003)(451199024)(186009)(1800799009)(66476007)(6666004)(38100700002)(6916009)(6506007)(316002)(66556008)(36756003)(5660300002)(7416002)(7406005)(41300700001)(66946007)(6512007)(103116003)(1076003)(8936002)(8676002)(4326008)(26005)(6486002)(107886003)(2616005)(2906002)(83380400001)(86362001)(478600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 8QYL0eyIYiJCl3uryXvFYLVnQgnDz5nre3gMZjm4U2nHzQa6oj7lq72cbQ9OcvScIpvXOwZSIIcsqATVSqKPcyhJPnJFRIepQdL7l0DEmY0+/l6p42Pg5bBJozGd11xd6sKwUJn5lr+WFQrO0kNv8xFOSyRWE/mwCGC7B9qVaacMqP37uMDM1BYDaFjl0MwrOqZiG7E0JIHbqrXnZurXmhHFkqTeTaZgOEgF726SYRdaxEOgZKvvKLLWFdAWpc2W/IIxO+92lKLicFw1o/xwv8xNit49MojDV2N7Obf01hYbRWf9voA08MpaWboZtTRI55hp9pgBRFHVxYjNmGQbm+kFIwpfw/gBH8UWz0Oc5P43TZHwMpV/bXkeDZq1y2okAGo+ZqwGRioxE+PwNmlewKRVRfjhR6zKlhLeLKynFxb3kMRT04PN5+FqAMlygLVBXnxQD7uiiYgThzmw6qavHvdl6FV52hs72EFbdGKyGBpgIu3gcuLC9+u/amN5SbCwGlrNS3YnWiBPy2ONMGeOOBlVcpNgLeGZLJdyLaKuzXiThsowVQHCYfa9Yl4VbC2iFfeshWNwohakeJ7jLBQaZQ9f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ZUn9j4C+dS3h4jyme4PCtZa4AcOjgt31zQRfJsrKW/JWuMRtSN0mRE0XrE1xO/q2ys7g1Zu6YxA3nOSUDme7jJGpS6qpDNC/7JETOVqrNLJcjXXvAvQTGxV/3sCn8eRQt3ZgYkOPpny6T+fhjmbAtTr1klG1JghIKT66uDv7D0GPXozz5CZvz/j+hAhlhnmpUk9Zep2PUBM9H12MTrw8/zxR1epl2Rsw14Y+d9h1cUXddSIJqDHJ+jhfO9+THmGE8jLkNKTwrd1f3IwR7ySPc4wALcNB1Cb9x9TUoSOBFremjTteqzn+laC9UcOn7wwpv+NmdEbCCmmkZr2TIvPCxWaDiwyHigPL/NqhGpny684eqW0JpFofS++u5QN8og0NctiJeaK4851M6z3CNZesVCaPkcNL5xmrXZzqJlaEhK8fgs9UU6Oko863HETlT6IJX1FTD1BPi0vAJsMqSH/aCNQSMzNj5w0u1q4dJowzEl5TbMB4mjPd4lYwl5Q8rJlhuB3Fx608aOCOzw== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: fab9a692-4dc4-4d1e-a9b3-08dbdfdcda42 X-MS-Exchange-CrossTenant-AuthSource: CO6PR10MB5409.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2023 21:59:45.2262 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: gRlvqYNHhxZZhopXRsBAK7q1WhyBNhX2/9bQAL8Sf0N2Rs7ettAdm8eDriu5dQaj2yez0YgvnFa6iXfi604XDM6iZnKoAzUErINtiCT5CA8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR10MB6275 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-07_13,2023-11-07_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 phishscore=0 suspectscore=0 malwarescore=0 mlxlogscore=999 bulkscore=0 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311070182 X-Proofpoint-GUID: skFKXPrKzw3I8UaaOrnk6NVYwCSuronb X-Proofpoint-ORIG-GUID: skFKXPrKzw3I8UaaOrnk6NVYwCSuronb X-Rspam-User: X-Stat-Signature: anphpom87ib6xyng7g9qpqfon9a5uukg X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 0DA9F2002F X-HE-Tag: 1699394412-764439 X-HE-Meta: U2FsdGVkX1+wuNIllHeshqNlH8bPZ0AVC+cZrZvMamApuWj6Wr+c69Hq4I67uJSaZWAaUYpMSHCj+uSVDXiOUpvACN4UqeQWQfHIYGcE2X+k1heDBmku8/Ts8bvqR3uWGMmEv4if+IxSvXPsKrKuD7tDzL3ybjDtl2Z+QZo1M2dx+chsZ4ETrejkpR8a2TfeLWb2ATByANbAVEVBKQtrzH6aS/QP89NdBx8EmCps7QIvM/eQKylkcN/lddVqXhFV6a2ry1Ehi6lZzlP112SMe/uxxiOBdrfmr8NkYDm9IEBPnOlxMmTe5zY9mSDIK2VdaifuZGljtbRuy+KVXvEkcn1eEKuPWVkabmmODktsW2Aw302Ol5F67ajSrZ8PZJZrrhawxC2fo2FLl4h3n+iGjusnXWnqDcIcTm7vzuLl87IeR2pl5R1wuSETBzz+NGlgS7Jnnjk8eJkOA37BiB1n1yisK/70lBIkMemYvad5OD/nN7RNt9uCk34VQnTJxdrJPurPWOKFwomcMHHqWPwX4YRPJG/fW43Pk+ujrvuIaOFYMUIHi51OjMnw/nGIo2zMIK/8MwvC4x7SLAbVGQisEbMMYAgiKgXDW/zphtVkj4GuQPPfOx+o9NpHnaJjsCCzj85UWVG/7zfT0DpcmMDdV+UpBZSnNRF4Bm33ehKZvGnRioHq7IzkhrtPKUWHkcUoqGbY4BqW1/qPCOzcWecnw4oNKisT0Ga9ORz+s5BdEHGwcZoqUNa5hJcdTNbf7SDdqDX1Oewhvs3mfxW6VPPwZQTkIf8n9+P5NstooSl9bbYlCm7S8cHtBxw7yy4RVMC6VEX29kJC7kA4dMH9amMhe4T8LK1RllC4r1Hpmkbhb8HePj3wwa31LrZc2w5Cvy3dfyHsO54i9ZsTTC1sH6lPgb1HOcpY9HNSGIjEgR7V/nmvj/F2Lqw/3N9EiApu7nUNaH8sRBMDSivaFzZLI77 eJfRjLnf tjQe657rXA4QHna8PNAUV2FF2YdpG3Mt0edF7EnqRXgDyCDfcgmtc+wWWvBfkfAnqzOIBGFnupVNriE59vLVPoqQSgfjHbFX2ZFRqu7GWnNQnYp6OqW1E4oLt/p7mN1eLHOyvOZ2OosuxqGbCg8AeRxMJeJ6G7Z5HqEUKc3yEGr8QmKp3KSZXqEkTxT0MSGIGLXi7xy23v9I2GSieBDn6HhZwOEOgUTnd3mx8Az39aAjdAg/uc5NkuxRVvRnUmdTGFVjJUdHLZGZzhXKTdHgezNeZAaXpe77nc+QYiakFoTp1nonPzv4c9zmhOoJKO7QqcmCwxQ+nf2JyEFSOI4ANuWMYWy+zxzo0LClxrHn0hndEnSmW5YMESeGT7mOqU0iKIRcxdrqZfP7NHuv1Q9Y1z1ZIyC3FDUDMR2Je3RUvhfhD+0VLEmAH23OYdH7KOJnGQk59wCz6sOp3+OBqxHnBo8c1MA== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: While making up its mind about whether to reschedule a target runqueue eagerly or lazily, resched_curr() needs to know if the target is executing in the kernel or in userspace. Add ct_state_cpu(). Signed-off-by: Ankur Arora --- Using context-tracking for this seems like overkill. Is there a better way to achieve this? One problem with depending on user_enter() is that it happens much too late for our purposes. From the scheduler's point-of-view the exit state has effectively transitioned once the task exits the exit_to_user_loop() so we will see stale state while the task is done with exit_to_user_loop() but has not yet executed user_enter(). --- include/linux/context_tracking_state.h | 21 +++++++++++++++++++++ kernel/Kconfig.preempt | 1 + 2 files changed, 22 insertions(+) diff --git a/include/linux/context_tracking_state.h b/include/linux/context_tracking_state.h index bbff5f7f8803..6a8f1c7ba105 100644 --- a/include/linux/context_tracking_state.h +++ b/include/linux/context_tracking_state.h @@ -53,6 +53,13 @@ static __always_inline int __ct_state(void) { return raw_atomic_read(this_cpu_ptr(&context_tracking.state)) & CT_STATE_MASK; } + +static __always_inline int __ct_state_cpu(int cpu) +{ + struct context_tracking *ct = per_cpu_ptr(&context_tracking, cpu); + + return atomic_read(&ct->state) & CT_STATE_MASK; +} #endif #ifdef CONFIG_CONTEXT_TRACKING_IDLE @@ -139,6 +146,20 @@ static __always_inline int ct_state(void) return ret; } +static __always_inline int ct_state_cpu(int cpu) +{ + int ret; + + if (!context_tracking_enabled_cpu(cpu)) + return CONTEXT_DISABLED; + + preempt_disable(); + ret = __ct_state_cpu(cpu); + preempt_enable(); + + return ret; +} + #else static __always_inline bool context_tracking_enabled(void) { return false; } static __always_inline bool context_tracking_enabled_cpu(int cpu) { return false; } diff --git a/kernel/Kconfig.preempt b/kernel/Kconfig.preempt index 715e7aebb9d8..aa87b5cd3ecc 100644 --- a/kernel/Kconfig.preempt +++ b/kernel/Kconfig.preempt @@ -80,6 +80,7 @@ config PREEMPT_COUNT config PREEMPTION bool select PREEMPT_COUNT + select CONTEXT_TRACKING_USER config SCHED_CORE bool "Core Scheduling for SMT"