Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2684419rwb; Thu, 17 Nov 2022 14:36:37 -0800 (PST) X-Google-Smtp-Source: AA0mqf4V4jV3/tquxw31hnB5MrgMQAQqaMsM9g5McCPmlR2whVPGWOkE0wQ459lf2kQf2LO17fyI X-Received: by 2002:a17:907:2b15:b0:78d:51c0:d4d1 with SMTP id gc21-20020a1709072b1500b0078d51c0d4d1mr3776916ejc.161.1668724597096; Thu, 17 Nov 2022 14:36:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668724597; cv=none; d=google.com; s=arc-20160816; b=DOVX//bZyyFS5PYoijd14Kf5pxAIJNltHJY3lSKowdT1ar7Q2NRhaHzyEIzYyT0q02 7a2rXLwAwEpgutYuP8eD2dSTMAnEypnc8e3S/0FTUfY3aDwbv+9+PYFUgb/g8869vLVI 0sHnA7rWR5IUkiKOi86lwsU7q9M3gIGSy33uIsJ7fakAlgzTGp3qKNpkwzEwvd8g1fJL hiOUx96q/DWRTg6nysfn69jDSAINRFHeSP4jEGwC/NxnRpf5IXiVLHv3OTZpujLDu9dO ly5RaxHyhlJ3BJQZXGtcwCT56qZA6IIUrXXnD9MgxXDPjR4ZMPj/2mzk3I1pgKqPlkDU m3ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=5/UXFlE3vK9sqXsSqjwPsBeKdWavxCCCoC3BM8hFreY=; b=UUsOWHe+8lI17LmoZTOxPFXtvv5Pbc6hRa9hCHpRPNPWcR8uj9b5oEsbXDcCmpBhW/ SWZgl01AhMFCmgwAiEwC6gVIMprztLtgSZymL1nyAgToVod3pf/F3FzeCkQ31VoqxL4p RSsFT1HvLq+Rwf2IB56/l+BM5r1GBnJktfxprjSwhpjdS9SB4JzAc3rqu3lZ2zPC1UJH tEwemtwRUMQrRBR5zjiSP1+NmY/3EVmwSYsi7ezCjJ+S9tc3ySH7jXe9VHJaDFt2SVkF kDNYOLaGVubZyaplQQo9d5CXRTUF5BNh5Tct64ZL792DIUst/AEJLAc6Acj5JzVzisfi +y6g== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qq18-20020a17090720d200b0078d83fb6672si1358928ejb.118.2022.11.17.14.36.12; Thu, 17 Nov 2022 14:36: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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241052AbiKQWCW (ORCPT + 92 others); Thu, 17 Nov 2022 17:02:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241232AbiKQWCB (ORCPT ); Thu, 17 Nov 2022 17:02:01 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64BC384323 for ; Thu, 17 Nov 2022 14:00:32 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0A8B1622A0 for ; Thu, 17 Nov 2022 22:00:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 22538C433D7; Thu, 17 Nov 2022 22:00:30 +0000 (UTC) Date: Thu, 17 Nov 2022 17:00:28 -0500 From: Steven Rostedt To: Xuewen Yan Cc: , , , , , , , , , , Subject: Re: [PATCH] sched/rt: Use cpu_active_mask to prevent rto_push_irq_work's dead loop Message-ID: <20221117170028.04fd7013@gandalf.local.home> In-Reply-To: <20221114120453.3233-1-xuewen.yan@unisoc.com> References: <20221114120453.3233-1-xuewen.yan@unisoc.com> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS 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 On Mon, 14 Nov 2022 20:04:53 +0800 Xuewen Yan wrote: > +++ b/kernel/sched/rt.c > @@ -2219,6 +2219,7 @@ static int rto_next_cpu(struct root_domain *rd) > { > int next; > int cpu; > + struct cpumask tmp_cpumask; If you have a machine with thousands of CPUs, this will likely kill the stack. > > /* > * When starting the IPI RT pushing, the rto_cpu is set to -1, > @@ -2238,6 +2239,11 @@ static int rto_next_cpu(struct root_domain *rd) > /* When rto_cpu is -1 this acts like cpumask_first() */ > cpu = cpumask_next(rd->rto_cpu, rd->rto_mask); > > + cpumask_and(&tmp_cpumask, rd->rto_mask, cpu_active_mask); > + if (rd->rto_cpu == -1 && cpumask_weight(&tmp_cpumask) == 1 && > + cpumask_test_cpu(smp_processor_id(), &tmp_cpumask)) > + break; > + Kill the above. > rd->rto_cpu = cpu; > > if (cpu < nr_cpu_ids) { Why not just add here: if (!cpumask_test_cpu(cpu, cpu_active_mask)) continue; return cpu; } ? -- Steve