Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp5264012rwd; Mon, 5 Jun 2023 00:31:12 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ46ykHoJCE6/AXOlvxy04U5Keyc58GhmlM9dafgYLDCqSezBYkgFmFJj7xtN/qKph9UPu7J X-Received: by 2002:a05:6a00:1688:b0:638:7e00:3737 with SMTP id k8-20020a056a00168800b006387e003737mr14276490pfc.23.1685950271813; Mon, 05 Jun 2023 00:31:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685950271; cv=none; d=google.com; s=arc-20160816; b=q05BjiXIu60NPuQ60b1Z3hElGwDebUz1X47a6FHLi49/qtqNT3O3xn+aLQha/U6Lpz OZ59EIIBPaKSFmhGDVk2JrwSPmt8YGz9Q5bD9VtP/zMDH3zziXw1/N1C2918DQ/vj3Fe CJiVw8AmIu1HWn4QE5VnKyP9L8FbBAp7HRoYsSmvkJOyGgFcys/l2BBeMWZOeW5DiIUL p9K6ss9Y14z4rLlLRRlyvL1qhdAvlu864q7t4UUhaUkmKzxwDoV1Nwn8izQtpyx7MwW1 WjaWP+MZCPnBE1eL9kfMGBBjCeut8/Tq3gi1dS5j02+iQ+dyM3Kijdl9CeleQOlLTBns kW7Q== 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=XfVQ9uT9kbRVvxZWdoeBj7hWEgfYxWlxzh+N0mhwC9U=; b=t2gnDPITVMSzL2W9InhdBt62AZyCiXCG+WEq2E3NGnosoeqkGYfQJi9qxGNBcxvFdi uu+uM+FnRrHePreVdQQRttlsn3S1LMEhHp0LzwGnpKy/bHCvFWd9lR+cxvi2HuaRPGsc mSzNMmU5GgoNiCAR7NXd3r4EgUsg/GPTpqXafukOcui0mXkClFwaE2PHDTdS5l53hTUN tNB6OsigcBfwcG2PoWNzeVWg44fwtA/T78ouIhZIyGFsbI+LgHLb6wv8HT/zQ6jZciep TUkHRYHtBrgN5HrUo12S+Qb4fChEoBFcBZlec7mQP4/+dx1nwsY9Yfhp6FNmCfAH+qY6 YP1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=ugMYp84O; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x2-20020aa79562000000b00652a0f9e9b0si4930245pfq.97.2023.06.05.00.30.59; Mon, 05 Jun 2023 00:31:11 -0700 (PDT) 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; dkim=pass header.i=@suse.com header.s=susede1 header.b=ugMYp84O; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230050AbjFEHNQ (ORCPT + 99 others); Mon, 5 Jun 2023 03:13:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229999AbjFEHND (ORCPT ); Mon, 5 Jun 2023 03:13:03 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADF9F110 for ; Mon, 5 Jun 2023 00:12:32 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 160FE1F8AB; Mon, 5 Jun 2023 07:12:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1685949140; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=XfVQ9uT9kbRVvxZWdoeBj7hWEgfYxWlxzh+N0mhwC9U=; b=ugMYp84OM22Mf+ikwRJJD8nRHRx68Vsgx8PdYaCYtVIi1XWT9545ikvfdR4ip9TZ4KIqOS 54EpHquab8T1sBXWseq4CMeIka+5ytWkmyaO6OHZor6c4c3rDnDlg0kYOgXtfC2a6kRfG9 Zk+AqMAVylMSfEfwWuSPgUA1Wns/9dM= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id EE021139C7; Mon, 5 Jun 2023 07:12:19 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id N2kbONOKfWRcZAAAMHmgww (envelope-from ); Mon, 05 Jun 2023 07:12:19 +0000 Date: Mon, 5 Jun 2023 09:12:19 +0200 From: Michal Hocko To: Marcelo Tosatti Cc: Christoph Lameter , Aaron Tomlin , Frederic Weisbecker , Andrew Morton , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Vlastimil Babka , Tejun Heo , Lai Jiangshan Subject: Re: [PATCH 3/4] workqueue: add schedule_on_each_cpumask helper Message-ID: References: <20230530145234.968927611@redhat.com> <20230530145335.930262644@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE 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 Fri 02-06-23 14:04:28, Marcelo Tosatti wrote: > On Fri, Jun 02, 2023 at 12:48:23PM +0200, Michal Hocko wrote: [...] > > > + if (!alloc_cpumask_var(&effmask, GFP_KERNEL)) { > > > + free_percpu(works); > > > + return -ENOMEM; > > > + } > > > + > > > + cpumask_and(effmask, cpumask, cpu_online_mask); > > > + > > > + cpus_read_lock(); > > > + > > > + for_each_cpu(cpu, effmask) { > > > > Is the cpu_online_mask dance really necessary? > > > Why cannot you simply do for_each_online_cpu here? > > Are you suggesting to do: > > for_each_online_cpu(cpu) { > if cpu is not in cpumask > continue; > ... > } > > This does not seem efficient. Are you sure this is less sufficient than a memory allocation? -- Michal Hocko SUSE Labs