Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp591754rdb; Mon, 29 Jan 2024 11:28:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IGCCUOcT0OC9RasGzYiL94DEMLTlBa7XjVG8reyXiAoDIGiFLlMszS1HR1fyVnPsXd2kRu8 X-Received: by 2002:a17:906:8da:b0:a34:b006:72ce with SMTP id o26-20020a17090608da00b00a34b00672cemr5000068eje.44.1706556504085; Mon, 29 Jan 2024 11:28:24 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706556504; cv=pass; d=google.com; s=arc-20160816; b=jhciMe/8VD67l/dW9KYYVa3+IV3lQrEHhyHx05O2kl2yvZooJDHcD0hKwbwFV6foRc 5mThOpSAvxwDDl/2CATC5rtwKhPreMJRuHiKla38GuRhido2w927rEl1pzBl8xgtv/Dg eN5jczog1n4fT4pMAn3AtIWCsG0UWD6cHbAm4rvobnVQsgsl8k+EN7vjCbZhXfp5BjWq vDtUQ3XB+72hgqIbP/lSMy1TRfytjA7DCgtCDNxMbcPwsv8wkiU7mS4Hfv1SNwMEvx1r KqhH3s0vmjGBM8xpqLpYAr85EsqtV/PwksD9/e7VLIJ4qnZXch0s90S226J+ctYc8yGB Z7jw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=IcB13Ws5ITW4j3Ksvky6I24v6iNlRk+OZKw84teW+XM=; fh=IQE7hsTnUb19I7x7JQRLJcuTlVCyoQwHRF2INfJ6HpU=; b=ZKaEborWiYf8J7iRkNnhYCMNPfLGTtq+zx+JKaOF3hcoTdWA9eNSqXuIAcOLqqogdr IQiSj2OqXdi5Vp2rH9Vk4hOoa8RR7Y5ErdKMolir8yTDKApwpOnma+nhOklnMphYXY4C /ZxKewRV3rXcW120KdNzmYhWoZ8t/xpRpsJ1C5g/ONsjoN9f8nZYJ45oYX+a7+7q1VOe JcBwYy1Yt0mnRmAbogcnkXut2EHar1aqD+whZN9jjCqNc5MOICI3ACjhbiU8B3m18vnm 9ucOPezZ0ZY1E3uB/ihqltiKNaoQe9EiilUVF3aHWwVz3xR6icW8mVdwPJ4b2g99TpW2 4rNQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=U5tNszZV; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-43407-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-43407-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id fi12-20020a170906da0c00b00a31935c9a7dsi3875064ejb.538.2024.01.29.11.28.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 11:28:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-43407-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=U5tNszZV; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-43407-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-43407-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.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 D36581F27A5F for ; Mon, 29 Jan 2024 19:28:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 163F95644E; Mon, 29 Jan 2024 19:27:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="U5tNszZV" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 3B1DC4C637 for ; Mon, 29 Jan 2024 19:27:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706556437; cv=none; b=gYZWP4EfjMGIGZDbMYCJDz4NS6KPMH1yzGVHKl6MPxbElwLxZA08TxbF3aWtV31gNTKQcXsJFDL5azp7aYuEqIoehYwYXeDZwYnYZiTDUHaIR2GJu+7BHtmTnaFwtgwYJf5LjDRhadN3UCUWsKAX4wnrIbKbwDF0KT3dhRCBEyY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706556437; c=relaxed/simple; bh=5bZskXGQ0jfrMSSDC5uZCp869pKyT+/gw6vmr10wqB8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type:Content-Disposition; b=YqoyrkMPv43F3qM9qK3t9BFuySszh8Ms3JyJsN/jBfmUs1Yx2nAW6EOa7NKllyp17YbSVdVexYZ5d1qqTADptNvAqYcK38SEZYT791YBLa31eV57dQlLD3+ibCMzaUB027FP30x5Hj4wWAkDLS5bJHOuqbTFr6QZE3UPz/fjVU4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=U5tNszZV; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1706556434; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IcB13Ws5ITW4j3Ksvky6I24v6iNlRk+OZKw84teW+XM=; b=U5tNszZVgYkfsGV+BdyVSFbrXog5w1TccMU9DIgk3EagWxnX+Xn2As5KxcuJeAOw+7QUSs eOv/dDFvY+8bY8jiElxaO1xtcZ4AkBNyqmHloqptf4smNdtByCT4YkkG4GxCxn7njLXnfr qEUigO5MOx2/FZAUJFLXxWKp7EXmi94= Received: from mail-pl1-f198.google.com (mail-pl1-f198.google.com [209.85.214.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-623-3ghIsIl-NOyOVoWalGWu8A-1; Mon, 29 Jan 2024 14:27:12 -0500 X-MC-Unique: 3ghIsIl-NOyOVoWalGWu8A-1 Received: by mail-pl1-f198.google.com with SMTP id d9443c01a7336-1d8cff976a9so7766245ad.3 for ; Mon, 29 Jan 2024 11:27:12 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706556431; x=1707161231; h=content-transfer-encoding:content-disposition:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=IcB13Ws5ITW4j3Ksvky6I24v6iNlRk+OZKw84teW+XM=; b=QvKOUv5vN686SW1hUG3nOKxvcGm4yjwRQdTL+vNSDBmdwKbzGBjKc7I02BeT61vSLy B5qhSerRE2hLADy3p8y0jVyWETYFK1Ahlxuz6ARh48Io5CEOHGAPWfw3aHtT8FdMMMhM 0/7Gd1RzyfomTBkNWdyp17CwoYg8CJNb5EjYWabftB2Z8/aaOX2QUH9hIMVB3/XLsdrX xPCOaSmnRSe+zHGPNj/PAdsEO+N5H50u/0xuFxf5fLK9AMijAsbIxuSkFgPztWX61IqU c3bA7dUxCILpfC06UT0+A5XiFVnoBWwtXgJMaD8jvqzuULMy59FV3XDPYJwW367/mLAS qbmQ== X-Gm-Message-State: AOJu0Yw97u0klSSzcgmebVS/Kr4VK73dTzjfAUwLCBwYCFLsVNzDXfMG buTZnJwk0NMIBXZJsQS8rhJnd0h6H4HMUqLLPxBaHWEjiQyrijTgW2k2GQKdsLtkS0VuYksGgTU olK3JZc7eVdvs/HfLyTQ1c1XHP9DXOrm24t1BuCUMASredRcSYauaOrsqXluXWA== X-Received: by 2002:a17:903:2306:b0:1d8:8f4d:4d15 with SMTP id d6-20020a170903230600b001d88f4d4d15mr3754214plh.17.1706556431655; Mon, 29 Jan 2024 11:27:11 -0800 (PST) X-Received: by 2002:a17:903:2306:b0:1d8:8f4d:4d15 with SMTP id d6-20020a170903230600b001d88f4d4d15mr3754204plh.17.1706556431345; Mon, 29 Jan 2024 11:27:11 -0800 (PST) Received: from localhost.localdomain ([2804:1b3:a803:e70d:8905:313f:9514:fada]) by smtp.gmail.com with ESMTPSA id w9-20020a170902c78900b001d8d6c1fcafsm2732025pla.163.2024.01.29.11.27.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 11:27:10 -0800 (PST) From: Leonardo Bras To: Tejun Heo Cc: Leonardo Bras , Lai Jiangshan , Marcelo Tosatti , linux-kernel@vger.kernel.org Subject: Re: [PATCH v1 1/1] wq: Avoid using isolated cpus' timers on unbounded queue_delayed_work Date: Mon, 29 Jan 2024 16:26:57 -0300 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: <20240126010321.2550286-1-leobras@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: 8bit On Mon, Jan 29, 2024 at 08:18:15AM -1000, Tejun Heo wrote: > Hello, > > On Fri, Jan 26, 2024 at 07:05:35PM -0300, Leonardo Bras wrote: > > > if (housekeeping_enabled(HK_TYPE_TIMER)) { > > > cpu = smp_processor_id(); > > > if (!housekeeping_test_cpu(cpu, HK_TYPE_TIMER)) > > > cpu = housekeeping_any_cpu(HK_TYPE_TIMER); > > > add_timer_on(timer, cpu); > > > } else { > > > if (likely(cpu == WORK_CPU_UNBOUND)) > > > add_timer(timer, cpu); > > > else > > > add_timer_on(timer, cpu); > > > } > > > > > > Thanks. > > > > I am not really against it, but for me it's kind of weird to have that many > > calls to add_timer_on() if we can avoid it. > > > > I would rather go with: > > > > ### > > if (unlikely(cpu != WORK_CPU_UNBOUND)) { > > add_timer_on(timer, cpu); > > return; > > } > > > > if (!housekeeping_enabled(HK_TYPE_TIMER)) { > > add_timer(timer); > > return; > > } > > > > cpu = smp_processor_id(); > > if (!housekeeping_test_cpu(cpu, HK_TYPE_TIMER)) > > cpu = housekeeping_any_cpu(HK_TYPE_TIMER); > > > > add_timer_on(timer, cpu); > > ### > > > > What do you think? > > Isn't that still the same number of add_timer[_on]() calls? Yeah, sorry about this, what I meant was: If we are ok on calling add_timer_on() multiple times, I would rather go with the above version, as I think it's better for readability. > > Thanks. Thank you for reviewing! Leo > > -- > tejun >