Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp184889imn; Thu, 4 Aug 2022 01:44:26 -0700 (PDT) X-Google-Smtp-Source: AA6agR7cb9NLiEASiCQIRlP0lzQ/mUobIjEJSqQEF0jQLbVybSl8Tj7K07CXEbZLsfqlaoHqmhF8 X-Received: by 2002:a17:907:3e29:b0:730:9d82:5113 with SMTP id hp41-20020a1709073e2900b007309d825113mr668015ejc.29.1659602665833; Thu, 04 Aug 2022 01:44:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659602665; cv=none; d=google.com; s=arc-20160816; b=J/yJc7pUtvoeh1xNpd/sczc36B9ead0a5KQQISIEngYLwO7xyaqjrvOV2pK0FbmTkt xSyoFZEgyh3HrQxM+YsoCOaH5sovYTkmySut4gKdO9a4hB9Ng4jJ9lA2Dd0d0682CDoJ 29LkSHefdrVgFyKyw6BI0/boglRUn9yH5OreCAzdiZtfdeGgRKVcOjYu6l8s/4aqiGFO APOfNzmlQB+gUnOktZXTmXiWqyqE2uTFdFSZ9v+o7Ts67Miu0Oehc6QJQg1b7AF1Eyxj A2sQnoy7OCdB10pEX64wf7Qn9DWPb30H1flFPQxl0YJzZ+mQMnZyl2EHtoXi4nqVgVId /UUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=UBybgKMsxDd15bCY1F3MJ8sBpGdDmhHWbWdFhTLioM4=; b=vexwwP1WpsBcRM5t50XPdjbiNKrKbrKmLr/YFEL9HO1rF+E3U8P7MHoQIpIbCMsadj a7RXjW1qfu3r97WRoS6NG8uxrxPk9Myb1gKPEdEaz7oOqj4jF5bDRQsmuAV0aLMUKMme HTMUsKflOxFoEZB8dOixefnVT7R8JY8bBTWSl4qwdwU88GESJPkcDAwbkF6mD2E5CHxN oJ0zcUPy1rt+cSes3/1vADTpWiNP2OWiVVP6CR4idfWccWqjo3j4vQCgDeAOi+34pLQz NMQclIxMizjkhCzo/QGrGF6bj50f+NsnpN+1rqegzynAZ4+bUnq7dgpbMBnhU+nI5LU1 W5TA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=JyMGyYRP; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d3-20020a50cd43000000b0043d4fe7f8e7si662793edj.330.2022.08.04.01.43.59; Thu, 04 Aug 2022 01:44:25 -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=@gmail.com header.s=20210112 header.b=JyMGyYRP; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239499AbiHDImR (ORCPT + 99 others); Thu, 4 Aug 2022 04:42:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239000AbiHDIlr (ORCPT ); Thu, 4 Aug 2022 04:41:47 -0400 Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54D346613A for ; Thu, 4 Aug 2022 01:41:06 -0700 (PDT) Received: by mail-pj1-x1032.google.com with SMTP id pm17so13299011pjb.3 for ; Thu, 04 Aug 2022 01:41:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=UBybgKMsxDd15bCY1F3MJ8sBpGdDmhHWbWdFhTLioM4=; b=JyMGyYRPHz0w2mAM6iWbFWwyEfIO8ohR7V3+ADWVkFlblY4mCwDLRoTYMyOp6ERCq9 4CfqLcUyaVaoxRC5Kh5optSSga1giV+TNyMG0Sl/aE3ZWF3GFtSevZRitiYNdIPpQyAb JGZXsypHS4aK6aJT0gf1c6WiL3wGy0mdG+796IF/bMFqJKtYoCM7a5KgFa70UsK9DEr0 c+8Llqd6y4lqwjGoxiP4e6xyvb1MMTuqMoM/aUxp+lmhll/qo9f1yIfooXWR38EtVO0u 1cfGdUklQGF6lDuO5r73kC6/iYN8wPzUPvjee89JjLvw5LmV4QUloYS1Ilm7w8IbI33y FDzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=UBybgKMsxDd15bCY1F3MJ8sBpGdDmhHWbWdFhTLioM4=; b=WYyMmLV9o835/W4G2iWuiIHfz/r+FKEAjCljf8r/JKMp5+Bm7tP8WcNAW7ov3WJ7ZF YTK4H9nwbSXTOvHw8r6yuExNl/LAcjtKhL2o2n8OKuUAPBnkXmoDGxsrPqfiVCpIUq/f AJp82Bo/oiQVryx3YF3rZqQzAOV7QVnOH7BEv/pde5I8ADfZJc3EFosiUhJq3/CQmrYS 6rloW90yC78TUuXb/vYSkT3iVTiu99mwgvaWxL+C2BiQSUgbughxoIQyZWRGAglMW8th ylmMancwOoQxZd7gjuUo+8l265l88NceI15Bc+U7lg+G7ktpE3+CVWZ+5kBuKObysWtl BmFA== X-Gm-Message-State: ACgBeo3BflJU5pIg6Z1CCbI8W26Xq1zmGQ3umG2y8cBescBNAbfV+zzG yTPQif0Vo63pkZVUj506hfZIsZ1dkSA= X-Received: by 2002:a17:903:189:b0:16f:24e4:1614 with SMTP id z9-20020a170903018900b0016f24e41614mr908929plg.103.1659602465204; Thu, 04 Aug 2022 01:41:05 -0700 (PDT) Received: from localhost ([47.88.5.130]) by smtp.gmail.com with ESMTPSA id f10-20020a170902860a00b0016d33b8a231sm232594plo.270.2022.08.04.01.41.04 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Aug 2022 01:41:04 -0700 (PDT) From: Lai Jiangshan To: linux-kernel@vger.kernel.org Cc: Lai Jiangshan , Tejun Heo , Lai Jiangshan Subject: [RFC PATCH 7/8] workqueue: Remove the outer loop in maybe_create_worker() Date: Thu, 4 Aug 2022 16:41:34 +0800 Message-Id: <20220804084135.92425-8-jiangshanlai@gmail.com> X-Mailer: git-send-email 2.19.1.6.gb485710b In-Reply-To: <20220804084135.92425-1-jiangshanlai@gmail.com> References: <20220804084135.92425-1-jiangshanlai@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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 From: Lai Jiangshan worker_thread() always does the recheck after getting the manager role, so the recheck in the maybe_create_worker() is unneeded and is removed. A piece of comment for maybe_create_worker() is removed because it is not true anymore after the recheck is removed. A piece of comment for manage_workers() is removed because there is already another piece of comment explaining the same thing which is more accurate. Signed-off-by: Lai Jiangshan --- kernel/workqueue.c | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 64dc1833d11a..0d9844b81482 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -2091,9 +2091,6 @@ static void pool_mayday_timeout(struct timer_list *t) * sent to all rescuers with works scheduled on @pool to resolve * possible allocation deadlock. * - * On return, need_to_create_worker() is guaranteed to be %false and - * may_start_working() %true. - * * LOCKING: * raw_spin_lock_irq(pool->lock) which may be released and regrabbed * multiple times. Does GFP_KERNEL allocations. Called only from @@ -2103,7 +2100,6 @@ static void maybe_create_worker(struct worker_pool *pool) __releases(&pool->lock) __acquires(&pool->lock) { -restart: raw_spin_unlock_irq(&pool->lock); /* if we don't make progress in MAYDAY_INITIAL_TIMEOUT, call for help */ @@ -2121,13 +2117,6 @@ __acquires(&pool->lock) del_timer_sync(&pool->mayday_timer); raw_spin_lock_irq(&pool->lock); - /* - * This is necessary even after a new worker was just successfully - * created as @pool->lock was dropped and the new worker might have - * already become busy. - */ - if (need_to_create_worker(pool)) - goto restart; } /** @@ -2138,10 +2127,6 @@ __acquires(&pool->lock) * to. At any given time, there can be only zero or one manager per * pool. The exclusion is handled automatically by this function. * - * The caller can safely start processing works on false return. On - * true return, it's guaranteed that need_to_create_worker() is false - * and may_start_working() is true. - * * CONTEXT: * raw_spin_lock_irq(pool->lock) which may be released and regrabbed * multiple times. Does GFP_KERNEL allocations. -- 2.19.1.6.gb485710b