Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp558190rdb; Mon, 29 Jan 2024 10:18:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IFxuwzoYem8FXGIarpZFD/5kczw82K5lVdhsbzHXHccdOmZBo62heBsvIHYLPppW7SCB4Bf X-Received: by 2002:a05:620a:b02:b0:783:9953:a02d with SMTP id t2-20020a05620a0b0200b007839953a02dmr5865237qkg.66.1706552316953; Mon, 29 Jan 2024 10:18:36 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706552316; cv=pass; d=google.com; s=arc-20160816; b=0YM4azBSnaEfXzjKJSkEaC6+DW8qgPPhOhZExrBqBqKETExkYFWYtI7KVimjen0Wr0 Mv/I6/dnmLsOBq0HJLNt8VfyFUlMMsoTfOdUmWdaKNzf65z9JTU4G6iRDl/OkcmRpZsE lmTCXJqJk6eTVMglm+cN8VLip6nzHoj9UR1a49eZqZ4g0SBLAm6rMuWfLEwLAXsMvTjD 4reGlp0rKokshmLyEEvLTyU/uBiPRrdM+SFxKdFB1zK5fISevDQ90B6fvDrJRBy9gIHo DvgNhZQj4evHPlELr3vNHhiIJcErEFVRP6dcIkV/5J9/Q1O+h9URaTvTaMvUMF7hc/mT J02Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:sender:dkim-signature; bh=8JsXah7Pkji3SDbAVdxC7AsWo6lMd1Lw+YEA9IO4bmc=; fh=zhu1C8umPZjGXufbaC6GMdJqphOqjDhRtkNu5UNgLiY=; b=E3IkjOdPY1O1RNABAcVGgtzfMzwpLm/2v6T/whq7mWIDX3GHBlnRKyQ6SGSi7xYGf0 ggpW6CWPwTeQ7xOSAljyzuymoKzV7FZ42N4H5J9uOABLVH0j/y3pQgfdUBsURHMj00OA yFdyHXGyOqvw2iI/7j8ZqWlraKp/lAoN2XYCIDRZMyRoo7f6B3TuQT/oWV/y5KrzPsCc ykg/MVzK8b0lAy/nSzbe0BTlK6xoT9/+RGm9D4lQ/Pmv5NirFJiIcnGHuVRVKuwDGtm/ pBEeQtGxfbELK/x2AEAF9B1NhGfaiMKPCc5IEnXdUGCnmJCIBExILHFiJgiFulNJvP5r 89Sw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=dWX9wu8z; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-43306-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-43306-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id m15-20020a05620a290f00b00783daee4340si7886174qkp.782.2024.01.29.10.18.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 10:18:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-43306-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=dWX9wu8z; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-43306-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-43306-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id B3DEC1C2091C for ; Mon, 29 Jan 2024 18:18:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 29DA36F099; Mon, 29 Jan 2024 18:18:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="dWX9wu8z" Received: from mail-pg1-f177.google.com (mail-pg1-f177.google.com [209.85.215.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EE2166F08F for ; Mon, 29 Jan 2024 18:18:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706552299; cv=none; b=YDLsI4xzdNvT8LPN/gl2+z/DP9vKgB5MhjYpHbi6GewTHr+2ZH3+l2PwPCLgODUq0MFMQwewOY7PYPkQz8BCRZJc8mcd5dBsXhVpt9434sbqa3NcHyYVCJm4q/0eomjzYFtyv6wQq0gU8So0k7+Vk0OdspfupL56THDcGimZIu0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706552299; c=relaxed/simple; bh=RlpRow3CqzT0lKovy1uJ/GWXsTUCY3Hx4347GCJxhzk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=jI6vh7P/oON1ML3LkKxsxC73wVpIOMv2N7PC+EmIgy1dAZzR+DRXPl2IhxY4mt5g+MrnHzJ7RPtixwleH5MshtoQ2JYxIZEQqCCHGVvOmGRgYzA/sqC72Jbz8Fjx74NYDAmqRQwE/4VH1rD3qpQdMbbQGfQMAwXkKlBt39+w0DA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=dWX9wu8z; arc=none smtp.client-ip=209.85.215.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pg1-f177.google.com with SMTP id 41be03b00d2f7-5d4a1e66750so1541738a12.0 for ; Mon, 29 Jan 2024 10:18:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706552297; x=1707157097; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:from:to:cc:subject:date:message-id :reply-to; bh=8JsXah7Pkji3SDbAVdxC7AsWo6lMd1Lw+YEA9IO4bmc=; b=dWX9wu8zHRkubfZkZN8k3PUEaQinkAUc7cYkWFa3fuDaJSbEODmyHYkBzd3JYk2/K7 F4cS5zQVJpMtsCPUGlFPBf+oIz+YHxXiAV43IOsNhWl1pv9U72nYPJDCxMnx0ngbvsHa udMC4zRCDuXDym/x0ocJu2acoeEzIpxcgrL8Y6AMaJLzL8g1QMBBne7qdOMu05H9xjZi pAX/l8i/JfZeh33ptseINodQyeXX8HIzkW4zNI5CbLVKFa3ef3k1LVTdi3IkHjNuByba pGy1osJD7gPMuHIoSwz2PjP9Qn6fEYJo5S93V+uqGfqQq3lAxzTkwtjGPEwQXCFhzhUv kcCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706552297; x=1707157097; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8JsXah7Pkji3SDbAVdxC7AsWo6lMd1Lw+YEA9IO4bmc=; b=I/mT+gxhlcd2H+SY7DeB7pd5NYWDbCK7a6XbPSJpv4yhf1TA4m4qgiwZZcMFM+YOAo 2TAz0CJFvR/Kk71tmE4Y/TPPHixiHsxq3U3+0ewtE3S2SxicwJiAauGtefDm9V3sk4o8 apd8I7xGH46vY2VpBVb6tNRfh9WmHJAHc3Ugr6sogOKD/CPnXnzU9dv7f5XivZZs1oND zEyEV8vK8y7U0HOrX2zXDZ6+YBJjb/JmJKQyALK5q/8udCC4yCG8qMqQGxAowT2s1Q7K 7NLEVP5Cnk5dMMXG/yAm2k5+QIysIBmMPnYE3Dq9XPIYOBcQy3hdDJBQi4vD78RqRCkC uaGw== X-Gm-Message-State: AOJu0YyXWjhTyLugbwKAoA/38qNT/MZTSPn8Ug/IuSqQYh0akwErPpdN GMCt65uM3d1/+5ABOX8ZdXV2VomCjam/ISYe3oONgC5pxG5wf9ZjS3smCfXl X-Received: by 2002:a17:90b:60c:b0:290:6b66:620b with SMTP id gb12-20020a17090b060c00b002906b66620bmr2591878pjb.12.1706552297106; Mon, 29 Jan 2024 10:18:17 -0800 (PST) Received: from localhost (dhcp-141-239-144-21.hawaiiantel.net. [141.239.144.21]) by smtp.gmail.com with ESMTPSA id ns1-20020a17090b250100b0028e821155efsm8804988pjb.46.2024.01.29.10.18.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 10:18:16 -0800 (PST) Sender: Tejun Heo Date: Mon, 29 Jan 2024 08:18:15 -1000 From: Tejun Heo To: Leonardo Bras Cc: 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 Message-ID: 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 In-Reply-To: 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? Thanks. -- tejun