Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp262365pxb; Tue, 19 Oct 2021 02:17:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyuOogF+qrV/1s7cDLqmNbTD0rJ4VG7bQGVnT+QgXz9G860oLMQAcWofWyUq73T1JPektH6 X-Received: by 2002:a17:906:b247:: with SMTP id ce7mr36063863ejb.473.1634635069609; Tue, 19 Oct 2021 02:17:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634635069; cv=none; d=google.com; s=arc-20160816; b=PwQ8qHd9xNK5wUZNQni4j0RXcjPHk2gEBcOAeHbwYZ86kdcnrI/s2Mk4JcjRn5tJRt JxBzqgbPRrsT21BeWA/BvNa2niMoHctSbpWbfUwYEO+wiYQ81HLSDOtMLST3pE/b35hq REu6fe7SBTtij/gi4mLJP/BydkjZ8NF8hCwgeRtIM1C6Ipq3rCbNOL5x91pQbiXLqJeO bEBNepNS4ZvZdZ0kXP7PcdxcPZS7E2MYyG4aeTMetlN/68Pgj3DB/sjO9UtBvqymKN3Y Vap3mUhPua7OMn7kyiGyjxv8fgfBXDWh4CpvUDT/m1CdyS4J5EbfIJ0eJMoDiFXNQ76F sFMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=M74+/if23OdvvyA6a/gJ9u3knPoaJ8QASoM6JWUmAfg=; b=SMjm0sRWh5sDhcUbUrQIwQlOmKluscSAJyAoh3ON29GSsR8+C8iiZHVy/IsOKWcbJ6 j2F45TDKsYbdOMzSJvSX1R3pXxCCh90/LUbCEiVzAKn4mukdxn7L+FWRxrWubMyTZhL1 j+WQB3bbfSTv+qpXH0BR2kvKpOasuBJVWA1yJYjw06iBUmmoXHbenojerlcvyAmGwpPb VCtk0NPs3y1fKKL77ZDg1I3WQnTpgzzHOHlcDUOCkOHHetH3aC7fmfjxQ5ZXaG27+XyJ l8tgNmpGAh77qT/1ixkog1jQ+C/9jweWFwfAMAWRMC7c6PS3hVylhsC0oNzr7CgvTEpf P/aw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=vYHOQbqw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dp17si31545006ejc.636.2021.10.19.02.17.24; Tue, 19 Oct 2021 02:17:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=vYHOQbqw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234996AbhJSJRt (ORCPT + 99 others); Tue, 19 Oct 2021 05:17:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234511AbhJSJRq (ORCPT ); Tue, 19 Oct 2021 05:17:46 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64B1EC061768; Tue, 19 Oct 2021 02:15:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=M74+/if23OdvvyA6a/gJ9u3knPoaJ8QASoM6JWUmAfg=; b=vYHOQbqwa8BG777Qm7rqJzKO0w vkvU8IjgOjvSIJwmaEWntGl+X0usNC6/NqijaY6z9GczT6VgIlVYE+mcs0I7wc+rf0i6jDU8Qifx/ Donz7RFxenTlsZVs2mXjt0UPmkvuQdMQ9Edn4Tumq/r78A7zXHO+BenWdvnS2nNybPE4eTv1G4UxR dE5Hn3fQbDwVHrP1RGjH5SU8NbJKqoZwUKc1ku69PZBQiIJUxCw37eEq2NqRG2gtu+l3rsAB++AXL AqV7zz/GG2plIOYjN19IuYFkEIBt/e0wPIp5RhTxoG/vbfiYcdDnHSbDVv5PVwy0vMzDp7R/uVTfR XjrmaEqA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1mcl8a-00BeBf-Ny; Tue, 19 Oct 2021 09:11:33 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id A78FD300221; Tue, 19 Oct 2021 11:10:24 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 8E7A52C6A7ABD; Tue, 19 Oct 2021 11:10:24 +0200 (CEST) Date: Tue, 19 Oct 2021 11:10:24 +0200 From: Peter Zijlstra To: Qian Cai Cc: gor@linux.ibm.com, jpoimboe@redhat.com, jikos@kernel.org, mbenes@suse.cz, pmladek@suse.com, mingo@kernel.org, linux-kernel@vger.kernel.org, joe.lawrence@redhat.com, fweisbec@gmail.com, tglx@linutronix.de, hca@linux.ibm.com, svens@linux.ibm.com, sumanthk@linux.ibm.com, live-patching@vger.kernel.org, paulmck@kernel.org, rostedt@goodmis.org, x86@kernel.org Subject: Re: [PATCH v2 04/11] sched: Simplify wake_up_*idle*() Message-ID: References: <20210929151723.162004989@infradead.org> <20210929152428.769328779@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 19, 2021 at 10:56:48AM +0200, Peter Zijlstra wrote: > On Mon, Oct 18, 2021 at 11:47:32PM -0400, Qian Cai wrote: > > Peter, any thoughts? I did confirm that reverting the commit fixed the issue. > > > > On 10/13/2021 10:32 AM, Qian Cai wrote: > > > > > > > > > On 9/29/2021 11:17 AM, Peter Zijlstra wrote: > > >> --- a/kernel/smp.c > > >> +++ b/kernel/smp.c > > >> @@ -1170,14 +1170,14 @@ void wake_up_all_idle_cpus(void) > > >> { > > >> int cpu; > > >> > > >> - preempt_disable(); > > >> + cpus_read_lock(); > > >> for_each_online_cpu(cpu) { > > >> - if (cpu == smp_processor_id()) > > >> + if (cpu == raw_smp_processor_id()) > > >> continue; > > >> > > >> wake_up_if_idle(cpu); > > >> } > > >> - preempt_enable(); > > >> + cpus_read_unlock(); > > Right, so yesterday I thought: YW2KGrvvv/vSA+97@hirez.programming.kicks-ass.net > but today I might have another idea, lemme go prod at this a bit more. Here, hows this then? --- diff --git a/kernel/smp.c b/kernel/smp.c index ad0b68a3a3d3..61ddc7a3bafa 100644 --- a/kernel/smp.c +++ b/kernel/smp.c @@ -1170,14 +1170,12 @@ void wake_up_all_idle_cpus(void) { int cpu; - cpus_read_lock(); - for_each_online_cpu(cpu) { - if (cpu == raw_smp_processor_id()) - continue; - - wake_up_if_idle(cpu); + for_each_cpu(cpu) { + preempt_disable(); + if (cpu != smp_processor_id() && cpu_online(cpu)) + wake_up_if_idle(cpu); + preempt_enable(); } - cpus_read_unlock(); } EXPORT_SYMBOL_GPL(wake_up_all_idle_cpus);