Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp1726709pxm; Thu, 24 Feb 2022 08:16:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJzQn2unFqU0J45SWk72j04F5vn/6LpdHmZMY/6myL7vpbdMJ3/a55hnaYnle6p2Q+ADp4eK X-Received: by 2002:a63:5055:0:b0:372:f0e7:c034 with SMTP id q21-20020a635055000000b00372f0e7c034mr2845585pgl.4.1645719415347; Thu, 24 Feb 2022 08:16:55 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1645719415; cv=pass; d=google.com; s=arc-20160816; b=OhmPK6v5nA//z3AxxaPoI5h6hA51aqHBJYuD/V8/i9PUBZCotKErXNTf29+3qQCvhq MctX0Pyhal8ZCYOBQdGgMDLllKqMtV6YzHALsL9uiS7roTHBmUpjnpUo6QOKF4yR5nxR 1qP/JgSxeNm828XGn0jjTP3EH1CUgOrGuEjWBTgnwBejU7ICAVIsZmp3X9TE25xeLkRA dyaiQc7+LOKfPmRs9ISOug9sswjH1miFD1vhP4xwiJ4vs1TCFC8aJFY5lDER3fU/qiLD /jDZ2uYZpus8X2DUuKsh85zltHJTdo+CqbIeXpiJuEQwhJ/1MDtjr7C40UrAz/qQj9RD cTTQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:from:references:cc:to:content-language:subject :user-agent:date:message-id:dkim-signature; bh=GYis6gzglkzZrK5gceFhoN3RWFonpWTJ7udpinbUCoo=; b=fv9S3OWhBu58gysmHb6ds3RFSu6oOTdWamFf0srBG5BFDFaZCYqr+0w9TazWByDlXr ObK08p4VwFJ3S96euHfNkKZ7Posvawlfa14s7l89L58nxvTh3jdVBiqbghYkhNkSvZzo VTmd1LtHRG6PDpVsv7TE+hlkgBubKqup/2jSewDIju/BZKD8VIjDoOBS7VSPmL24Tuof MxaQdzu6pw2WlrhFYvpBZPk4HBbKaMuufqQmkBK3AI1yNpdYFXWP1RrAPm0MpRbzgjT1 Bjva+kjXIqItp3dR93B5s2a26F7iP8D4haSvRW12aOaBs5iHCd9LleMFLPK3jIZchxS6 X3vQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=Ud2sow3J; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id e8si2665659pls.253.2022.02.24.08.16.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Feb 2022 08:16:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=Ud2sow3J; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2CEA11B6092; Thu, 24 Feb 2022 08:10:21 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235110AbiBXPF4 (ORCPT + 99 others); Thu, 24 Feb 2022 10:05:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231255AbiBXPFy (ORCPT ); Thu, 24 Feb 2022 10:05:54 -0500 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2056.outbound.protection.outlook.com [40.107.236.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D47E818DA97 for ; Thu, 24 Feb 2022 07:05:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iEW++C085/mOGCotK62cifhJkJjx+RdbfEq08Y/DdEOlHQK3m/mKDy4p6kr7fY9LXhRWzG0/SKrgTRrfeSrRqtgIZRjLP/073oU8UrlypTvVofjU9NQbaFHVnE7xlPsffo9cFt66e4TRDBFZA0DIzZhkxR+X0jHN8C1xxKqx5cLiSF0+1NiMPypAeh6QsWk/RVEhrb7SHbT8GdoqpoIZpaqs+JpoA2Dk3ISuoQ0ueiGhZHkfcygo13HxKLAilIDSxmZ2/+9ZQ1AYP5F7o+PpNkNhXBvbNwh4R0jZ7uh8Ve4nuDOooaSERAIP9/wQVicwD/IA+8nsWm+EuDM8T5IyRw== 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=GYis6gzglkzZrK5gceFhoN3RWFonpWTJ7udpinbUCoo=; b=NfS389qyfGwPgDH8yS/lc0P3JBLZbuf5vXE82w85dWuR0mmorsYrB8z9ntMECoNqHXvoY6SyCOVAtsXpwpv2AKn1JOGUCRMPXhiKFI5sAVj+gY/+8oPMtK7Bf55doeK1Y+B/4MNtfFcQyoW3PL1V/UL5VsL4Kttu5arOytpT1dpEMpfTkLHorpFgKtER/qLUSJLzIht8oKObcd+gFxcYZQ21HOxFXJs2BHGt6F8i54epTNVVQxzLLivlmWPHHGJ+mK7Zby9Bs8pjzjjBlAoDjGaxN5Q1fn6ndtpskHfxelaydnL/8qNB/diQc/CnSH0beA5n7KlRqPOktqHOLYv2aw== 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=GYis6gzglkzZrK5gceFhoN3RWFonpWTJ7udpinbUCoo=; b=Ud2sow3JETx3dVkpAiiM5NvacEVHXsFX16lNZt42EKriEkiIJdUGuwVvVnNHZ7Yu+CNaJjLH7H5l7KXyE8bnOAKRGAVluNBoG+SVCRayeh+XR+AJs82nSQBq5DPn619uJBsjE375b9EEZnwpuc8cxn+iO1blHeARpJZ0kfpMoaU= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from BL1PR12MB5874.namprd12.prod.outlook.com (2603:10b6:208:396::17) by CY4PR12MB1846.namprd12.prod.outlook.com (2603:10b6:903:11b::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4995.24; Thu, 24 Feb 2022 15:05:16 +0000 Received: from BL1PR12MB5874.namprd12.prod.outlook.com ([fe80::8d44:d69b:b031:1d50]) by BL1PR12MB5874.namprd12.prod.outlook.com ([fe80::8d44:d69b:b031:1d50%4]) with mapi id 15.20.5017.023; Thu, 24 Feb 2022 15:05:16 +0000 Message-ID: Date: Thu, 24 Feb 2022 09:05:14 -0600 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Subject: Re: [PATCH v2] kernel/sched: Update schedstats when migrating threads Content-Language: en-US To: Phil Auld , mingo@kernel.org Cc: Peter Zijlstra , juri.lelli@redhat.com, vincent.guittot@linaro.org, mingo@redhat.com, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, bristot@redhat.com, linux-kernel@vger.kernel.org References: <20220126152222.5429-1-carlos.bilbao@amd.com> <0e42c46a-ccc4-e793-00b8-ae407e06846f@amd.com> <3c6224ca-c0da-7ba9-1396-a2e74c4a40e8@amd.com> From: Carlos Bilbao In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: BL1PR13CA0223.namprd13.prod.outlook.com (2603:10b6:208:2bf::18) To BL1PR12MB5874.namprd12.prod.outlook.com (2603:10b6:208:396::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ec508239-1768-4c77-f9ab-08d9f7a7108c X-MS-TrafficTypeDiagnostic: CY4PR12MB1846:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Uq80qdcgh1ZsgrBqDFK6xJ627I5XSxNPI64Lt4cnsmlT0NPIz0HWCkRzSSAXgUXZ5n+yC/Jpsb1by4fm/G8Noy6wCyAUidMUdsfLRKGjZlbm396WQh/gOxeXYcAUt+cUzSLBHZwYoau1UWWYFxJVnwHj7bAejg1M80airchsbDSSBMoqlF4lOrSAElSO6k9vDQcdZuG9Qcco38I/wx+p0KshOmqkEVm0q1DwmCn+MGqcoB5XQQOnfG1NN0ODpMqvOJJUAm8JLm87cZK9IBntkb2pYtA8e8RlDvBbn7Oxi7ADRba7oUSOHGopyEgxD1D2Q7GWT/pDZ7ZDX+Spg07jgl0fgGTt1mQK/C/OyBJy3MyOoMpDMwN8USwVeNE9DKvchWLuZsf14p/mRsOF4/CNu1pUhpQlTnmnYZIzoqWQGVtiXg0oCL3vNscLWxjqn0Rcml8GiwA4oBu0SGLd4u+pL/GMGvkkFBr5zuDOvr+roVdJVW9F1PbRyRaYtMhjuE+estKOVDxRue3yhosjtZw+KRgDFlpsYDNTATyNnHRzjWmyolNBm4LBEW5+VjUP4RV5AcQDbUircmbPWdg4U/h7ocy9NySRksaWasgkUkGuc5aMohml0+CuE2jTFeYu5Wq9efLvOl5qlwSggxAS943j0eOekPf120pFT7z0G9khpPSD2F36RAQ1VNXvZ1wfi+wMsjiAgQxBL+CcaVnmTK/dSLMSu+QZ7btbq75sLU7gD+jpC72lqv6n4nZdV0pIBPGd X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BL1PR12MB5874.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(2906002)(38100700002)(86362001)(53546011)(31696002)(6512007)(6486002)(36756003)(66476007)(508600001)(316002)(4326008)(66946007)(8676002)(15650500001)(5660300002)(44832011)(8936002)(7416002)(186003)(26005)(83380400001)(2616005)(66556008)(31686004)(6506007)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?U1d2ZWZMZzYrM2IzM1VyMDJZYWVkYW1xU2FxNzZ6OXlJV2VxaExHRm85aGFo?= =?utf-8?B?bUFpQVBpbWRCMEI1QlRTaG8zUjg0RWJnWmpLSkR2RDZCUnNBTGRvU1Zuc2R4?= =?utf-8?B?aDdXRk5Zb0l4YTdvZkREcUl3QWp3UlJaNG1OaWFyQSt1VlNwYlhNb2NhMHBv?= =?utf-8?B?dFc5Q3VEcXZPeHdNclNmdE9GeFVlSS9GMG5PZUNrdlpvaHByb2tsVXAzamZC?= =?utf-8?B?WU9GS21IRGJaNVFFWE4rdkhlakNLSTlWT05sUk5Bb21LekRqS0xNODVGL3ph?= =?utf-8?B?THJPSmtlRHArUUNiOHVlRHA3WWwxNS9jTERFM1d2akpXQW42bUNTdTFieFFI?= =?ut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WkFrNVlheWFBUVVySTdTNTFZRzRjd1Rka3h5?= =?utf-8?Q?ZssX7HQkt60h60WKcqIS6v8=3D?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: ec508239-1768-4c77-f9ab-08d9f7a7108c X-MS-Exchange-CrossTenant-AuthSource: BL1PR12MB5874.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Feb 2022 15:05:16.0784 (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: U0prkkf63ikr7RfDvlPEnSfLd4aVYn327qXZ90reGxBkVl/QuyR51E46nKQuiL8SWz1YZ/5rZjAsJVSkTHimFA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1846 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=no 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 On 2/24/2022 8:03 AM, Phil Auld wrote: > On Wed, Feb 23, 2022 at 10:13:50AM -0600 Carlos Bilbao wrote: >> The kernel manages per-task scheduler statistics or schedstats. Update >> function migrate_task_to() to increase the counter for migrations. >> >> Signed-off-by: Carlos Bilbao >> --- >> Changelog: >> v2: Update commit message, don't reinitialize sched fields. >> --- >> kernel/sched/core.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/kernel/sched/core.c b/kernel/sched/core.c >> index fcf0c180617c..1360e501c737 100644 >> --- a/kernel/sched/core.c >> +++ b/kernel/sched/core.c >> @@ -8751,7 +8751,7 @@ int migrate_task_to(struct task_struct *p, int target_cpu) >> if (!cpumask_test_cpu(target_cpu, p->cpus_ptr)) >> return -EINVAL; >> >> - /* TODO: This is not properly updating schedstats */ >> + schedstat_inc(p->stats.nr_migrations_cold); >> > > I was going to give a reviewed by since I was looking at this, > but I can't convince myself that nr_migrations_cold is right. > This looks more like a "hot" migration (using stop_cpu to force > it). But nr_migrations_cold is not incremented anywhere else so > maybe it's a terminology thing. > > Can you tell me why this is the right counter? > > The alternative to nr_migrations_cold is nr_forced_migrations, and since we call this function in the context of NUMA balancing it didn't seem like an appropriate fit at first glance. But documentation in this is scarce and I'm not very confident with the terminology either. Maybe Ingo Molar -the original author of the structure- can clarify the specifics of these two counters so we can be sure about this? Maybe we need a new counter? > Thanks, > Phil > > >> trace_sched_move_numa(p, curr_cpu, target_cpu); >> return stop_one_cpu(curr_cpu, migration_cpu_stop, &arg); >> -- >> 2.27.0 >> > Thanks, Carlos