Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp2195508rdb; Sun, 4 Feb 2024 20:49:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IH9TWujNV7W9CNiDnR2orRyHZQnteBhmOLYwGg1jI04iMb+yY73G3/OCRXcfAqLKtoHsQ1A X-Received: by 2002:ac8:47d6:0:b0:42a:a750:25b5 with SMTP id d22-20020ac847d6000000b0042aa75025b5mr5421273qtr.3.1707108559289; Sun, 04 Feb 2024 20:49:19 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707108559; cv=pass; d=google.com; s=arc-20160816; b=qOUnM4YzJus088VWy/brh/w0Sf4iOekp2IU9tT2tqbY4Zj7fjSuuUskCJ6+xiBO4DT yWYxihOymwaXJyrM67weKE4GyFq23QcGsJb36OQry6sXxouUf+vx+UbOYTJkqbXfflY/ EE6NIpfyyV9xAYeRf7dB7D9YXPSmDB4G1VRZ6zRfGAO8IgdxB84uikXC8TC3yORKbsNn 85j9OAcLJNbSXQxTmYQV7na/NvTNX4oRE7XZhx6cOc26lp8L9y47g2d2NSjH96dnB233 UVFQO32T+SRrZVPaT0NWGpvlsI362n3BvtSF4VpdFszFLyeq2q8JaHV7cIaQnBnz6rqN WQQA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=VJki3x6p1E+mu8GKs3ofSCutFsZKBh2QtjNzNXkMFuo=; fh=tGr6D73c/wuGngAbfOVwgqvRzUKI5/vKSquuaW5ZUqA=; b=wPX1cXjk72+PrhU/xfU+VxlhKOBQt3gK4aBBY4LKd+M9QllB7iVwokES83/bkJwBkT lNbItR44I1mgtM0YdkkXEGLhNCfTVBdyj8S7nEAd2k6qRfqWBw6qrYvmSvUFGOzeb398 bhEroeFrhH9o98IZnaC7GI7HbREuu1Vj2uxRo3wEjHv2chA3zziX5SdcOBhnVYmNXKQj Elo8EqlngT3ANDp05iMhtcA+GLhS36Fp7JGZ5jgrytsF5GcfJ2XC8xU9/ALIAhnaeTk4 NTSmdHgOfPQ1yH+xpS9dC0BcOfG8qVjflSeHEqeA1xy/+AnZwDkOj2hckqwLYXonbpz/ eJww==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=sina.com); spf=pass (google.com: domain of linux-kernel+bounces-52029-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-52029-linux.lists.archive=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCVlljI9dSNB+IPgylu8ojILSgF2dfEAzHXSVP9HqlP9kQbz/tHogH/1G1r93uZe1aHJUzXEdrmPpBD17ykz9gwbFKeg+kRcvpllhThqFQ== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id c22-20020ac87d96000000b0042bf2f699fasi7766225qtd.756.2024.02.04.20.49.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Feb 2024 20:49:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-52029-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=sina.com); spf=pass (google.com: domain of linux-kernel+bounces-52029-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-52029-linux.lists.archive=gmail.com@vger.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 0F49F1C223CB for ; Mon, 5 Feb 2024 04:49:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DAF8AB65C; Mon, 5 Feb 2024 04:49:12 +0000 (UTC) Received: from mail115-100.sinamail.sina.com.cn (mail115-100.sinamail.sina.com.cn [218.30.115.100]) (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 0C720AD32 for ; Mon, 5 Feb 2024 04:49:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=218.30.115.100 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707108552; cv=none; b=ffY162xhF945pycH3ALcoOP2Xx2tDnuOhAlRtnvtTunldSzQxI3vfYFHXsZhMs6mTcIs9BS3c/idzngteccB2b2U8iwWA3JvZXwnOZkfhCkrtTVnCX9NC7jRx0TpUneP7QWcpVdjUkUsp4XnLRzEFgdsvAda7KglSCOgPpaV0gY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707108552; c=relaxed/simple; bh=cdJQFz6hZUzWJNGzDH63QwKkJo4AU14dQ2yGTGVLD10=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Va2mNJSCPyajXiyrHx8QQvT4cM9ITbnKTvL4kYCJq+FfzBldPiqMTbYTXMu9zlecqap7WxQp57X0HBcQNxr0b/OaXxM5C+pGCnVpmqNRdP2OBshOHbxQFvXEfB/1iORYnjtUVr8yGce1emvdvyd1kEWjPi8/4+4WBOFDKriUDdI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sina.com; spf=pass smtp.mailfrom=sina.com; arc=none smtp.client-ip=218.30.115.100 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sina.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sina.com X-SMAIL-HELO: localhost.localdomain Received: from unknown (HELO localhost.localdomain)([113.118.66.117]) by sina.com (172.16.235.24) with ESMTP id 65C0689A000008B5; Mon, 5 Feb 2024 12:48:29 +0800 (CST) X-Sender: hdanton@sina.com X-Auth-ID: hdanton@sina.com Authentication-Results: sina.com; spf=none smtp.mailfrom=hdanton@sina.com; dkim=none header.i=none; dmarc=none action=none header.from=hdanton@sina.com X-SMAIL-MID: 60248245089159 X-SMAIL-UIID: 810C1F7E0DE348C6A2CB06103849C575-20240205-124829-1 From: Hillf Danton To: Tejun Heo Cc: torvalds@linux-foundation.org, mpatocka@redhat.com, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, allen.lkml@gmail.com Subject: Re: [PATCH v3 3/8] workqueue: Implement BH workqueues to eventually replace tasklets Date: Mon, 5 Feb 2024 12:48:17 +0800 Message-Id: <20240205044817.593-1-hdanton@sina.com> In-Reply-To: References: <20240130091300.2968534-1-tj@kernel.org> <20240130091300.2968534-4-tj@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit On Sun, 4 Feb 2024 11:28:06 -1000 Tejun Heo > +static void bh_worker(struct worker *worker) > +{ > + struct worker_pool *pool = worker->pool; > + int nr_restarts = BH_WORKER_RESTARTS; > + unsigned long end = jiffies + BH_WORKER_JIFFIES; > + > + raw_spin_lock_irq(&pool->lock); > + worker_leave_idle(worker); > + > + /* > + * This function follows the structure of worker_thread(). See there for > + * explanations on each step. > + */ > + if (!need_more_worker(pool)) > + goto done; > + > + WARN_ON_ONCE(!list_empty(&worker->scheduled)); > + worker_clr_flags(worker, WORKER_PREP | WORKER_REBOUND); > + > + do { > + struct work_struct *work = > + list_first_entry(&pool->worklist, > + struct work_struct, entry); > + > + if (assign_work(work, worker, NULL)) > + process_scheduled_works(worker); > + } while (keep_working(pool) && > + --nr_restarts && time_before(jiffies, end)); > + > + worker_set_flags(worker, WORKER_PREP); > +done: > + worker_enter_idle(worker); > + kick_pool(pool); > + raw_spin_unlock_irq(&pool->lock); > +} I see no need to exec bh works for 2ms with irq disabled.