Received: by 2002:a89:2c3:0:b0:1ed:23cc:44d1 with SMTP id d3csp974638lqs; Wed, 6 Mar 2024 02:27:13 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXB6RhtKbYvvk5oCO7elZJqEx+alp12iAsNn1BSPiWvrwHYLj72mRAu8CRW95D02g03tCSI3eruj1GAvBmmhka4gW3VjmzBQUizsIB4Pw== X-Google-Smtp-Source: AGHT+IG28W5XfNQ1ifEsSX8JEB72chsNlSdAo08VDbk82GAk9iZMuGcTlKqJ/zXjMlF8vxdC7iFh X-Received: by 2002:a2e:b1d1:0:b0:2d2:74ed:37b0 with SMTP id e17-20020a2eb1d1000000b002d274ed37b0mr2859765lja.11.1709720833817; Wed, 06 Mar 2024 02:27:13 -0800 (PST) Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id l29-20020a50d6dd000000b00566b5d208f0si5544005edj.550.2024.03.06.02.27.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Mar 2024 02:27:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-93733-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=2c8uZed6; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-93733-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-93733-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 9581C1F29339 for ; Wed, 6 Mar 2024 10:19:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5AAD26026E; Wed, 6 Mar 2024 10:18:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="2c8uZed6" Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2072.outbound.protection.outlook.com [40.107.244.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B5BA85E206; Wed, 6 Mar 2024 10:18:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.244.72 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709720308; cv=fail; b=lbf1nZ5fbFoqDnkVIiP+7rZOjCZL9PJBslRwL9/1JD6nuxKtRQGcSrsZuXbal+w/nfiTm6f43CYM/U61TCw/yOEyjO7asHs+ghPboXGrutD/HP0eEPoH3wlHDSYaF8TW+U/UaYgX9rvfdW+lD/OncZGZN90ZS/YeIUxTV3iKNjw= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709720308; c=relaxed/simple; bh=4RhJjRsGlLgEmpaJoIYbG1pC5zTit8Rvkng5onsUIKE=; h=Message-ID:Date:Subject:To:Cc:References:From:In-Reply-To: Content-Type:MIME-Version; b=ex4x24r7xfmI2TxDJvaY/wQ72s0s3Sc3P4anZNYDo0xQum3+crmL18xrgUw6GXlDYCgXZHCFDb12817XQk80bToLTEqdwvrmDtZdRA3p38PtkzkWfHjhDTMOSk9k9fpdqwHYlpnxNmVwPlET5wDFmeNQM04//kGOZMcnGeEMxQY= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=2c8uZed6; arc=fail smtp.client-ip=40.107.244.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bdZFAhU/s9wAzoSQMH3qgZx0ZdlgK6tfujoDTwPR1MrvKvqhCp+FihTJBxgpf/sPUkkNJkaBcH7Rf7OMKn+8NHQ3quSF3y+1GENf6vnr54AuCxiRyMRPVwGD16De2hiI+l+CY62993GX1CU2QiLTY/u3VX4+Hjke/MT/S+59VTd5t/Tsb2Ngz/D7+7R/w1d0om4hamRg6xdPzpb7kdih0tQo1cEW23qoAFmBt6Cu4AtZxV3t+Z5lgmrFSCaxIXXyBZcaNeptXXWIF9VFK3akL9uaSG2fvl80iOZihi8dUaFb1N28r8NGWlZLec2HpqKPkswYIsTCwdoIkPlBW2kKUw== 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=271HAeafWP9n7OZDlZqDB10ArtHBR7BySMK7MnftyN4=; b=DR2/GVm4EsuedIhSGDZH0SkducrmH/hrEDmArF1H3ekfMyts8jmgFA2/+ZXLUZ8xmrgcnumDnZ6CxnOtsS8THWJIerG2FQeUrdspNN9GE1V43rxYIgmsgfy/2cGWIaSwoEEWh+GuNrBvaeB+AWVLU5mrP1U+GlrEbT+5X8DaLsWEF6XPzWrO9y/Nv+AjdIh9DzdcbE0k2b5qhz49xomlIR0f2pMtcniNSoteIeFFI+VFc5fqVWMC8noHUkB9lS3304RXdMCiGGU97QE7RzQyTtHrfrHnkYz33XaR1jp9FCwThBmGfg0Fh8jrf/WIZabfO5WFvlFIpTKLsbcy/QJ3xw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=271HAeafWP9n7OZDlZqDB10ArtHBR7BySMK7MnftyN4=; b=2c8uZed6X40co24R5EwumD14bTnJtnslLSDpC+6Wu9eUWKXvDg2vTWSE4GT6tqP2XzrMrPBM5fGeXOCQKJED2l6sd3fatcqUQkxr/7WKIbhwJkSFu9yB6azocAwgeJmw00gKgnQPXcS6pQZqc4gB36LjDYgst+ehO5z/DjDPlUs= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from MW2PR12MB2379.namprd12.prod.outlook.com (2603:10b6:907:9::24) by SJ1PR12MB6146.namprd12.prod.outlook.com (2603:10b6:a03:45b::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.34; Wed, 6 Mar 2024 10:18:23 +0000 Received: from MW2PR12MB2379.namprd12.prod.outlook.com ([fe80::3150:d50f:7411:e6bb]) by MW2PR12MB2379.namprd12.prod.outlook.com ([fe80::3150:d50f:7411:e6bb%5]) with mapi id 15.20.7339.035; Wed, 6 Mar 2024 10:18:23 +0000 Message-ID: Date: Wed, 6 Mar 2024 15:48:00 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.13.1 Subject: Re: [RFC PATCH 00/14] Introducing TIF_NOTIFY_IPI flag Content-Language: en-US To: Vincent Guittot Cc: linux-kernel@vger.kernel.org, "Gautham R. Shenoy" , Richard Henderson , Ivan Kokshaysky , Matt Turner , Russell King , Guo Ren , Michal Simek , Dinh Nguyen , Jonas Bonn , Stefan Kristiansson , Stafford Horne , "James E.J. Bottomley" , Helge Deller , Michael Ellerman , Nicholas Piggin , Christophe Leroy , "Aneesh Kumar K.V" , "Naveen N. Rao" , Yoshinori Sato , Rich Felker , John Paul Adrian Glaubitz , "David S. Miller" , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , "Rafael J. Wysocki" , Daniel Lezcano , Peter Zijlstra , Juri Lelli , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider , Al Viro , Linus Walleij , Ard Biesheuvel , Andrew Donnellan , Nicholas Miehlbradt , Andrew Morton , Arnd Bergmann , Josh Poimboeuf , "Kirill A. Shutemov" , Rick Edgecombe , Tony Battersby , Brian Gerst , Tim Chen , David Vernet , x86@kernel.org, linux-alpha@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-openrisc@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-pm@vger.kernel.org, Julia Lawall References: <20240220171457.703-1-kprateek.nayak@amd.com> From: K Prateek Nayak In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: PN3PR01CA0192.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c01:be::16) To MW2PR12MB2379.namprd12.prod.outlook.com (2603:10b6:907:9::24) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MW2PR12MB2379:EE_|SJ1PR12MB6146:EE_ X-MS-Office365-Filtering-Correlation-Id: 404a825b-adf7-4eaf-2334-08dc3dc6c0e3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JgNXHZzeqgyRXeP6T7vOLSRet2PVzH3+BMYJsAjRNrIhVZ4Ww5kMc0LnEvULhmwpxW0cG8HCAW58pXI0vnRfHXPzZlXL1PjghOf8vCXAcm44EiLi99vzUEbP5Frv+tNQAd0lVMClSGsuoRnlH/eTVjiNJ+YWJWDakjeZIxpyIXAbN2PaFPONYV8jRSvZsirs/S9w/bIDgpfjI9qWDPyraVOQtUFwGWk6SC48z5MEUvJ1kS9ox5FT/HIGRcjNEyX3pnPVEanIMA7l/xqqZJkqAYOglO2k8DkMJXWK2/lSZqI4ibcJchpGSVGcoVQcKiFulvLJhuyG9C4sDXaI5WtIaeBKCMuIod9QNz7sKjUXmHjq+Y3T8XVAwXbLMLeBF2e7H/C7pMnP0QJjFHKdZ23Ucwk9788kxEnpngjam8UZK0XSoNouG9sT33Kxhs6t+wDNNhlYd/cwjAafMDM2seU4xwtArw+z/7YlKpssMLJX+21de9WACozWIVPhnWCAuEs39II4BCrf4fuCLgL7p/HqLqFEHH0V5UkxWPNmo7lXOPd2KEuBTKU9gHEKJP1qIm7KDCaZv07eeWDJFnnpN7b4nlAf1/WfD+xkQqjRQzGxjGlDVfyI0jysX8iAJetpPQ7a X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MW2PR12MB2379.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?Z3FBK1lmZHNCcDlqTFhha3ZjdHVSdzhaLzlqaE9seFJjdHNzeWZVK0RkTGwx?= =?utf-8?B?MkdQaFA3NVpXSkN1OGJOeVpwR09wYzNyQi9zRFVMNUtNVjdwTU50YzZrS1Nw?= =?utf-8?B?UlYzcytxTDR2QlpJc0hScFM3R0dHcW00c002am0zejF6bFB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VlsamRmdUdzQktL?= =?utf-8?B?NUlsbll3bUNkY1JvSU4zcTBJRnVqRGV0RjZSTDJkQUFBWFZYM3I5TVVTaTBo?= =?utf-8?B?ZzVYeGtLTmVoZmUvcHNMdEJxQXA1MHVDcDlnUi9Qamg0N2NhYm5tbXBFcTZL?= =?utf-8?Q?GSYAXrRfmKXHExTDyYI5tZPko?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 404a825b-adf7-4eaf-2334-08dc3dc6c0e3 X-MS-Exchange-CrossTenant-AuthSource: MW2PR12MB2379.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Mar 2024 10:18:23.1766 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: c+MbiJnl6k0arshKYqL5YUo5amx69vThIYAgOi+z6rR54wa3qW1yFPzYt4Jch8A+HpehTn+GiXM8swO87ahncQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ1PR12MB6146 Hello Vincent, Thank you for taking a look at the series. On 3/6/2024 3:29 PM, Vincent Guittot wrote: > Hi Prateek, > > Adding Julia who could be interested in this patchset. Your patchset > should trigger idle load balance instead of newly idle load balance > now when the polling is used. This was one reason for not migrating > task in idle CPU Thank you. > > On Tue, 20 Feb 2024 at 18:15, K Prateek Nayak wrote: >> >> Hello everyone, >> >> [..snip..] >> >> >> Skipping newidle_balance() >> ========================== >> >> In an earlier attempt to solve the challenge of the long IRQ disabled >> section, newidle_balance() was skipped when a CPU waking up from idle >> was found to have no runnable tasks, and was transitioning back to >> idle [2]. Tim [3] and David [4] had pointed out that newidle_balance() >> may be viable for CPUs that are idling with tick enabled, where the >> newidle_balance() has the opportunity to pull tasks onto the idle CPU. >> >> Vincent [5] pointed out a case where the idle load kick will fail to >> run on an idle CPU since the IPI handler launching the ILB will check >> for need_resched(). In such cases, the idle CPU relies on >> newidle_balance() to pull tasks towards itself. > > Calling newidle_balance() instead of the normal idle load balance > prevents the CPU to pull tasks from other groups Thank you for the correction. > >> >> Using an alternate flag instead of NEED_RESCHED to indicate a pending >> IPI was suggested as the correct approach to solve this problem on the >> same thread. >> >> >> Proposed solution: TIF_NOTIFY_IPI >> ================================= >> >> Instead of reusing TIF_NEED_RESCHED bit to pull an TIF_POLLING CPU out >> of idle, TIF_NOTIFY_IPI is a newly introduced flag that >> call_function_single_prep_ipi() sets on a target TIF_POLLING CPU to >> indicate a pending IPI, which the idle CPU promises to process soon. >> >> On architectures that do not support the TIF_NOTIFY_IPI flag (this >> series only adds support for x86 and ARM processors for now), > > I'm surprised that you are mentioning ARM processors because they > don't use TIF_POLLING. Yup I just realised that after Linus Walleij pointed it out on the thread. > >> call_function_single_prep_ipi() will fallback to setting >> TIF_NEED_RESCHED bit to pull the TIF_POLLING CPU out of idle. >> >> Since the pending IPI handlers are processed before the call to >> schedule_idle() in do_idle(), schedule_idle() will only be called if the >> IPI handler have woken / migrated a new task on the idle CPU and has set >> TIF_NEED_RESCHED bit to indicate the same. This avoids running into the >> long IRQ disabled section in schedule_idle() unnecessarily, and any >> need_resched() check within a call function will accurately notify if a >> task is waiting for CPU time on the CPU handling the IPI. >> >> Following is the crude visualization of how the situation changes with >> the newly introduced TIF_NOTIFY_IPI flag: >> -- >> CPU0 CPU1 >> ==== ==== >> do_idle() { >> __current_set_polling(); >> ... >> monitor(addr); >> if (!need_resched_or_ipi()) >> mwait() { >> /* Waiting */ >> smp_call_function_single(CPU1, func, wait = 1) { ... >> ... ... >> set_nr_if_polling(CPU1) { ... >> /* Realizes CPU1 is polling */ ... >> try_cmpxchg(addr, ... >> &val, ... >> val | _TIF_NOTIFY_IPI); ... >> } /* Does not send an IPI */ ... >> ... } /* mwait exit due to write at addr */ >> csd_lock_wait() { ... >> /* Waiting */ preempt_fold_need_resched(); /* fold if NEED_RESCHED */ >> ... __current_clr_polling(); >> ... flush_smp_call_function_queue() { >> ... func(); /* Will set NEED_RESCHED if sched_ttwu_pending() */ >> } /* End of wait */ } >> } if (need_resched()) { >> schedule_idle(); >> smp_call_function_single(CPU1, func, wait = 1) { } >> ... ... /* IRQs remain enabled */ >> arch_send_call_function_single_ipi(CPU1); -----------> /* Processes the IPI */ >> -- >> >> Results >> ======= >> >> With the TIF_NOTIFY_IPI, the time taken to complete a fixed set of IPIs >> using ipistorm improves drastically. Following are the numbers from the >> same dual socket 3rd Generation EPYC system (2 x 64C/128T) (boost on, >> C2 disabled) running ipistorm between CPU8 and CPU16: >> >> cmdline: insmod ipistorm.ko numipi=100000 single=1 offset=8 cpulist=8 wait=1 >> >> ================================================================== >> Test : ipistorm (modified) >> Units : Normalized runtime >> Interpretation: Lower is better >> Statistic : AMean >> ================================================================== >> kernel: time [pct imp] >> tip:sched/core 1.00 [0.00] >> tip:sched/core + revert 0.81 [19.36] >> tip:sched/core + TIF_NOTIFY_IPI 0.20 [80.99] >> >> Same experiment was repeated on an dual socket ARM server (2 x 64C) >> which too saw a significant improvement in the ipistorm performance: > > Could you share more details about this ARM server ? Could it be an Arm64 one ? > I was not expecting any change for arm/arm64 which are not using TIF_POLLING I looked at the lscpu output and it said It was an "aarch64" server with model name "Neoverse-N1". Let me go back and test it once again just to be sure I did not catch a one off behavior (Might be a while since I have limited access to this machine) I'll also add a debug WARN_ON_ONCE() to see if "TIF_NOTIF_IPI" is being set. > > >> >> ================================================================== >> Test : ipistorm (modified) >> Units : Normalized runtime >> Interpretation: Lower is better >> Statistic : AMean >> ================================================================== >> kernel: time [pct imp] >> tip:sched/core 1.00 [0.00] >> tip:sched/core + TIF_NOTIFY_IPI 0.41 [59.29] >> >> netperf and tbench results with the patch match the results on tip on >> the dual socket 3rd Generation AMD system (2 x 64C/128T). Additionally, >> hackbench, stream, and schbench too were tested, with results from the >> patched kernel matching that of the tip. >> >> >> Future Work >> =========== >> >> Evaluate impact of newidle_balance() when scheduler tick hits an idle >> CPU. The call to newidle_balance() will be skipped with the > > But it should call the normal idle load balance instead Yup, but the frequency of normal idle balance will be lower than the frequency at which a newidle balance is being triggered currently if tick is not disabled right? Please correct me if I'm wrong. > >> TIF_NOTIFY_IPI solution similar to [2]. Counter argument for the case is >> that if the idle state did not set the TIF_POLLING bit, the idle CPU >> would not have called schedule_idle() unless the IPI handler set the >> NEED_RESCHED bit. >> >> >> Links >> ===== >> >> [1] https://github.com/antonblanchard/ipistorm >> [2] https://lore.kernel.org/lkml/20240119084548.2788-1-kprateek.nayak@amd.com/ >> [3] https://lore.kernel.org/lkml/b4f5ac150685456cf45a342e3bb1f28cdd557a53.camel@linux.intel.com/ >> [4] https://lore.kernel.org/lkml/20240123211756.GA221793@maniforge/ >> [5] https://lore.kernel.org/lkml/CAKfTPtC446Lo9CATPp7PExdkLhHQFoBuY-JMGC7agOHY4hs-Pw@mail.gmail.com/ >> >> This series is based on tip:sched/core at tag "sched-core-2024-01-08". >> [..snip..] >> -- Thanks and Regards, Prateek